File tree 3 files changed +6
-12
lines changed
test/dotty/tools/dotc/reporting
3 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -266,7 +266,7 @@ object Parsers {
266
266
def accept (token : Int ): Int = {
267
267
val offset = in.offset
268
268
if (in.token != token) {
269
- syntaxErrorOrIncomplete(ExpectedTokenButFound (token, in.token, in.name ))
269
+ syntaxErrorOrIncomplete(ExpectedTokenButFound (token, in.token))
270
270
}
271
271
if (in.token == token) in.nextToken()
272
272
offset
@@ -477,7 +477,7 @@ object Parsers {
477
477
in.nextToken()
478
478
name
479
479
} else {
480
- syntaxErrorOrIncomplete(ExpectedTokenButFound (IDENTIFIER , in.token, in.name ))
480
+ syntaxErrorOrIncomplete(ExpectedTokenButFound (IDENTIFIER , in.token))
481
481
nme.ERROR
482
482
}
483
483
Original file line number Diff line number Diff line change @@ -1055,17 +1055,15 @@ object messages {
1055
1055
| """ .stripMargin
1056
1056
}
1057
1057
1058
- case class ExpectedTokenButFound (expected : Token , found : Token , foundName : TermName )(implicit ctx : Context )
1058
+ case class ExpectedTokenButFound (expected : Token , found : Token )(implicit ctx : Context )
1059
1059
extends Message (ExpectedTokenButFoundID ) {
1060
1060
val kind = " Syntax"
1061
1061
1062
1062
private val expectedText =
1063
1063
if (Tokens .isIdentifier(expected)) " an identifier"
1064
1064
else Tokens .showToken(expected)
1065
1065
1066
- private val foundText =
1067
- if (foundName != null ) hl " ` ${foundName.show}` "
1068
- else Tokens .showToken(found)
1066
+ private val foundText = Tokens .showToken(found)
1069
1067
1070
1068
val msg = hl """ ${expectedText} expected, but ${foundText} found """
1071
1069
@@ -1075,10 +1073,7 @@ object messages {
1075
1073
|If you necessarily want to use $foundText as identifier, you may put it in backticks. """ .stripMargin
1076
1074
else
1077
1075
" "
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"
1082
1077
}
1083
1078
1084
1079
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 {
121
121
val defn = ictx.definitions
122
122
123
123
assertMessageCount(1 , messages)
124
- val ExpectedTokenButFound (expected, found, foundName ) :: Nil = messages
124
+ val ExpectedTokenButFound (expected, found) :: Nil = messages
125
125
assertEquals(Tokens .IDENTIFIER , expected)
126
126
assertEquals(Tokens .VAL , found)
127
- assertEquals(" val" , foundName.show)
128
127
}
129
128
130
129
@ Test def expectedToken =
You can’t perform that action at this time.
0 commit comments