Closed
Description
Gopherjs breaks at CL 284052 CL 289715 in the Go repository, due to an assumption about nil basic types here:
gopherjs/compiler/expressions.go
Line 738 in bed99a8
(
t.Kind()
is now types.UntypedNil
)
This is reproducible as follows:
> GO111MODULE=off go test -v -run=TestGoRepositoryCompilerTests ./tests
=== RUN TestGoRepositoryCompilerTests
goos: "linux", goarch: "js"
ok fixedbugs/bug000.go 0.254s
ok fixedbugs/bug002.go 0.190s
ok fixedbugs/bug003.go 0.186s
ok fixedbugs/bug004.go 0.176s
ok fixedbugs/bug005.go 0.178s
# go run run.go -- fixedbugs/bug006.go
exit status 2
panic: unexpected basic type [recovered]
panic: unexpected basic type
goroutine 1 [running]:
go/types.(*Checker).handleBailout(0xc00024a000, 0xc0000eed00)
/usr/local/google/home/rfindley/src/go2/src/go/types/check.go:245 +0x9f
panic(0x918020, 0xa87510)
/usr/local/google/home/rfindley/src/go2/src/runtime/panic.go:965 +0x1c7
github.com/gopherjs/gopherjs/compiler.(*funcContext).translateExpr(0xc00052c2c0, 0xa9a310, 0xc00071c1c0, 0xa9a310)
/usr/local/google/home/rfindley/dev/go/src/github.com/gopherjs/gopherjs/compiler/expressions.go:739 +0xf0d3
This appears to be a case of Hyrum's law -- I'm not aware of documentation stating that a basic nil must be types.UnsafePointer
, though please let me know if I've missed something.
Unless there is evidence that this implicit assumption about nil basic types is widespread, we'd like to land this change in go/types
for go1.17. It seems like a trivial fix, but I'm not familiar with the gopherjs compiler. Could someone take a look? Thanks.
CC @dmitshur
Metadata
Metadata
Assignees
Labels
No labels