File tree 2 files changed +10
-2
lines changed
compiler/src/dotty/tools/dotc/parsing 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -2184,14 +2184,15 @@ object Parsers {
2184
2184
/** PrefixExpr ::= [`-' | `+' | `~' | `!'] SimpleExpr
2185
2185
*/
2186
2186
val prefixExpr : Location => Tree = location =>
2187
- if (isIdent && nme.raw.isUnary(in.name)) {
2187
+ if isIdent && nme.raw.isUnary(in.name)
2188
+ && in.canStartExprTokens.contains(in.lookahead.token)
2189
+ then
2188
2190
val start = in.offset
2189
2191
val op = termIdent()
2190
2192
if (op.name == nme.raw.MINUS && isNumericLit)
2191
2193
simpleExprRest(literal(start), location, canApply = true )
2192
2194
else
2193
2195
atSpan(start) { PrefixOp (op, simpleExpr(location)) }
2194
- }
2195
2196
else simpleExpr(location)
2196
2197
2197
2198
/** SimpleExpr ::= ‘new’ ConstrApp {`with` ConstrApp} [TemplateBody]
Original file line number Diff line number Diff line change
1
+ object + {
2
+ val x = 1
3
+ }
4
+
5
+ object Check {
6
+ val y = + .x
7
+ }
You can’t perform that action at this time.
0 commit comments