Skip to content

go/internal/gcimporter: untyped interface type parameter causes "panic: nil underlying" during testing #57015

@csgura

Description

@csgura

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

$ go version
go version devel go1.20-c85848a4a6 Wed Nov 30 23:25:43 2022 +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/gura/Library/Caches/go-build"
GOENV="/Users/gura/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/gura/go/pkg/mod"
GONOPROXY="*.uangel.com"
GONOSUMDB="*.uangel.com"
GOOS="darwin"
GOPATH="/Users/gura/go"
GOPRIVATE="*.uangel.com"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/gura/sdk/gotip"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/gura/sdk/gotip/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="devel go1.20-c85848a4a6 Wed Nov 30 23:25:43 2022 +0000"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/mr/dvhjg7zd4l125pln73bqyr400000gp/T/go-build2626569659=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

https://go.dev/play/p/ZQZ-dOAbTbo?v=gotip

What did you expect to see?

No Error

What did you see instead?

$ gotip test ./...
# gotiperr
panic: nil underlying [recovered]
        panic: nil underlying

goroutine 1 [running]:
go/types.(*Checker).handleBailout(0x140000f81e0, 0x14000117a88)
        /Users/gura/sdk/gotip/src/go/types/check.go:299 +0x98
panic({0x1031cab00, 0x10321ebf8})
        /Users/gura/sdk/gotip/src/runtime/panic.go:884 +0x1f4
go/types.(*Named).under(0x1400010eaf0)
        /Users/gura/sdk/gotip/src/go/types/named.go:494 +0x34c
go/types.under({0x1032211f0?, 0x1400010eaf0?})
        /Users/gura/sdk/gotip/src/go/types/type.go:23 +0x4c
go/types.computeInterfaceTypeSet(0x0, 0x0?, 0x14000138140)
        /Users/gura/sdk/gotip/src/go/types/typeset.go:273 +0x2c8
go/types.(*Interface).typeSet(0x1031d6e60?)
        /Users/gura/sdk/gotip/src/go/types/interface.go:29 +0x2c
go/types.(*typeWriter).typ(0x1400013a0c0, {0x103221178, 0x14000138140})
        /Users/gura/sdk/gotip/src/go/types/typestring.go:239 +0x4c0
go/types.(*typeWriter).typeList(0x1400013a0c0?, {0x14000097970, 0x1, 0x0?})
        /Users/gura/sdk/gotip/src/go/types/typestring.go:372 +0x44
go/types.(*Context).instanceHash(0x140000c0ce0, {0x1032211f0, 0x1400010ea80}, {0x14000097970, 0x1, 0x1})
        /Users/gura/sdk/gotip/src/go/types/context.go:79 +0xd4
go/types.(*Checker).instance(0xffffffffffffffff?, 0x400000005?, {0x1032211f0?, 0x1400010ea80?}, {0x14000097970, 0x1, 0x1}, 0x0, 0x140000c0ce0)
        /Users/gura/sdk/gotip/src/go/types/instantiate.go:97 +0x1e8
go/types.Instantiate(0x140001165a0?, {0x1032211f0?, 0x1400010ea80}, {0x14000097970, 0x1, 0x1}, 0x0?)
        /Users/gura/sdk/gotip/src/go/types/instantiate.go:63 +0x2f0
go/internal/gcimporter.(*reader).doTyp(0x140001165a0)
        /Users/gura/sdk/gotip/src/go/internal/gcimporter/ureader.go:334 +0xd0
go/internal/gcimporter.(*pkgReader).typIdx(0x140000c90e0, {0x29?, 0x0?}, 0x140000b1380)
        /Users/gura/sdk/gotip/src/go/internal/gcimporter/ureader.go:308 +0x154
go/internal/gcimporter.(*reader).typ(0x140000b13e0)
        /Users/gura/sdk/gotip/src/go/internal/gcimporter/ureader.go:278 +0x4c
go/internal/gcimporter.(*reader).param(0x140000b13e0)
        /Users/gura/sdk/gotip/src/go/internal/gcimporter/ureader.go:453 +0x58
go/internal/gcimporter.(*reader).params(0x140000b13e0)
        /Users/gura/sdk/gotip/src/go/internal/gcimporter/ureader.go:442 +0x78
go/internal/gcimporter.(*reader).signature(0x140000b13e0, 0x140001343f8?, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0})
        /Users/gura/sdk/gotip/src/go/internal/gcimporter/ureader.go:431 +0x58
go/internal/gcimporter.(*pkgReader).objIdx(0x140000c90e0, 0x6?)
        /Users/gura/sdk/gotip/src/go/internal/gcimporter/ureader.go:529 +0x7f4
go/internal/gcimporter.readUnifiedPackage(0x1400011e9c0, 0x0, 0x14000099c50, {0x1, 0x0, {0x140000b4f10, 0xf}, {0x140001341e0, 0x4b3}, {0x140000f21c0, ...}, ...})
        /Users/gura/sdk/gotip/src/go/internal/gcimporter/ureader.go:83 +0x2d4
go/internal/gcimporter.Import(0x1?, 0x0?, {0x140000b4f10, 0xf}, {0x0?, 0x1031ddfe0?}, 0x140000976f0?)
        /Users/gura/sdk/gotip/src/go/internal/gcimporter/gcimporter.go:202 +0x60c
go/importer.(*gcimports).ImportFrom(0x14000117058?, {0x140000b4f10?, 0x103101150?}, {0x0?, 0x1031de3e0?}, 0x140000c8d80?)
        /Users/gura/sdk/gotip/src/go/importer/importer.go:102 +0x4c
go/importer.(*gcimports).Import(0x1031d83c0?, {0x140000b4f10?, 0x140000be241?})
        /Users/gura/sdk/gotip/src/go/importer/importer.go:95 +0x2c
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.run.func2({0x140000be241?, 0x140000c0b20?})
        /Users/gura/sdk/gotip/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:222 +0x6c
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.importerFunc.Import(0x140001171e8?, {0x140000be241?, 0x140000c0b20?})
        /Users/gura/sdk/gotip/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:401 +0x30
go/types.(*Checker).importPackage(0x140000f81e0, {0x10321f920, 0x140000c0a20}, {0x140000be241, 0xf}, {0x140000ba640, 0x18})
        /Users/gura/sdk/gotip/src/go/types/resolver.go:163 +0x1c0
go/types.(*Checker).collectObjects.func1({0x103220300?, 0x14000099ad0?})
        /Users/gura/sdk/gotip/src/go/types/resolver.go:267 +0xc0
go/types.(*Checker).walkDecl(0x140000ba640?, {0x103221a38?, 0x1400011ea00?}, 0x14000117950)
        /Users/gura/sdk/gotip/src/go/types/decl.go:404 +0x1a4
go/types.(*Checker).walkDecls(...)
        /Users/gura/sdk/gotip/src/go/types/decl.go:391
go/types.(*Checker).collectObjects(0x140000f81e0)
        /Users/gura/sdk/gotip/src/go/types/resolver.go:254 +0x990
go/types.(*Checker).checkFiles(0x140000f81e0, {0x140000ae5e8?, 0x140000c3950?, 0x0?})
        /Users/gura/sdk/gotip/src/go/types/check.go:326 +0xa4
go/types.(*Checker).Files(...)
        /Users/gura/sdk/gotip/src/go/types/check.go:304
go/types.(*Config).Check(0x1031d7d60?, {0x140000b4f08?, 0x140000180a7?}, 0x5?, {0x140000ae5e8, 0x1, 0x1}, 0x102eff8dc?)
        /Users/gura/sdk/gotip/src/go/types/api.go:416 +0x70
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.run(0x1400011e9c0, 0x140000a3c70, {0x1400011e880, 0x8, 0x1031d56c0?})
        /Users/gura/sdk/gotip/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:238 +0x408
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.Run({0x16cf0afa0?, 0x1c?}, {0x1400011e880, 0x8, 0x8})
        /Users/gura/sdk/gotip/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:132 +0x90
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.Main({0x1400011c000, 0x1c, 0x1c})
        /Users/gura/sdk/gotip/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:119 +0x2d0
main.main()
        /Users/gura/sdk/gotip/src/cmd/vet/main.go:45 +0x458
# gotiperr/option_test
panic: nil underlying [recovered]
        panic: nil underlying

goroutine 1 [running]:
go/types.(*Checker).handleBailout(0x140001781e0, 0x14000197a88)
        /Users/gura/sdk/gotip/src/go/types/check.go:299 +0x98
panic({0x103056b00, 0x1030aabf8})
        /Users/gura/sdk/gotip/src/runtime/panic.go:884 +0x1f4
go/types.(*Named).under(0x1400018eaf0)
        /Users/gura/sdk/gotip/src/go/types/named.go:494 +0x34c
go/types.under({0x1030ad1f0?, 0x1400018eaf0?})
        /Users/gura/sdk/gotip/src/go/types/type.go:23 +0x4c
go/types.computeInterfaceTypeSet(0x0, 0x0?, 0x140001b6230)
        /Users/gura/sdk/gotip/src/go/types/typeset.go:273 +0x2c8
go/types.(*Interface).typeSet(0x103062e60?)
        /Users/gura/sdk/gotip/src/go/types/interface.go:29 +0x2c
go/types.(*typeWriter).typ(0x140001b80f0, {0x1030ad178, 0x140001b6230})
        /Users/gura/sdk/gotip/src/go/types/typestring.go:239 +0x4c0
go/types.(*typeWriter).typeList(0x140001b80f0?, {0x14000119980, 0x1, 0x0?})
        /Users/gura/sdk/gotip/src/go/types/typestring.go:372 +0x44
go/types.(*Context).instanceHash(0x14000142da0, {0x1030ad1f0, 0x1400018ea80}, {0x14000119980, 0x1, 0x1})
        /Users/gura/sdk/gotip/src/go/types/context.go:79 +0xd4
go/types.(*Checker).instance(0xffffffffffffffff?, 0x400000005?, {0x1030ad1f0?, 0x1400018ea80?}, {0x14000119980, 0x1, 0x1}, 0x0, 0x14000142da0)
        /Users/gura/sdk/gotip/src/go/types/instantiate.go:97 +0x1e8
go/types.Instantiate(0x140001965a0?, {0x1030ad1f0?, 0x1400018ea80}, {0x14000119980, 0x1, 0x1}, 0x0?)
        /Users/gura/sdk/gotip/src/go/types/instantiate.go:63 +0x2f0
go/internal/gcimporter.(*reader).doTyp(0x140001965a0)
        /Users/gura/sdk/gotip/src/go/internal/gcimporter/ureader.go:334 +0xd0
go/internal/gcimporter.(*pkgReader).typIdx(0x140001490e0, {0x29?, 0x0?}, 0x140001332c0)
        /Users/gura/sdk/gotip/src/go/internal/gcimporter/ureader.go:308 +0x154
go/internal/gcimporter.(*reader).typ(0x14000133320)
        /Users/gura/sdk/gotip/src/go/internal/gcimporter/ureader.go:278 +0x4c
go/internal/gcimporter.(*reader).param(0x14000133320)
        /Users/gura/sdk/gotip/src/go/internal/gcimporter/ureader.go:453 +0x58
go/internal/gcimporter.(*reader).params(0x14000133320)
        /Users/gura/sdk/gotip/src/go/internal/gcimporter/ureader.go:442 +0x78
go/internal/gcimporter.(*reader).signature(0x14000133320, 0x140001b23f8?, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0})
        /Users/gura/sdk/gotip/src/go/internal/gcimporter/ureader.go:431 +0x58
go/internal/gcimporter.(*pkgReader).objIdx(0x140001490e0, 0x6?)
        /Users/gura/sdk/gotip/src/go/internal/gcimporter/ureader.go:529 +0x7f4
go/internal/gcimporter.readUnifiedPackage(0x1400019e9c0, 0x0, 0x1400011bc80, {0x1, 0x0, {0x14000136f00, 0xf}, {0x140001b21e0, 0x4b3}, {0x140001721c0, ...}, ...})
        /Users/gura/sdk/gotip/src/go/internal/gcimporter/ureader.go:83 +0x2d4
go/internal/gcimporter.Import(0x1?, 0x0?, {0x14000136f00, 0xf}, {0x0?, 0x103069fe0?}, 0x14000119700?)
        /Users/gura/sdk/gotip/src/go/internal/gcimporter/gcimporter.go:202 +0x60c
go/importer.(*gcimports).ImportFrom(0x14000197058?, {0x14000136f00?, 0x102f8d150?}, {0x0?, 0x10306a3e0?}, 0x14000148d80?)
        /Users/gura/sdk/gotip/src/go/importer/importer.go:102 +0x4c
go/importer.(*gcimports).Import(0x1030643c0?, {0x14000136f00?, 0x14000140259?})
        /Users/gura/sdk/gotip/src/go/importer/importer.go:95 +0x2c
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.run.func2({0x14000140259?, 0x14000142be0?})
        /Users/gura/sdk/gotip/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:222 +0x6c
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.importerFunc.Import(0x140001971e8?, {0x14000140259?, 0x14000142be0?})
        /Users/gura/sdk/gotip/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:401 +0x30
go/types.(*Checker).importPackage(0x140001781e0, {0x1030ab920, 0x14000142a20}, {0x14000140259, 0xf}, {0x14000158180, 0x1f})
        /Users/gura/sdk/gotip/src/go/types/resolver.go:163 +0x1c0
go/types.(*Checker).collectObjects.func1({0x1030ac300?, 0x1400011bad0?})
        /Users/gura/sdk/gotip/src/go/types/resolver.go:267 +0xc0
go/types.(*Checker).walkDecl(0x14000158180?, {0x1030ada38?, 0x1400019ea00?}, 0x14000197950)
        /Users/gura/sdk/gotip/src/go/types/decl.go:404 +0x1a4
go/types.(*Checker).walkDecls(...)
        /Users/gura/sdk/gotip/src/go/types/decl.go:391
go/types.(*Checker).collectObjects(0x140001781e0)
        /Users/gura/sdk/gotip/src/go/types/resolver.go:254 +0x990
go/types.(*Checker).checkFiles(0x140001781e0, {0x140001305f8?, 0x1400010d9f0?, 0x0?})
        /Users/gura/sdk/gotip/src/go/types/check.go:326 +0xa4
go/types.(*Checker).Files(...)
        /Users/gura/sdk/gotip/src/go/types/check.go:304
go/types.(*Config).Check(0x103063d60?, {0x14000140240?, 0x140000180a7?}, 0x5?, {0x140001305f8, 0x1, 0x1}, 0x102d8b8dc?)
        /Users/gura/sdk/gotip/src/go/types/api.go:416 +0x70
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.run(0x1400019e9c0, 0x140001a01a0, {0x1400019e880, 0x8, 0x1030616c0?})
        /Users/gura/sdk/gotip/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:238 +0x408
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.Run({0x16d07ef70?, 0x1c?}, {0x1400019e880, 0x8, 0x8})
        /Users/gura/sdk/gotip/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:132 +0x90
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.Main({0x1400019c000, 0x1c, 0x1c})
        /Users/gura/sdk/gotip/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:119 +0x2d0
main.main()
        /Users/gura/sdk/gotip/src/cmd/vet/main.go:45 +0x458
FAIL    gotiperr/option [build failed]
FAIL

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.compiler/runtimeIssues related to the Go compiler and/or runtime.release-blocker

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions