Skip to content

Fix range position for vars with default initializer#9355

Merged
dwijnand merged 2 commits intoscala:2.12.xfrom
retronym:ticket/12213
Jan 18, 2021
Merged

Fix range position for vars with default initializer#9355
dwijnand merged 2 commits intoscala:2.12.xfrom
retronym:ticket/12213

Conversation

@retronym
Copy link
Member

@retronym retronym commented Dec 2, 2020

Pass the position of the RHS explicitly rather than using rhs.pos within
TreeBuilder, as that doesn't carry the position of the _ represented by
the singleton tree EmptyTree.

Fixes scala/bug#12213

The `= _` should be include in the range position
of the ValDef.
@lrytz
Copy link
Member

lrytz commented Dec 3, 2020

!!  438 - run/position-val-def.scala                [output differs]
% diff /home/travis/build/scala/scala/test/files/run/position-val-def.check /home/travis/build/scala/scala/test/files/run/position-val-def-run.log
@@ -6,14 +6,14 @@ var x = 0
 
 val x, y = 0
 [NoPosition]{
-  [0:5]val x = [11]0;
+  [4]val x = [11]0;
   [7:12]val y = [11:12]0;
   [NoPosition]()
 }
 
 var x, y = 0
 [NoPosition]{
-  [0:5]var x = [11]0;
+  [4]var x = [11]0;
   [7:12]var y = [11:12]0;
   [NoPosition]()
 }

@dwijnand
Copy link
Member

Looks like this definitely breaks scala.reflect.quasiquotes.DefinitionConstructionProps.scala/bug#8202, but without any useful info ("assertion failed").

@dwijnand dwijnand self-assigned this Jan 14, 2021
Pass the position of the RHS explicitly rather than
using `rhs.pos` within TreeBuilder, as that doesn't
carry the position of the `_` represented by the
singleton tree `EmptyTree`.

Change the quasiquote parser to also pick up the change.

Also, tweaks in DefinitionConstructionProps that came out of fixing the
quasiquote parser change.

Co-authored-by: Dale Wijnand <dale.wijnand@gmail.com>
@dwijnand

This comment has been minimized.

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.

4 participants