-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace generic gospeak.Enum[int] with enum.Int64, enum.Uint etc.
The generic Enum type didn't work, as it failed with: "cannot use a type parameter as RHS in type declaration" golang/go#45639
- Loading branch information
1 parent
0dc2359
commit 93bb9aa
Showing
4 changed files
with
49 additions
and
24 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,29 @@ | ||
package enum | ||
|
||
// type Enum[T EnumType] T | ||
// | ||
// type EnumType interface { | ||
// ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~string | ||
// } | ||
// | ||
// NOTE: The generic Enum type didn't work, as it failed with: | ||
// "cannot use a type parameter as RHS in type declaration" | ||
// https://github.com/golang/go/issues/45639 | ||
|
||
type Int int | ||
type Uint uint | ||
|
||
type Int8 int8 | ||
type Uint8 uint8 | ||
|
||
type Int16 int16 | ||
type Uint16 uint16 | ||
|
||
type Int32 int32 | ||
type Uint32 uint32 | ||
|
||
type Int64 int64 | ||
type Uint64 uint64 | ||
|
||
// webrpc TODO: string ENUM | ||
// https://github.com/webrpc/webrpc/issues/203 |
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