mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
12d41ba0c1
This enables gotypesalias=1 by default, which is needed for generic type aliases to work correctly in go/types.
11 lines
224 B
Go
11 lines
224 B
Go
package main
|
|
|
|
// Generic type alias (requires go 1.24+, or GOEXPERIMENT=aliastypeparams in go 1.23).
|
|
type Set[T comparable] = map[T]struct{}
|
|
|
|
func main() {
|
|
s := make(Set[string])
|
|
s["hello"] = struct{}{}
|
|
println(len(s))
|
|
}
|