Skip to content

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

Closed

Description

@anisus

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

Activity

  1. ALTree commented on Oct 23, 2017

    @ALTree
    Member

    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
    
  2. added this to the Go1.10 milestone on Oct 23, 2017
  3. odeke-em commented on Oct 31, 2017

    @odeke-em
    Member

    @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.

  4. gopherbot commented on Oct 31, 2017

    @gopherbot
    Contributor

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

  5. self-assigned this
    on Oct 31, 2017
  6. odeke-em commented on Nov 6, 2017

    @odeke-em
    Member

    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!

  7. locked and limited conversation to collaborators on Nov 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions