File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -2184,14 +2184,15 @@ object Parsers {
21842184 /** PrefixExpr ::= [`-' | `+' | `~' | `!'] SimpleExpr
21852185 */
21862186 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
21882190 val start = in.offset
21892191 val op = termIdent()
21902192 if (op.name == nme.raw.MINUS && isNumericLit)
21912193 simpleExprRest(literal(start), location, canApply = true )
21922194 else
21932195 atSpan(start) { PrefixOp (op, simpleExpr(location)) }
2194- }
21952196 else simpleExpr(location)
21962197
21972198 /** 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