-
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.
feat:named and unnamed type assignment 2 of 3
- Loading branch information
Showing
72 changed files
with
2,513 additions
and
68 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package tests | ||
|
||
type ( | ||
Word uint | ||
nat []Word | ||
) | ||
|
||
var zero = &Int{ | ||
neg: true, | ||
abs: []Word{0}, | ||
} | ||
|
||
// structLit | ||
type Int struct { | ||
neg bool | ||
abs nat | ||
} | ||
|
||
func GetZeroType() nat { | ||
a := zero.abs | ||
return a | ||
} |
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,19 @@ | ||
package tests | ||
|
||
var abs nat | ||
|
||
func (n nat) Add() nat { | ||
return []Word{0} | ||
} | ||
|
||
func GetAbs() nat { | ||
abs = []Word{0} | ||
|
||
return abs | ||
} | ||
|
||
func AbsAdd() nat { | ||
rt := GetAbs().Add() | ||
|
||
return rt | ||
} |
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
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
Oops, something went wrong.