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 {
1017
1017
}
1018
1018
1019
1019
// 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.
1020
1024
tree match {
1025
+ case Parens (t) =>
1026
+ return t
1027
+ case _ =>
1028
+ }
1029
+
1030
+ val desugared = tree match {
1021
1031
case SymbolLit (str) =>
1022
1032
Apply (
1023
1033
ref(defn.SymbolClass .companionModule.termRef),
@@ -1057,8 +1067,6 @@ object desugar {
1057
1067
}
1058
1068
case PrefixOp (op, t) =>
1059
1069
Select (t, nme.UNARY_PREFIX ++ op.name)
1060
- case Parens (t) =>
1061
- t
1062
1070
case Tuple (ts) =>
1063
1071
val arity = ts.length
1064
1072
def tupleTypeRef = defn.TupleType (arity)
@@ -1096,7 +1104,8 @@ object desugar {
1096
1104
finalizer)
1097
1105
}
1098
1106
}
1099
- }.withPos(tree.pos)
1107
+ desugared.withPos(tree.pos)
1108
+ }
1100
1109
1101
1110
/** Create a class definition with the same info as the refined type given by `parent`
1102
1111
* 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; }
64
64
1 | { def f: Int = g; val x: Int = 1; def g: Int = 5; }
65
65
| ^
66
66
| `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