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 @@ -1057,17 +1057,15 @@ object messages {
1057
1057
| """ .stripMargin
1058
1058
}
1059
1059
1060
- case class ExpectedTokenButFound (expected : Token , found : Token , foundName : TermName )(implicit ctx : Context )
1060
+ case class ExpectedTokenButFound (expected : Token , found : Token )(implicit ctx : Context )
1061
1061
extends Message (ExpectedTokenButFoundID ) {
1062
1062
val kind = " Syntax"
1063
1063
1064
1064
private val expectedText =
1065
1065
if (Tokens .isIdentifier(expected)) " an identifier"
1066
1066
else Tokens .showToken(expected)
1067
1067
1068
- private val foundText =
1069
- if (foundName != null ) hl " ` ${foundName.show}` "
1070
- else Tokens .showToken(found)
1068
+ private val foundText = Tokens .showToken(found)
1071
1069
1072
1070
val msg = hl """ ${expectedText} expected, but ${foundText} found """
1073
1071
@@ -1077,10 +1075,7 @@ object messages {
1077
1075
|If you necessarily want to use $foundText as identifier, you may put it in backticks. """ .stripMargin
1078
1076
else
1079
1077
" "
1080
-
1081
- val explanation =
1082
- s """ |The text ${foundText} may not occur at that position, the compiler expected ${expectedText}. $ifKeyword
1083
- | """ .stripMargin
1078
+ val explanation = s " $ifKeyword"
1084
1079
}
1085
1080
1086
1081
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