Skip to content

Commit 8ebf080

Browse files
committed
go.mod, compiler: bump minimum Go version to 1.23
This enables gotypesalias=1 by default, which is needed for generic type aliases to work correctly in go/types.
1 parent 020cca8 commit 8ebf080

File tree

6 files changed

+17
-3
lines changed

6 files changed

+17
-3
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
# This tests our lowest supported versions of Go and LLVM, to make sure at
9797
# least the smoke tests still pass.
9898
docker:
99-
- image: golang:1.22-bullseye
99+
- image: golang:1.23-bullseye
100100
steps:
101101
- test-linux:
102102
llvm: "15"

compiler/symbol.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ func (c *compilerContext) isValidWasmType(typ types.Type, site wasmSite) bool {
540540
}
541541
for i := 0; i < typ.NumFields(); i++ {
542542
ftyp := typ.Field(i).Type()
543-
if ftyp.String() == "structs.HostLayout" {
543+
if types.Unalias(ftyp).String() == "structs.HostLayout" {
544544
hasHostLayout = true
545545
continue
546546
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/tinygo-org/tinygo
22

3-
go 1.22.0
3+
go 1.23
44

55
require (
66
github.com/aykevl/go-wasm v0.0.2-0.20250317121156-42b86c494139

main_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ func TestBuild(t *testing.T) {
107107
if minor >= 23 {
108108
tests = append(tests, "go1.23/")
109109
}
110+
if minor >= 24 {
111+
tests = append(tests, "typealias.go")
112+
}
110113

111114
if *testTarget != "" {
112115
// This makes it possible to run one specific test (instead of all),

testdata/typealias.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package main
2+
3+
// Generic type alias (requires go 1.24+, or GOEXPERIMENT=aliastypeparams in go 1.23).
4+
type Set[T comparable] = map[T]struct{}
5+
6+
func main() {
7+
s := make(Set[string])
8+
s["hello"] = struct{}{}
9+
println(len(s))
10+
}

testdata/typealias.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1

0 commit comments

Comments
 (0)