diff options
author | Randy Reddig <[email protected]> | 2024-10-22 18:05:04 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-10-22 18:05:04 +0200 |
commit | 24c11d4ba5f722ef646ae0e1ee06b90b2411590c (patch) | |
tree | 60df5e0afbebcc9e7d12195b8e3c784a8102d697 /testdata | |
parent | 3dcac3b5396dfd71f52f398d9951a17d992fa6ba (diff) | |
download | tinygo-24c11d4ba5f722ef646ae0e1ee06b90b2411590c.tar.gz tinygo-24c11d4ba5f722ef646ae0e1ee06b90b2411590c.zip |
compiler: conform to latest iteration of wasm types proposal (#4501)
compiler: align with current wasm types proposal
https://github.com/golang/go/issues/66984
- Remove int and uint as allowed types in params, results, pointers, or struct fields
- Only allow small integers in pointers, arrays, or struct fields
- enforce structs.HostLayout usage per wasm types proposal
https://github.com/golang/go/issues/66984
- require go1.23 for structs.HostLayout
- use an interface to check if GoVersion() exists
This permits TinyGo to compile with Go 1.21.
- use goenv.Compare instead of WantGoVersion
- testdata/wasmexport: use int32 instead of int
- compiler/testdata: add structs.HostLayout
- compiler/testdata: improve tests for structs.HostLayout
Diffstat (limited to 'testdata')
-rw-r--r-- | testdata/wasmexport-noscheduler.go | 6 | ||||
-rw-r--r-- | testdata/wasmexport.go | 10 |
2 files changed, 8 insertions, 8 deletions
diff --git a/testdata/wasmexport-noscheduler.go b/testdata/wasmexport-noscheduler.go index 844c8d158..b996b2faa 100644 --- a/testdata/wasmexport-noscheduler.go +++ b/testdata/wasmexport-noscheduler.go @@ -18,16 +18,16 @@ func hello() { } //go:wasmexport add -func add(a, b int) int { +func add(a, b int32) int32 { println("called add:", a, b) return a + b } //go:wasmimport tester callOutside -func callOutside(a, b int) int +func callOutside(a, b int32) int32 //go:wasmexport reentrantCall -func reentrantCall(a, b int) int { +func reentrantCall(a, b int32) int32 { println("reentrantCall:", a, b) result := callOutside(a, b) println("reentrantCall result:", result) diff --git a/testdata/wasmexport.go b/testdata/wasmexport.go index 9065d6e92..a21576127 100644 --- a/testdata/wasmexport.go +++ b/testdata/wasmexport.go @@ -21,15 +21,15 @@ func hello() { } //go:wasmexport add -func add(a, b int) int { +func add(a, b int32) int32 { println("called add:", a, b) addInputs <- a addInputs <- b return <-addOutput } -var addInputs = make(chan int) -var addOutput = make(chan int) +var addInputs = make(chan int32) +var addOutput = make(chan int32) func adder() { for { @@ -41,10 +41,10 @@ func adder() { } //go:wasmimport tester callOutside -func callOutside(a, b int) int +func callOutside(a, b int32) int32 //go:wasmexport reentrantCall -func reentrantCall(a, b int) int { +func reentrantCall(a, b int32) int32 { println("reentrantCall:", a, b) result := callOutside(a, b) println("reentrantCall result:", result) |