What version of Go are you using (go version)?
$ go version
go version devel go1.18-9c6e8f63c0 Sun Dec 12 06:14:07 2021 +0000 darwin/amd64
Does this issue reproduce with the latest release?
No
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
What did you do?
I'm experiment generics with tip version.
there is a compile error found in my codebase, i have make a minimal test case to reproduce it:
https://go.dev/play/p/zl_QeszZqcq?v=gotip
-- go.mod --
module play
-- p1/p1.go --
package p1
import (
"constraints"
"math/rand"
)
type Builder[T constraints.Integer] struct{}
func (r Builder[T]) New() T {
return T(rand.Int())
}
-- p2/p2.go --
package p2
import (
"play/p1"
)
var IntBuilder = p1.Builder[int]{}
-- p3/p3.go --
package p3
import (
"play/p2"
)
func BuildInt() int {
return p2.IntBuilder.New()
}
-- p4/p4.go --
package p4
import (
"play/p3"
)
func BuildInt() int {
return p3.BuildInt()
}
-- main.go --
package main
import (
"fmt"
"play/p4"
)
func main() {
fmt.Println(p4.BuildInt())
}
What did you expect to see?
What did you see instead?
# play/p4
<autogenerated>:1: internal compiler error: weird Sym: p1.Builder[go.shape.int_0].New, p1.Builder[go.shape.int_0].New
goroutine 1 [running]:
runtime/debug.Stack()
/usr/local/go/src/runtime/debug/stack.go:24 +0x65
cmd/compile/internal/base.FatalfAt({0x3f0378?, 0xc0?}, {0xd23c01, 0x11}, {0xc0004af828, 0x2, 0x2})
/usr/local/go/src/cmd/compile/internal/base/print.go:227 +0x1ca
cmd/compile/internal/base.Fatalf(...)
/usr/local/go/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/typecheck.(*iexporter).pushDecl(0xc0003f0370, 0xc00007edd0)
/usr/local/go/src/cmd/compile/internal/typecheck/iexport.go:461 +0xb7
cmd/compile/internal/typecheck.WriteExports({0xe8b3a0, 0xc000086f60}, 0x1)
/usr/local/go/src/cmd/compile/internal/typecheck/iexport.go:326 +0x2af
cmd/compile/internal/noder.WriteExports(0xc00008ce30)
/usr/local/go/src/cmd/compile/internal/noder/export.go:40 +0x7a
cmd/compile/internal/gc.dumpCompilerObj(0xc00008ce30?)
/usr/local/go/src/cmd/compile/internal/gc/obj.go:107 +0x28
cmd/compile/internal/gc.dumpobj1({0x7ffeda2ecc62, 0x23}, 0x3)
/usr/local/go/src/cmd/compile/internal/gc/obj.go:63 +0x17b
cmd/compile/internal/gc.dumpobj()
/usr/local/go/src/cmd/compile/internal/gc/obj.go:44 +0x36
cmd/compile/internal/gc.Main(0xd4a7f0)
/usr/local/go/src/cmd/compile/internal/gc/main.go:335 +0x11fc
main.main()
/usr/local/go/src/cmd/compile/main.go:55 +0xdd
Go build failed.
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
No
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
I'm experiment generics with tip version.
there is a compile error found in my codebase, i have make a minimal test case to reproduce it:
https://go.dev/play/p/zl_QeszZqcq?v=gotip
What did you expect to see?
What did you see instead?