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: reference to type-switch variable from within function literal sees wrong type. #5504

Closed
adonovan opened this issue May 17, 2013 · 2 comments
Assignees

Comments

@adonovan
Copy link
Contributor

@adonovan adonovan commented May 17, 2013

When the name bound to a x.(type) type-switch expression is referred to from within a
function literal inside one of the cases, it sees the type of the interface, not the
concrete type of the case.

http://play.golang.org/p/MGwvp09HgW

(That's because processing of the function literal body is deferred until after the type
of the variable x, which was temporarily mutated for each case, has been restored.)
@remyoudompheng
Copy link
Contributor

@remyoudompheng remyoudompheng commented May 18, 2013

Comment 1:

I saw the same bug yesterday and was about to report too.

Loading

@griesemer
Copy link
Contributor

@griesemer griesemer commented May 30, 2013

Comment 2:

This issue was closed by revision golang/tools@faef64e.

Status changed to Fixed.

Loading

@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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants