Skip to content

cmd/compile: shape types have no methods PTR-*cache.AnyCache[interface {}] #50109

Closed
@sylr

Description

@sylr

What version of Go are you using (go version)?

$ go version devel go1.18-766f89b Fri Dec 10 19:26:50 2021 +0000 darwin/arm64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/sylvain/Library/Caches/go-build"
GOENV="/Users/sylvain/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/sylvain/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/sylvain/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/sylvain/sdk/gotip"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/sylvain/sdk/gotip/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="devel go1.18-766f89b Fri Dec 10 19:26:50 2021 +0000"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/sylvain/git/go-cache/go.mod"
GOWORK="/Users/sylvain/go.work"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/hq/ttl6jyh539q55fz6282w0jyc0000gn/T/go-build2711542412=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Upgraded gotip today and ran gotip test ./... on a project that used to work 3 weeks ago.

# sylr.dev/cache/v3_test [sylr.dev/cache/v3.test]
./cache_mutex.go:460:9: internal compiler error: shape types have no methods PTR-*cache.AnyCache[interface {}]

goroutine 1 [running]:
runtime/debug.Stack()
	/Users/sylvain/sdk/gotip/src/runtime/debug/stack.go:24 +0x68
cmd/compile/internal/base.FatalfAt({0x43cef8?, 0x140?}, {0x100d6cf5b, 0x1f}, {0x1400043cee8, 0x1, 0x1})
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/base/print.go:227 +0x20c
cmd/compile/internal/base.Fatalf(...)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/reflectdata.MarkTypeUsedInInterface(0x1400074f880, 0x140005eb480)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/reflectdata/reflect.go:1989 +0x70
cmd/compile/internal/noder.markTypeUsed(...)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:1505
cmd/compile/internal/noder.(*genInst).getDictionarySym(0x10148db00, 0x1400058c820, {0x140000acb70, 0x1, 0x1}, 0x0)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:1555 +0x3dc
cmd/compile/internal/noder.(*genInst).getDictionaryValue(0x1400043d218?, {0x7a2014?, 0x1?}, 0x0?, {0x140000acb70?, 0x140007381e0?, 0x1400060b340?}, 0x58?)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:1740 +0x40
cmd/compile/internal/noder.(*genInst).getDictOrSubdict(0x10148db00?, 0x1400058c820?, {0x100f99378?, 0x1400058e3f0?}, 0x12838bfff?, {0x140000acb70, 0x1, 0x1}, 0x18?)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:626 +0xb4
cmd/compile/internal/noder.(*genInst).scanForGenCalls.func1({0x100f99378, 0x1400058e3f0?})
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:177 +0x2d8
cmd/compile/internal/ir.Visit.func1({0x100f99378, 0x1400058e3f0})
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/ir/visit.go:105 +0x38
cmd/compile/internal/ir.(*AssignStmt).doChildren(0x1400059d040, 0x140005ee000)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/ir/node_gen.go:152 +0x84
cmd/compile/internal/ir.DoChildren(...)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/ir/visit.go:94
cmd/compile/internal/ir.Visit.func1({0x100f98f90, 0x1400059d040})
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/ir/visit.go:106 +0x5c
cmd/compile/internal/ir.doNodes(...)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/ir/node_gen.go:1512
cmd/compile/internal/ir.(*Func).doChildren(0x100f99cd8?, 0x140005ee000?)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/ir/func.go:152 +0x80
cmd/compile/internal/ir.DoChildren(...)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/ir/visit.go:94
cmd/compile/internal/ir.Visit.func1({0x100f99cd8, 0x140003c2f20})
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/ir/visit.go:106 +0x5c
cmd/compile/internal/ir.Visit({0x100f99cd8, 0x140003c2f20}, 0x140005b8680)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/ir/visit.go:108 +0xbc
cmd/compile/internal/noder.(*genInst).scanForGenCalls(0x10148db00, {0x100f99cd8, 0x140003c2f20})
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:158 +0x1d8
cmd/compile/internal/noder.(*genInst).buildInstantiations(0x10148db00, 0x1)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:65 +0x390
cmd/compile/internal/noder.BuildInstantiations(...)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:47
cmd/compile/internal/noder.(*irgen).generate(0x140000fe240, {0x140000ac430, 0x1, 0x8?})
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/noder/irgen.go:320 +0x3c4
cmd/compile/internal/noder.check2({0x140000ac430, 0x1, 0x1})
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/noder/irgen.go:92 +0x130
cmd/compile/internal/noder.LoadPackage({0x140000b6110, 0x1, 0x0?})
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/noder/noder.go:90 +0x2f0
cmd/compile/internal/gc.Main(0x100f91860)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/gc/main.go:191 +0xbe0
main.main()
	/Users/sylvain/sdk/gotip/src/cmd/compile/main.go:55 +0xf8

FAIL	sylr.dev/cache/v3 [build failed]
FAIL

Code can be found at https://github.com/sylr/go-cache

Activity

danscales

danscales commented on Dec 12, 2021

@danscales
Contributor

Thanks for the report!

I'm looking at this issue. I bisected it to some recent changes related to 'any' semantics/error messages.

self-assigned this
on Dec 12, 2021
added this to the Go1.18 milestone on Dec 12, 2021
changed the title [-]internal compiler error: shape types have no methods PTR-*cache.AnyCache[interface {}][/-] [+]cmd/compile: shape types have no methods PTR-*cache.AnyCache[interface {}][/+] on Dec 12, 2021
gopherbot

gopherbot commented on Dec 12, 2021

@gopherbot
Contributor

Change https://golang.org/cl/371154 mentions this issue: cmd/compile: fix identity case relating to 'any' ann shapes

rogpeppe

rogpeppe commented on Dec 13, 2021

@rogpeppe
Contributor

The test in the CL that fixed this is rather involved. This seems to be a rather smaller one: https://gotipplay.golang.org/p/bp3VMZA_9CU

package main

func main() {
	F[any]()
}

func F[T any]() I[T] {
	return (*S1[T])(nil)
}

type I[T any] interface{}

type S1[T any] struct {
	*S2[T]
}

type S2[T any] struct {
	S3 *S3[T]
}

type S3[T any] struct {
	x int
}

@danscales

danscales

danscales commented on Dec 13, 2021

@danscales
Contributor

Thanks for minimizing, @rogpeppe ! I'll add that as a separate test for the issue. I tried to minimize somewhat more, but also wanted to get the change reviewed and some version of a test in quickly, since beta is coming up.

sylr

sylr commented on Dec 13, 2021

@sylr
Author

Thanks @danscales!

gopherbot

gopherbot commented on Dec 13, 2021

@gopherbot
Contributor

Change https://golang.org/cl/371515 mentions this issue: test: add simpler test for issue 50109

locked and limited conversation to collaborators on Jun 22, 2023
added a commit that references this issue on Sep 19, 2024
9bfe09d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @rogpeppe@sylr@danscales@gopherbot

        Issue actions

          cmd/compile: shape types have no methods PTR-*cache.AnyCache[interface {}] · Issue #50109 · golang/go