File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -4113,6 +4113,10 @@ object Parsers {
4113
4113
tpt = scalaUnit
4114
4114
if (in.token == LBRACE ) expr()
4115
4115
else EmptyTree
4116
+ else if in.token == IDENTIFIER && paramss.isEmpty && name.endsWith(" :" ) then
4117
+ val help = i " ; identifier ends in colon, did you mean ` ${name.toSimpleName.dropRight(1 )}`: in backticks? "
4118
+ syntaxErrorOrIncomplete(ExpectedTokenButFound (EQUALS , in.token, suffix = help))
4119
+ EmptyTree
4116
4120
else
4117
4121
if (! isExprIntro) syntaxError(MissingReturnType (), in.lastOffset)
4118
4122
accept(EQUALS )
Original file line number Diff line number Diff line change 9
9
-- [E040] Syntax Error: tests/neg/i18020b.scala:4:10 -------------------------------------------------------------------
10
10
4 | def g_: Int = 27 // error
11
11
| ^^^
12
- | '=' expected, but identifier found
12
+ | '=' expected, but identifier found; identifier ends in colon, did you mean `g_`: in backticks?
13
13
-- [E040] Syntax Error: tests/neg/i18020b.scala:6:12 -------------------------------------------------------------------
14
14
6 | val x_: Int = 1 // error
15
15
| ^^^
You can’t perform that action at this time.
0 commit comments