aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--compiler/compiler.go2
-rw-r--r--compiler/symbol.go2
-rw-r--r--main_test.go3
-rw-r--r--testdata/go1.23/go.mod3
-rw-r--r--testdata/go1.23/main.go18
-rw-r--r--testdata/go1.23/out.txt11
6 files changed, 37 insertions, 2 deletions
diff --git a/compiler/compiler.go b/compiler/compiler.go
index bc17250d9..201605d78 100644
--- a/compiler/compiler.go
+++ b/compiler/compiler.go
@@ -1963,7 +1963,7 @@ func (b *builder) getValue(expr ssa.Value, pos token.Pos) llvm.Value {
return value
} else {
// indicates a compiler bug
- panic("local has not been parsed: " + expr.String())
+ panic("SSA value not previously found in function: " + expr.String())
}
}
}
diff --git a/compiler/symbol.go b/compiler/symbol.go
index 37c987859..29f009520 100644
--- a/compiler/symbol.go
+++ b/compiler/symbol.go
@@ -218,7 +218,7 @@ func (c *compilerContext) getFunction(fn *ssa.Function) (llvm.Type, llvm.Value)
// should be created right away.
// The exception is the package initializer, which does appear in the
// *ssa.Package members and so shouldn't be created here.
- if fn.Synthetic != "" && fn.Synthetic != "package initializer" && fn.Synthetic != "generic function" {
+ if fn.Synthetic != "" && fn.Synthetic != "package initializer" && fn.Synthetic != "generic function" && fn.Synthetic != "range-over-func yield" {
irbuilder := c.ctx.NewBuilder()
b := newBuilder(c, irbuilder, fn)
b.createFunction()
diff --git a/main_test.go b/main_test.go
index 4c11f7b18..e70e9f7fd 100644
--- a/main_test.go
+++ b/main_test.go
@@ -97,6 +97,9 @@ func TestBuild(t *testing.T) {
if minor >= 22 {
tests = append(tests, "go1.22/")
}
+ if minor >= 23 {
+ tests = append(tests, "go1.23/")
+ }
if *testTarget != "" {
// This makes it possible to run one specific test (instead of all),
diff --git a/testdata/go1.23/go.mod b/testdata/go1.23/go.mod
new file mode 100644
index 000000000..c0ad79b6d
--- /dev/null
+++ b/testdata/go1.23/go.mod
@@ -0,0 +1,3 @@
+module github.com/tinygo-org/tinygo/testdata/go1.23
+
+go 1.23
diff --git a/testdata/go1.23/main.go b/testdata/go1.23/main.go
new file mode 100644
index 000000000..01782d235
--- /dev/null
+++ b/testdata/go1.23/main.go
@@ -0,0 +1,18 @@
+package main
+
+func main() {
+ testFuncRange(counter)
+}
+
+func testFuncRange(f func(yield func(int) bool)) {
+ for i := range f {
+ println(i)
+ }
+ println("go1.23 has lift-off!")
+}
+
+func counter(yield func(int) bool) {
+ for i := 10; i >= 1; i-- {
+ yield(i)
+ }
+}
diff --git a/testdata/go1.23/out.txt b/testdata/go1.23/out.txt
new file mode 100644
index 000000000..aeeb7d40e
--- /dev/null
+++ b/testdata/go1.23/out.txt
@@ -0,0 +1,11 @@
+10
+9
+8
+7
+6
+5
+4
+3
+2
+1
+go1.23 has lift-off!