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

type assertion fails on a function of the correct type when named return value used #749

Closed
jimmyfrasche opened this issue Apr 27, 2010 · 3 comments

Comments

@jimmyfrasche
Copy link
Member

1. What is a short input program that triggers the error?
 
package main

func A() bool { return false }
func B() (_ bool) { return false }
func C() (ok bool) { return false }

var funcs = []interface{} {A, B, C}

func main() {
   for i, f := range funcs {
       println(i)
       _ = f.(func()bool)
   }
}

2. What is the full compiler output?

0
1
2
panic: interface conversion: interface is func() (bool), not func() bool
*stack trace omitted*

3. What version of the compiler are you using?  (Run it with the -V flag.)
8g version 5289 release.2010-04-13 release
@rsc
Copy link
Contributor

rsc commented Apr 28, 2010

Comment 1:

Labels changed: added compilerbug.

Owner changed to r...@golang.org.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Apr 28, 2010

Comment 2:

Labels changed: added priority-high.

@rsc
Copy link
Contributor

rsc commented Apr 29, 2010

Comment 3:

This issue was closed by revision 77817e0.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc removed their assignment Jun 22, 2022
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

3 participants