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/gc: _ methods in interfaces causes internal compiler error #5691

Closed
griesemer opened this issue Jun 12, 2013 · 6 comments
Closed

cmd/gc: _ methods in interfaces causes internal compiler error #5691

griesemer opened this issue Jun 12, 2013 · 6 comments
Milestone

Comments

@griesemer
Copy link
Contributor

What steps will reproduce the problem?
http://play.golang.org/p/uW1VPvis0M

What is the expected output? What do you see instead?

The spec does not disallow blank (_) methods, and it's possible to declare them for
non-interface types, so this package should compile w/o errors.

However, 6g produces:

prog.go:1: cannot refer to blank field or method
prog.go:1: internal compiler error: orderstmt function call

gccgo accepts this code w/o problems.
@ality
Copy link
Member

ality commented Jun 12, 2013

Comment 1:

The easy fix is to not call genwrapper for _ method symbols but I wonder
what the semantics should be for http://play.golang.org/p/dhbX0y1u9O
gccgo gives:
a.go:16:4: error: incompatible types in assignment (missing method ‘_’)
  i = &T{}
    ^
Should blank methods simply be ignored?

@griesemer
Copy link
Contributor Author

Comment 2:

gccgo complains with the same error:
x.go:16:8: error: incompatible types in assignment (missing method '_')
      i = &T{}
        ^
I believe that it is legal to define as many _ methods as one wants (in interfaces and
for other types), but that they are not visible. Thus, no type can ever satisfy an
interface with a _ method.
But the spec doesn't help much in this respect.

@rsc
Copy link
Contributor

rsc commented Jun 12, 2013

Comment 3:

I agree with gri.

@ality
Copy link
Member

ality commented Jun 14, 2013

Comment 4:

This fix is here: https://golang.org/cl/10255047/

Labels changed: added compilerbug, removed priority-triage.

Owner changed to @ality.

Status changed to Started.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 5:

Labels changed: added go1.2.

@ality
Copy link
Member

ality commented Aug 19, 2013

Comment 6:

This issue was closed by revision f316a7e.

Status changed to Fixed.

@rsc rsc added this to the Go1.2 milestone Apr 14, 2015
@rsc rsc removed the go1.2 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants