-
Notifications
You must be signed in to change notification settings - Fork 385
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(gnovm): handle type alias declaration for PrimitiveType (#3222)
Fixes: #3203 <!-- please provide a detailed description of the changes made in this pull request. --> <details><summary>Contributors' checklist...</summary> - [ ] Added new tests, or not needed, or not feasible - [ ] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [ ] Updated the official documentation or not needed - [ ] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [ ] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests </details>
- Loading branch information
1 parent
8fa4997
commit a6f1aba
Showing
2 changed files
with
50 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package main | ||
|
||
type ( | ||
// PrimitiveType | ||
Number = int32 | ||
Number2 = Number | ||
|
||
// PointerType | ||
Pointer = *int32 | ||
Pointer2 = Pointer | ||
|
||
// Interface | ||
Interface = interface{} | ||
Interface2 = Interface | ||
|
||
// S | ||
Struct = struct{Name string} | ||
Struct2 = Struct | ||
) | ||
|
||
func fNumber(n Number) { println(n) } | ||
func fPointer(p Pointer) { println(*p) } | ||
func fInterface(i Interface) { println(i) } | ||
func fStruct(s Struct) { println(s.Name) } | ||
|
||
func main() { | ||
var n Number2 = 5 | ||
fNumber(n) | ||
|
||
var num int32 = 6 | ||
var p Pointer2 = &num | ||
fPointer(p) | ||
|
||
var i Interface2 | ||
i = 7 | ||
fInterface(i) | ||
|
||
var s Struct2 = Struct2{Name: "yo"} | ||
fStruct(s) | ||
} | ||
|
||
// Output: | ||
// 5 | ||
// 6 | ||
// 7 | ||
// yo |