Skip to content

Commit 5d25b98

Browse files
authored
Merge pull request #8239 from dotty-staging/update-erased-function-parse-error
Update message for erased function types
2 parents 1830567 + 901271d commit 5d25b98

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2383,17 +2383,17 @@ object messages {
23832383
val explanation: String = ""
23842384
}
23852385

2386-
case class ImplicitTypesCanOnlyBeFunctionTypes()(implicit val ctx: Context)
2386+
case class ImplicitTypesCanOnlyBeFunctionTypes()(implicit val ctx: Context) // TODO remove when (given ...) => is removed
23872387
extends Message(ImplicitTypesCanOnlyBeFunctionTypesID) {
23882388
val kind: String = "Syntax"
2389-
val msg: String = "Types with given keyword can only be function types `given (...) => ...`"
2389+
val msg: String = "Types with given keyword can only be function types `(given ...) => ...`"
23902390
val explanation: String = ""
23912391
}
23922392

23932393
case class ErasedTypesCanOnlyBeFunctionTypes()(implicit val ctx: Context)
23942394
extends Message(ErasedTypesCanOnlyBeFunctionTypesID) {
23952395
val kind: String = "Syntax"
2396-
val msg: String = "Types with erased keyword can only be function types `erased (...) => ...`"
2396+
val msg: String = "Types with erased keyword can only be function types `(erased ...) => ...`"
23972397
val explanation: String = ""
23982398
}
23992399

compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,7 @@ class ErrorMessagesTests extends ErrorMessagesTest {
16991699
implicit val ctx: Context = ictx
17001700
assertMessageCount(1, messages)
17011701
val ImplicitTypesCanOnlyBeFunctionTypes() :: Nil = messages
1702-
assertEquals("Types with given keyword can only be function types `given (...) => ...`", messages.head.msg)
1702+
assertEquals("Types with given keyword can only be function types `(given ...) => ...`", messages.head.msg)
17031703
}
17041704

17051705
@Test def erasedTypesCanOnlyBeFunctionTypesFailed() =
@@ -1708,7 +1708,7 @@ class ErrorMessagesTests extends ErrorMessagesTest {
17081708
implicit val ctx: Context = ictx
17091709
assertMessageCount(1, messages)
17101710
val ErasedTypesCanOnlyBeFunctionTypes() :: Nil = messages
1711-
assertEquals("Types with erased keyword can only be function types `erased (...) => ...`", messages.head.msg)
1711+
assertEquals("Types with erased keyword can only be function types `(erased ...) => ...`", messages.head.msg)
17121712
}
17131713

17141714
@Test def caseClassMissingParamListSuccessful =

0 commit comments

Comments
 (0)