-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
What version of Go are you using (go version
)?
$ go version go version devel go1.18-7bed3c7975 Fri Nov 12 00:16:15 2021 +0000 windows/amd64
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env set GO111MODULE=on set GOARCH=amd64 set GOBIN= set GOCACHE= set GOENV= set GOEXE=.exe set GOEXPERIMENT= set GOFLAGS= set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOINSECURE= set GOMODCACHE= set GONOPROXY= set GONOSUMDB= set CC=gcc set CXX=g++ set CGO_ENABLED=1 set GOMOD= set GOWORK= set CGO_CFLAGS=-g -O2 set CGO_CPPFLAGS= set CGO_CXXFLAGS=-g -O2 set CGO_FFLAGS=-g -O2 set CGO_LDFLAGS=-g -O2 set PKG_CONFIG=pkg-config set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=\AppData\Local\Temp\go-build3365534766=/tmp/go-build -gno-record-gcc-switches
What did you do?
package main type IA interface { Test(interface{}) } type A[T any] struct{} func (a A[T]) Test(in interface{}) {} func Handle[T IA](in *T) { (*in).Test(in) // internal compiler error //(*in).Test(interface{}(in)) // ok } func main() { a := &A[int]{} Handle(a) }
What did you see instead?
.\main.go:17:9: internal compiler error: shape types have no methods PTR-*go.shape.struct {}_0 goroutine 1 [running]: runtime/debug.Stack() C:/Users/xxxxxxx/sdk/gotip/src/runtime/debug/stack.go:24 +0x65 cmd/compile/internal/base.FatalfAt({0xca29e0?, 0x0?}, {0xd4e7f5, 0x1f}, {0xc00041f2f8, 0x1, 0x1}) C:/Users/xxxxxxx/sdk/gotip/src/cmd/compile/internal/base/print.go:227 +0x1ca cmd/compile/internal/base.Fatalf(...) C:/Users/xxxxxxx/sdk/gotip/src/cmd/compile/internal/base/print.go:196 cmd/compile/internal/reflectdata.MarkTypeUsedInInterface(0xc000428c40, 0xc00043a780) C:/Users/xxxxxxx/sdk/gotip/src/cmd/compile/internal/reflectdata/reflect.go:1973 +0x6f cmd/compile/internal/walk.walkConvInterface(0xc00042f720, 0xc00041fa70) C:/Users/xxxxxxx/sdk/gotip/src/cmd/compile/internal/walk/convert.go:49 +0x107 cmd/compile/internal/walk.walkExpr1({0xeb1630, 0xc00042f720}, 0xc00042f720?) C:/Users/xxxxxxx/sdk/gotip/src/cmd/compile/internal/walk/expr.go:211 +0x57f cmd/compile/internal/walk.walkExpr({0xeb1630, 0xc00042f720}, 0xc00041fa70) C:/Users/xxxxxxx/sdk/gotip/src/cmd/compile/internal/walk/expr.go:55 +0x428 cmd/compile/internal/walk.walkExprList(...) C:/Users/xxxxxxx/sdk/gotip/src/cmd/compile/internal/walk/expr.go:335 cmd/compile/internal/walk.walkCall1(0xc000414990, 0xc00041fa70) C:/Users/xxxxxxx/sdk/gotip/src/cmd/compile/internal/walk/expr.go:571 +0x169 cmd/compile/internal/walk.walkCall(0xc000414990, 0xeb0cd0?) C:/Users/xxxxxxx/sdk/gotip/src/cmd/compile/internal/walk/expr.go:553 +0x6ac cmd/compile/internal/walk.walkExpr1({0xeb10b8, 0xc000414990}, 0xc000414990?) C:/Users/xxxxxxx/sdk/gotip/src/cmd/compile/internal/walk/expr.go:176 +0x485 cmd/compile/internal/walk.walkExpr({0xeb10b8, 0xc000414990}, 0xc00041fa70) C:/Users/xxxxxxx/sdk/gotip/src/cmd/compile/internal/walk/expr.go:55 +0x428 cmd/compile/internal/walk.walkStmt({0xeb10b8, 0xc000414990?}) C:/Users/xxxxxxx/sdk/gotip/src/cmd/compile/internal/walk/stmt.go:57 +0x7da cmd/compile/internal/walk.walkStmtList(...) C:/Users/xxxxxxx/sdk/gotip/src/cmd/compile/internal/walk/stmt.go:175 cmd/compile/internal/walk.Walk(0xc000408840) C:/Users/xxxxxxx/sdk/gotip/src/cmd/compile/internal/walk/walk.go:43 +0x151 cmd/compile/internal/gc.prepareFunc(0xc000408840) C:/Users/xxxxxxx/sdk/gotip/src/cmd/compile/internal/gc/compile.go:92 +0x6d cmd/compile/internal/gc.enqueueFunc(0xc000408840) C:/Users/xxxxxxx/sdk/gotip/src/cmd/compile/internal/gc/compile.go:66 +0x2fd cmd/compile/internal/gc.Main(0xd68cf0) C:/Users/xxxxxxx/sdk/gotip/src/cmd/compile/internal/gc/main.go:309 +0xf97 main.main() C:/Users/xxxxxxx/sdk/gotip/src/cmd/compile/main.go:55 +0xdd Compilation finished with exit code 2
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.