Skip to content

cmd/go2go: Panic in type checker #42522

@kalexmills

Description

@kalexmills

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

Whatever is deployed at go2goplay.golang.org as of 11/11/2020 1:21 PM CST.

Does this issue reproduce with the latest release?

Presumably... I only tried it at go2goplay.golang.org

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

go env Output
$ go env

What did you do?

I tried to make this example compile. I don't claim that it's valid syntax, but it causes a panic in the typechecker, so I figured I'd raise it in any case.

https://go2goplay.golang.org/p/rC4sofqXuA5

What did you expect to see?

A compiler error (I think the use of [S] at line 16 is wrong, but don't quote me).

What did you see instead?

panic: assertion failed [recovered]
	panic: assertion failed [recovered]
	panic: assertion failed

goroutine 1 [running]:
go/types.(*Checker).handleBailout(0xc000116280, 0xc0003e7be0)
	/usr/local/go-faketime/src/go/types/check.go:252 +0x9b
panic(0x64e940, 0x6e0db0)
	/usr/local/go-faketime/src/runtime/panic.go:969 +0x175
go/types.(*Checker).stmt.func1(0xc000116280, 0xc000175d60)
	/usr/local/go-faketime/src/go/types/stmt.go:307 +0x85
panic(0x64e940, 0x6e0db0)
	/usr/local/go-faketime/src/runtime/panic.go:975 +0x3e9
go/types.assert(...)
	/usr/local/go-faketime/src/go/types/errors.go:19
go/types.(*Checker).call(0xc000116280, 0xc0000730c0, 0xc000178550, 0x6e90c0, 0xc000010f60, 0x0)
	/usr/local/go-faketime/src/go/types/call.go:188 +0x17cf
go/types.(*Checker).exprInternal(0xc000116280, 0xc0000730c0, 0x6e90c0, 0xc000010f60, 0x0, 0x0, 0x203000)
	/usr/local/go-faketime/src/go/types/expr.go:1349 +0x2b75
go/types.(*Checker).rawExpr(0xc000116280, 0xc0000730c0, 0x6e90c0, 0xc000010f60, 0x0, 0x0, 0x0)
	/usr/local/go-faketime/src/go/types/expr.go:1033 +0xc5
go/types.(*Checker).exprOrType(0xc000116280, 0xc0000730c0, 0x6e90c0, 0xc000010f60)
	/usr/local/go-faketime/src/go/types/expr.go:1748 +0x55
go/types.(*Checker).call(0xc000116280, 0xc0000730c0, 0xc000053860, 0x6e8bc0, 0xc000053860, 0x2511aba00)
	/usr/local/go-faketime/src/go/types/call.go:21 +0xbf
go/types.(*Checker).exprInternal(0xc000116280, 0xc0000730c0, 0x6e8bc0, 0xc000053860, 0x0, 0x0, 0x823bc0)
	/usr/local/go-faketime/src/go/types/expr.go:1600 +0x1dba
go/types.(*Checker).rawExpr(0xc000116280, 0xc0000730c0, 0x6e8bc0, 0xc000053860, 0x0, 0x0, 0x0)
	/usr/local/go-faketime/src/go/types/expr.go:1033 +0xc5
go/types.(*Checker).multiExpr(0xc000116280, 0xc0000730c0, 0x6e8bc0, 0xc000053860)
	/usr/local/go-faketime/src/go/types/expr.go:1723 +0x51
go/types.(*Checker).exprList(0xc000116280, 0xc00001c6e0, 0x1, 0x1, 0x0, 0x203000, 0x203000, 0x203000, 0xc00017a068)
	/usr/local/go-faketime/src/go/types/call.go:282 +0xb4
go/types.(*Checker).initVars(0xc000116280, 0xc00000e398, 0x1, 0x1, 0xc00001c6e0, 0x1, 0x1, 0xc4)
	/usr/local/go-faketime/src/go/types/assignments.go:216 +0x94
go/types.(*Checker).stmt(0xc000116280, 0x0, 0x6e9280, 0xc00000c860)
	/usr/local/go-faketime/src/go/types/stmt.go:455 +0x3438
go/types.(*Checker).stmtList(0xc000116280, 0x0, 0xc00001c6f0, 0x1, 0x1)
	/usr/local/go-faketime/src/go/types/stmt.go:125 +0xd1
go/types.(*Checker).funcBody(0xc000116280, 0xc000176840, 0xc00001a43c, 0x3, 0xc000176a20, 0xc000010f90, 0x0, 0x0)
	/usr/local/go-faketime/src/go/types/stmt.go:42 +0x257
go/types.(*Checker).funcDecl.func1()
	/usr/local/go-faketime/src/go/types/decl.go:813 +0x67
go/types.(*Checker).processDelayed(0xc000116280, 0x0)
	/usr/local/go-faketime/src/go/types/check.go:327 +0x3e
go/types.(*Checker).checkFiles(0xc000116280, 0xc00003dcb8, 0x1, 0x1, 0x0, 0x0)
	/usr/local/go-faketime/src/go/types/check.go:295 +0x205
go/types.(*Checker).Files(...)
	/usr/local/go-faketime/src/go/types/check.go:257
go/types.(*Config).Check(0xc0000729c0, 0xc00001a3e0, 0x4, 0xc000072280, 0xc00003dcb8, 0x1, 0x1, 0xc0000533b0, 0x0, 0x4b70cf, ...)
	/usr/local/go-faketime/src/go/types/api.go:392 +0x188
go/go2go.RewriteBuffer(0xc000070360, 0x7ffca3778dec, 0x1e, 0xc00013a000, 0x15e, 0x35e, 0x0, 0xc000010a80, 0xc000010a50, 0xc000010a20, ...)
	/usr/local/go-faketime/src/go/go2go/go2go.go:139 +0x257
main.translateFile(0xc000070360, 0x7ffca3778dec, 0x1e)
	/usr/local/go-faketime/src/cmd/go2go/translate.go:26 +0xa9
main.main()
	/usr/local/go-faketime/src/cmd/go2go/main.go:74 +0x309

Go build failed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions