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

cmd/compile: internal compiler error: method receiver, when missing function type on anonymous function #22389

Closed
anisus opened this issue Oct 23, 2017 · 4 comments

Comments

Projects
None yet
6 participants
@anisus
Copy link

commented Oct 23, 2017

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

go1.9.1 windows/amd64

Does this issue reproduce with the latest release?

Yes

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

windows/amd64

What did you do?

Missed typing the parameter type for an anonymous function which is using the same parameter name as a variable defined in surrounding function.

It is reproducible in play.golang.org

https://play.golang.org/p/AP3xRF11H4

What did you expect to see?

No internal compiler error

What did you see instead?

internal compiler error: method receiver

@ALTree

This comment has been minimized.

Copy link
Member

commented Oct 23, 2017

Appears to be already fixed on tip

$ go version
go version go1.9 linux/amd64

$ go build test.go
# command-line-arguments
./test.go:16:14: f is not a type
./test.go:16:8: internal compiler error: method receiver

goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
	/usr/local/go/src/runtime/debug/stack.go:24 +0xa7
cmd/compile/internal/gc.Fatalf(0xb5dd44, 0xf, 0x0, 0x0, 0x0)
	/usr/local/go/src/cmd/compile/internal/gc/subr.go:181 +0x230
cmd/compile/internal/gc.typecheck1(0xc4202f3800, 0x1, 0xc4202f3680)
	/usr/local/go/src/cmd/compile/internal/gc/typecheck.go:1285 +0x4a5d
cmd/compile/internal/gc.typecheck(0xc4202f3800, 0x1, 0xc4202f3680)
	/usr/local/go/src/cmd/compile/internal/gc/typecheck.go:201 +0x782
cmd/compile/internal/gc.typecheckslice(0xc420046d30, 0x2, 0x2, 0x1)
	/usr/local/go/src/cmd/compile/internal/gc/typecheck.go:55 +0x54
cmd/compile/internal/gc.Main(0xb73f90)
	/usr/local/go/src/cmd/compile/internal/gc/main.go:480 +0x1fd0
main.main()
	/usr/local/go/src/cmd/compile/main.go:49 +0x95

$ gotip version
go version devel +378de1ae43 Tue Oct 17 04:03:16 2017 +0000 linux/amd64

$ gotip build test.go
# command-line-arguments
./test.go:16:14: f is not a type

@griesemer griesemer added this to the Go1.10 milestone Oct 23, 2017

@odeke-em

This comment has been minimized.

Copy link
Member

commented Oct 31, 2017

@mdempsky your CL https://go-review.googlesource.com/c/go/+/70850 and commit f3d4ff7#diff-4e8331dc0915d867dc05240b929434de fixed this issue. I'll mail a CL locking in a test for this issue and then we can close this issue.

@gopherbot

This comment has been minimized.

Copy link

commented Oct 31, 2017

Change https://golang.org/cl/74630 mentions this issue: cmd/compile: test for omitted ICE diagnostics after normal messages

@odeke-em odeke-em self-assigned this Oct 31, 2017

gopherbot pushed a commit that referenced this issue Nov 6, 2017

cmd/compile: test for omitted ICE diagnostics after normal messages
Updates #22389

@mdempsky's CL 70850 fixed the unnecessary
compile stack trace printing during ICE diagnostics.

This CL adds a test to lock in this behavior.

Change-Id: I9ce49923c80b78cb8c0bb5dc4af3c860a43d63ba
Reviewed-on: https://go-review.googlesource.com/74630
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
@odeke-em

This comment has been minimized.

Copy link
Member

commented Nov 6, 2017

Alright, closed with CL https://go-review.googlesource.com/c/go/+/74630 and commit 0ba4eba. Thanks for the report @anisus and for tracking it @ALTree and @mdempsky for the actual fix!

@odeke-em odeke-em closed this Nov 6, 2017

@golang golang locked and limited conversation to collaborators Nov 6, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.