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

Fix positions of enum cases #2722

Merged
merged 1 commit into from
Jun 13, 2017
Merged

Fix positions of enum cases #2722

merged 1 commit into from
Jun 13, 2017

Conversation

smarter
Copy link
Member

@smarter smarter commented Jun 9, 2017

This is probably still not 100% correct, but makes enum basically usable
in the IDE (go to definition works inside an enum now)

This is probably still not 100% correct, but makes enum basically usable
in the IDE (go to definition works inside an enum now)
@smarter smarter requested a review from odersky June 9, 2017 09:51
val vdef = ValDef(name, TypeTree(), New(impl1)).withMods(mods | Final).withPos(pos)
flatTree(scaffolding ::: vdef :: Nil).withPos(pos.startPos)
val vdef = ValDef(name, TypeTree(), New(impl1)).withMods(mods | Final)
flatTree(scaffolding ::: vdef :: Nil).withPos(pos)
Copy link
Contributor

@odersky odersky Jun 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add an explanation how that makes a difference? I thought that the previous version would give pos to the actual value definition and startPos to scaffolding. Isn't that what we want?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous version called withPos(pos.startPos) on the whole tree, since children positions have to be contained inside their parents positions, this means that the whole tree including vdef got position pos.startPos.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see now. There are some subtleties involved here.

@odersky odersky merged commit 57ee82c into scala:master Jun 13, 2017
@allanrenucci allanrenucci deleted the enum-pos branch December 14, 2017 16:59
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

Successfully merging this pull request may close these issues.

2 participants