Skip to content

Commit e5d19cc

Browse files
committed
This commit adds the semantic object fir the identifier expected error.
It is part of the scala#1589
1 parent 56731e4 commit e5d19cc

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/dotty/tools/dotc/parsing/JavaParsers.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import dotty.tools.dotc.core.Flags
77
import dotty.tools.dotc.core.Flags.FlagSet
88

99
import scala.language.implicitConversions
10-
1110
import JavaTokens._
1211
import JavaScanners._
1312
import Scanners.Offset
@@ -21,8 +20,10 @@ import Symbols._
2120
import ast.Trees._
2221
import Decorators._
2322
import StdNames._
23+
import dotty.tools.dotc.reporting.diagnostic.messages.IdentifierExpected
2424
import dotty.tools.dotc.util.SourceFile
2525
import util.Positions._
26+
2627
import annotation.switch
2728
import scala.collection.mutable.ListBuffer
2829
import scala.reflect.internal.util.Collections._
@@ -230,7 +231,7 @@ object JavaParsers {
230231
case AppliedTypeTree(_, _) | Select(_, _) =>
231232
tree
232233
case _ =>
233-
syntaxError("identifier expected", tree.pos)
234+
syntaxError(IdentifierExpected(), tree.pos)
234235
errorTypeTree
235236
}
236237
}

src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ object Parsers {
316316
case id @ Select(qual, name) =>
317317
cpy.Select(id)(qual, name.toTypeName)
318318
case _ =>
319-
syntaxError("identifier expected", tree.pos)
319+
syntaxError(IdentifierExpected(), tree.pos)
320320
tree
321321
}
322322

src/dotty/tools/dotc/reporting/diagnostic/messages.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,4 +512,10 @@ object messages {
512512
|}""".stripMargin
513513
}
514514

515+
case class IdentifierExpected()(implicit ctx: Context) extends Message(19) {
516+
val kind = "Syntax"
517+
val msg = "identifier expected"
518+
val explanation = ""
519+
}
520+
515521
}

0 commit comments

Comments
 (0)