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 {
41134113 tpt = scalaUnit
41144114 if (in.token == LBRACE ) expr()
41154115 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
41164120 else
41174121 if (! isExprIntro) syntaxError(MissingReturnType (), in.lastOffset)
41184122 accept(EQUALS )
Original file line number Diff line number Diff line change 99-- [E040] Syntax Error: tests/neg/i18020b.scala:4:10 -------------------------------------------------------------------
10104 | def g_: Int = 27 // error
1111 | ^^^
12- | '=' expected, but identifier found
12+ | '=' expected, but identifier found; identifier ends in colon, did you mean `g_`: in backticks?
1313-- [E040] Syntax Error: tests/neg/i18020b.scala:6:12 -------------------------------------------------------------------
14146 | val x_: Int = 1 // error
1515 | ^^^
You can’t perform that action at this time.
0 commit comments