File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -1017,7 +1017,17 @@ object desugar {
10171017 }
10181018
10191019 // begin desugar
1020+
1021+ // Special case for `Parens` desugaring: unlike all the desugarings below,
1022+ // its output is not a new tree but an existing one whose position should
1023+ // be preserved, so we shouldn't call `withPos` on it.
10201024 tree match {
1025+ case Parens (t) =>
1026+ return t
1027+ case _ =>
1028+ }
1029+
1030+ val desugared = tree match {
10211031 case SymbolLit (str) =>
10221032 Apply (
10231033 ref(defn.SymbolClass .companionModule.termRef),
@@ -1057,8 +1067,6 @@ object desugar {
10571067 }
10581068 case PrefixOp (op, t) =>
10591069 Select (t, nme.UNARY_PREFIX ++ op.name)
1060- case Parens (t) =>
1061- t
10621070 case Tuple (ts) =>
10631071 val arity = ts.length
10641072 def tupleTypeRef = defn.TupleType (arity)
@@ -1096,7 +1104,8 @@ object desugar {
10961104 finalizer)
10971105 }
10981106 }
1099- }.withPos(tree.pos)
1107+ desugared.withPos(tree.pos)
1108+ }
11001109
11011110 /** Create a class definition with the same info as the refined type given by `parent`
11021111 * and `refinements`.
Original file line number Diff line number Diff line change @@ -64,3 +64,7 @@ scala> { def f: Int = g; val x: Int = 1; def g: Int = 5; }
64641 | { def f: Int = g; val x: Int = 1; def g: Int = 5; }
6565 | ^
6666 | `g` is a forward reference extending over the definition of `x`
67+ scala> while ((( foo ))) {}
68+ 1 | while ((( foo ))) {}
69+ | ^^^
70+ | not found: foo
You can’t perform that action at this time.
0 commit comments