Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal compiler error: mismatched types #49432

Closed
zllangct opened this issue Nov 8, 2021 · 1 comment
Closed

internal compiler error: mismatched types #49432

zllangct opened this issue Nov 8, 2021 · 1 comment
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@zllangct
Copy link

zllangct commented Nov 8, 2021

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

$ go version
go version devel go1.18-9e6ad46bcc Sun Nov 7 04:57:22 2021 +0000 windows/amd64

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

go env Output
$ go env
set GOTOOLDIR=C:\xxxxxxxxx
set GOVCS=
set GOVERSION=devel go1.18-9e6ad46bcc Sun Nov 7 04:57:22 2021 +0000
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=xxxxxxxxxx
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=xxxxxxxxxxx

What did you do?

package main

type Handler func(in ...interface{})

type Foo[T any] struct{}

func (b *Foo[T]) Bar(in ...interface{}) {}

func (b *Foo[T]) Init() {
	_ = Handler(b.Bar)
}

func main() {
	c := &Foo[int]{}
	c.Init()
}

What did you see?

.\main.go:10:15: internal compiler error: mismatched types: (*Foo[go.shape.int_0]).Init.func1

goroutine 1 [running]:
runtime/debug.Stack()
	C:/sdk/gotip/src/runtime/debug/stack.go:24 +0x65
cmd/compile/internal/base.FatalfAt({0x4a3ce0?, 0xc0?}, {0x17c3b7f, 0x14}, {0xc00009d090, 0x1, 0x1})
	C:/sdk/gotip/src/cmd/compile/internal/base/print.go:227 +0x1ca
cmd/compile/internal/ir.UseClosure(0xc0004aaa50, 0xc0004140c0)
	C:/sdk/gotip/src/cmd/compile/internal/ir/func.go:413 +0x1e9
cmd/compile/internal/noder.(*genInst).buildClosure(0x1e37f20, 0xc000488840, {0x1933220, 0xc000035320?})
	C:/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:532 +0x1735
cmd/compile/internal/noder.(*genInst).scanForGenCalls.func2({0x1933220, 0xc000035320})
	C:/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:277 +0x1f4
cmd/compile/internal/ir.(*ConvExpr).editChildren(0xc0004aa820, 0xc0004a5110?)
	C:/sdk/gotip/src/cmd/compile/internal/ir/node_gen.go:445 +0x5d
cmd/compile/internal/ir.EditChildren(...)
	C:/sdk/gotip/src/cmd/compile/internal/ir/visit.go:185
cmd/compile/internal/noder.(*genInst).scanForGenCalls.func2({0x1931ab0, 0xc0004aa820})
	C:/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:270 +0x113
cmd/compile/internal/ir.(*AssignStmt).editChildren(0xc0004aa7d0, 0xc00048f080)
	C:/sdk/gotip/src/cmd/compile/internal/ir/node_gen.go:163 +0xc8
cmd/compile/internal/ir.EditChildren(...)
	C:/sdk/gotip/src/cmd/compile/internal/ir/visit.go:185
cmd/compile/internal/noder.(*genInst).scanForGenCalls.func2({0x1931150, 0xc0004aa7d0})
	C:/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:270 +0x113
cmd/compile/internal/ir.editNodes(...)
	C:/sdk/gotip/src/cmd/compile/internal/ir/node_gen.go:1521
cmd/compile/internal/ir.(*Func).editChildren(0xc000380000?, 0xc00048f080?)
	C:/sdk/gotip/src/cmd/compile/internal/ir/func.go:153 +0x74
cmd/compile/internal/ir.EditChildren(...)
	C:/sdk/gotip/src/cmd/compile/internal/ir/visit.go:185
cmd/compile/internal/noder.(*genInst).scanForGenCalls.func2({0x1931e98, 0xc000488840})
	C:/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:270 +0x113
cmd/compile/internal/noder.(*genInst).scanForGenCalls(0x1e37f20, {0x1931e98, 0xc000488840})
	C:/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:281 +0x2cb
cmd/compile/internal/noder.(*genInst).buildInstantiations(0x1e37f20, 0x1)
	C:/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:65 +0x407
cmd/compile/internal/noder.BuildInstantiations(...)
	C:/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:47
cmd/compile/internal/noder.(*irgen).generate(0xc00049e000, {0xc000088860, 0x2, 0xc000490000?})
	C:/sdk/gotip/src/cmd/compile/internal/noder/irgen.go:320 +0x3db
cmd/compile/internal/noder.check2({0xc000088860, 0x2, 0x2})
	C:/sdk/gotip/src/cmd/compile/internal/noder/irgen.go:92 +0x16d
cmd/compile/internal/noder.LoadPackage({0xc0000de120, 0x2, 0x0?})
	C:/sdk/gotip/src/cmd/compile/internal/noder/noder.go:90 +0x335
cmd/compile/internal/gc.Main(0x17e8f78)
	C:/sdk/gotip/src/cmd/compile/internal/gc/main.go:191 +0xb13
main.main()
	C:/sdk/gotip/src/cmd/compile/main.go:55 +0xdd
@cuonglm cuonglm self-assigned this Nov 8, 2021
@cuonglm cuonglm added the NeedsFix The path to resolution is known, but the work has not been done. label Nov 8, 2021
@cuonglm cuonglm added this to the Go1.18 milestone Nov 8, 2021
@gopherbot
Copy link

Change https://golang.org/cl/361961 mentions this issue: cmd/compile: fix irgen mis-handling of ... argument when creating closure

@rsc rsc unassigned cuonglm Jun 23, 2022
@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

3 participants