-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix the source of inlined trees after Erasure #5883
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
Conversation
e6a7ce8
to
036ab3b
Compare
To ensure that the sources change, the trees need to be copied with the new source rather than preserving it.
4eb58a7
to
1300311
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder whether there's not a less intrusive way to do it:
- In
Reposition
, copy all leaf trees manually, usinguntpd
constructor methods instead ofcpy
. - Then use the tree copier for the rest. That still needs
sourceFile
, but we don't need to test for
sameSource
anymore.
665afb3
to
0984428
Compare
0984428
to
983eb87
Compare
} | ||
def RefinedTypeTree(tree: Tree)(tpt: Tree, refinements: List[Tree])(implicit ctx: Context): RefinedTypeTree = tree match { | ||
case tree: RefinedTypeTree if (tpt eq tree.tpt) && (refinements eq tree.refinements) => tree | ||
case _ => finalize(tree, untpd.RefinedTypeTree(tpt, refinements)(tree.source)) | ||
case _ => finalize(tree, untpd.RefinedTypeTree(tpt, refinements)(sourceFile(tree))) | ||
} | ||
def AppliedTypeTree(tree: Tree)(tpt: Tree, args: List[Tree])(implicit ctx: Context): AppliedTypeTree = tree match { | ||
case tree: AppliedTypeTree if (tpt eq tree.tpt) && (args eq tree.args) => tree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember from #5892 there used to be a check sameSourceFile
in the case, why it is not needed anymore?
To ensure that the sources change, the trees need to be copied with the
new source rather than preserving it.