File tree Expand file tree Collapse file tree 3 files changed +6
-12
lines changed
test/dotty/tools/dotc/reporting Expand file tree Collapse file tree 3 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -266,7 +266,7 @@ object Parsers {
266266 def accept (token : Int ): Int = {
267267 val offset = in.offset
268268 if (in.token != token) {
269- syntaxErrorOrIncomplete(ExpectedTokenButFound (token, in.token, in.name ))
269+ syntaxErrorOrIncomplete(ExpectedTokenButFound (token, in.token))
270270 }
271271 if (in.token == token) in.nextToken()
272272 offset
@@ -477,7 +477,7 @@ object Parsers {
477477 in.nextToken()
478478 name
479479 } else {
480- syntaxErrorOrIncomplete(ExpectedTokenButFound (IDENTIFIER , in.token, in.name ))
480+ syntaxErrorOrIncomplete(ExpectedTokenButFound (IDENTIFIER , in.token))
481481 nme.ERROR
482482 }
483483
Original file line number Diff line number Diff line change @@ -1055,17 +1055,15 @@ object messages {
10551055 | """ .stripMargin
10561056 }
10571057
1058- case class ExpectedTokenButFound (expected : Token , found : Token , foundName : TermName )(implicit ctx : Context )
1058+ case class ExpectedTokenButFound (expected : Token , found : Token )(implicit ctx : Context )
10591059 extends Message (ExpectedTokenButFoundID ) {
10601060 val kind = " Syntax"
10611061
10621062 private val expectedText =
10631063 if (Tokens .isIdentifier(expected)) " an identifier"
10641064 else Tokens .showToken(expected)
10651065
1066- private val foundText =
1067- if (foundName != null ) hl " ` ${foundName.show}` "
1068- else Tokens .showToken(found)
1066+ private val foundText = Tokens .showToken(found)
10691067
10701068 val msg = hl """ ${expectedText} expected, but ${foundText} found """
10711069
@@ -1075,10 +1073,7 @@ object messages {
10751073 |If you necessarily want to use $foundText as identifier, you may put it in backticks. """ .stripMargin
10761074 else
10771075 " "
1078-
1079- val explanation =
1080- s """ |The text ${foundText} may not occur at that position, the compiler expected ${expectedText}. $ifKeyword
1081- | """ .stripMargin
1076+ val explanation = s " $ifKeyword"
10821077 }
10831078
10841079 case class MixedLeftAndRightAssociativeOps (op1 : Name , op2 : Name , op2LeftAssoc : Boolean )(implicit ctx : Context )
Original file line number Diff line number Diff line change @@ -121,10 +121,9 @@ class ErrorMessagesTests extends ErrorMessagesTest {
121121 val defn = ictx.definitions
122122
123123 assertMessageCount(1 , messages)
124- val ExpectedTokenButFound (expected, found, foundName ) :: Nil = messages
124+ val ExpectedTokenButFound (expected, found) :: Nil = messages
125125 assertEquals(Tokens .IDENTIFIER , expected)
126126 assertEquals(Tokens .VAL , found)
127- assertEquals(" val" , foundName.show)
128127 }
129128
130129 @ Test def expectedToken =
You can’t perform that action at this time.
0 commit comments