You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when running tinygo run . I get the following output
main.go:14:8: cannot use len(a) (value of type int) as uintptr value in struct literal
main.go:15:8: cannot use len(a) (value of type int) as uintptr value in struct literal
surprisingly however, when I change the types of the Len and Cap fields to uintptrs, the code complies successfully and runs correctly.
This new code however, will not compile when using the go compiler as the SliceHeader type expects ints for it's length and capacity.
runninggo run . with this version of the code results in the following error
./main.go:14:8: cannot use uintptr(len(a)) (value of type uintptr) as type int in struct literal
./main.go:15:8: cannot use uintptr(len(a)) (value of type uintptr) as type int in struct literal
I believe the behavior of the go compiler is correct here and the tinygo compiler should be updated to expect int values for the Len and Cap fields in the reflect.SliceHeader type.
I'm using tinygo version 0.26.0
tinygo version 0.26.0 linux/amd64 (using go version go1.19 and LLVM version 14.0.0)
The text was updated successfully, but these errors were encountered:
The following code does not compile correctly when using the tinygo compiler
when running
tinygo run .
I get the following outputsurprisingly however, when I change the types of the
Len
andCap
fields touintptr
s, the code complies successfully and runs correctly.This new code however, will not compile when using the
go
compiler as the SliceHeader type expectsint
s for it's length and capacity.running
go run .
with this version of the code results in the following errorI believe the behavior of the
go
compiler is correct here and thetinygo
compiler should be updated to expectint
values for theLen
andCap
fields in thereflect.SliceHeader
type.I'm using tinygo version 0.26.0
The text was updated successfully, but these errors were encountered: