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

go/types, types2: gopls crash on method with type parameters #50427

Open
KarlShing opened this issue Jan 4, 2022 · 2 comments
Open

go/types, types2: gopls crash on method with type parameters #50427

KarlShing opened this issue Jan 4, 2022 · 2 comments

Comments

@KarlShing
Copy link

@KarlShing KarlShing commented Jan 4, 2022

gopls version: v0.7.4
gopls flags:
update flags: proxy
extension version: 0.30.0
go version: devel go1.18-95b240b2cd
environment: Visual Studio Code darwin
initialization error: undefined
issue timestamp: Tue, 04 Jan 2022 06:54:46 GMT
restart history:
Tue, 04 Jan 2022 06:54:38 GMT: activation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

panic: method with type parameters

goroutine 178 [running]:
go/types.(*Checker).handleBailout(0xc0004921c0, 0xc000845688)
	  check.go:279  0x8b
panic({0x1852500, 0x1bca4b0})
	  panic.go:838  0x207
go/types.(*Checker).missingMethod(0xc0004921c0, {0x1bcfba0%3F, 0xc000522980%3F}, 0xc00014dbc0, 0x1)
	  lookup.go:376  0x48e
go/types.(*operand).assignableTo(0xc000b18980, 0xc0004921c0, {0x1bcfba0%3F, 0xc000522a80%3F}, 0xc000843a90)
	  operand.go:283  0x469
go/types.(*Checker).assignment(0xc0004921c0, 0xc000b18980, {0x1bcfba0, 0xc000522a80}, {0xc0008c40f0, 0x12})
	  assignments.go:87  0x80a
go/types.(*Checker).arguments(0xc0004921c0, 0xc000c07080, 0xc0009005c0, {0xc000726b20, 0x1, 0x1}, {0xc000726b30%3F, 0x2, 0x2}, {0xc000726b10, ...})
	  call.go:410  0xbf4
go/types.(*Checker).callExpr(0xc0004921c0, 0xc000b188c0, 0xc000c07080)
	  call.go:206  0x669
go/types.(*Checker).exprInternal(0xc0004921c0, 0xc000b188c0, {0x1bd1c10%3F, 0xc000c07080}, {0x0%3F, 0x0%3F})
	  expr.go:1470  0xa12
go/types.(*Checker).rawExpr(0xc000600000%3F, 0xc000b188c0%3F, {0x1bd1c10%3F, 0xc000c07080%3F}, {0x0%3F, 0x0%3F}, 0x0)
	  expr.go:1094  0x45
go/types.(*Checker).multiExpr(0xc000844840%3F, 0x128adb1%3F, {0x1bd1c10%3F, 0xc000c07080%3F})
	  expr.go:1600  0x35
go/types.(*Checker).exprList(0xc000844960%3F, {0xc0005ac370%3F, 0xc0004921c0%3F, 0x1bcfba0%3F}, 0x0)
	  call.go:249  0x97
go/types.(*Checker).initVars(0x10043c9%3F, {0xc0003ec1f0, 0x1, 0xc000c06c00%3F}, {0xc0005ac370, 0x1, 0x0%3F}, {0x1bd2150, 0xc000c011c0})
	  assignments.go:318  0x89
go/types.(*Checker).stmt(0xc0004921c0, 0x0, {0x1bd2150%3F, 0xc000c011c0%3F})
	  stmt.go:522  0x19ce
go/types.(*Checker).stmtList(0x100e8c5%3F, 0x0, {0xc0005ac380%3F, 0xc000901300%3F, 0x50%3F})
	  stmt.go:125  0xc9
go/types.(*Checker).funcBody(0xc0004921c0, 0xc00014d320, {0xc000b22780%3F, 0x1%3F}, 0xc000901000, 0xc00058ec30, {0x0, 0x0})
	  stmt.go:46  0x285
go/types.(*Checker).funcDecl.func1()
	  decl.go:876  0x45
go/types.(*Checker).processDelayed(0xc0004921c0, 0x0)
	  check.go:348  0x39
go/types.(*Checker).checkFiles(0xc0004921c0, {0xc0003ec018%3F, 0xc000b98000%3F, 0x2%3F})
	  check.go:301  0xcb
go/types.(*Checker).Files(...)
	  check.go:284
golang.org/x/tools/internal/lsp/cache.doTypeCheck({0x1bd32d8, 0xc0006a0000}, 0xc0002aa200, 0xc00094a1e0, 0x2, 0xc0002c11d0, 0x0%3F)
	  check.go:536  0x8b3
golang.org/x/tools/internal/lsp/cache.typeCheck({0x1bd32d8, 0xc0006a0000}, 0xc0002aa200, 0xc00094a1e0, 0x2, 0xc0002c11d0%3F)
	  check.go:313  0xe5
golang.org/x/tools/internal/lsp/cache.(*snapshot).buildPackageHandle.func1({0x1bd32d8%3F, 0xc0006a0000}, {0x1bccbe0%3F, 0xc0002aa200})
	  check.go:124  0x233
golang.org/x/tools/internal/memoize.(*Handle).run.func1()
	  memoize.go:327  0xa9
created by golang.org/x/tools/internal/memoize.(*Handle).run
	  memoize.go:320  0x1b8
[Error - 2:54:39 PM] 

OPTIONAL: If you would like to share more information, you can attach your complete gopls logs.

NOTE: THESE MAY CONTAIN SENSITIVE INFORMATION ABOUT YOUR CODEBASE.
DO NOT SHARE LOGS IF YOU ARE WORKING IN A PRIVATE REPOSITORY.

<OPTIONAL: ATTACH LOGS HERE>

@hyangah hyangah changed the title gopls: automated issue report (crash) x/tools/gopls: automated issue report (crash) - "method with type parameters" Jan 4, 2022
@hyangah hyangah transferred this issue from golang/vscode-go Jan 4, 2022
@gopherbot gopherbot added this to the Unreleased milestone Jan 4, 2022
@findleyr findleyr changed the title x/tools/gopls: automated issue report (crash) - "method with type parameters" go/types, types2: gopls crash on method with type parameters Jan 4, 2022
@findleyr findleyr removed this from the Unreleased milestone Jan 4, 2022
@findleyr findleyr added this to the Go1.18 milestone Jan 4, 2022
@findleyr
Copy link
Contributor

@findleyr findleyr commented Jan 4, 2022

This is really an issue with go/types, so I've remilestoned and labeled accordingly.

CC @griesemer

@findleyr findleyr removed the gopls label Jan 4, 2022
@griesemer
Copy link
Contributor

@griesemer griesemer commented Jan 13, 2022

@findleyr This panic can be only be reached if a method has type parameters. The go/parser does accept type parameters on methods, and it appears that go/types doesn't complain in the resolver (types2 complains in the resolver). go/types then complains in Checker.funcType but seems to collect them anyway. So it seems plausible that they make it all the way into missingMethod.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants