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

Account for embedding depth shadowing #1

Open
mdempsky opened this issue Apr 13, 2017 · 0 comments
Open

Account for embedding depth shadowing #1

mdempsky opened this issue Apr 13, 2017 · 0 comments

Comments

@mdempsky
Copy link
Owner

Consider:

package x

type A struct{ B }
type B struct{ F int }
type T struct { A; B struct { F int } }

var _ = T{}.F

Invoking unbed on A.B currently rewrites T{}.F to T{}.B.F, but the explicit B selection matches against T's field because it has a shallower embedding depth than T{}.A.B. This is a change in semantics.

Unbed could rewrite to T{}.A.B, but in general there are multiple possible qualifications that could be valid, and it's not obvious how unbed should choose one.

In the mean time, unbed should at least detect and reject this scenario.

mdempsky added a commit that referenced this issue Apr 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant