Skip to content

Commit 3ce3433

Browse files
committed
Address the PR tasks
1 parent 7c66999 commit 3ce3433

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,7 +1842,9 @@ object messages {
18421842
case class OnlyFunctionsCanBeFollowedByUnderscore(pt: Type)(implicit ctx: Context)
18431843
extends Message(OnlyFunctionsCanBeFollowedByUnderscoreID) {
18441844
val kind = "Syntax"
1845-
val msg = hl"not a function: $pt; cannot be followed by `_'"
1846-
val explanation = ""
1845+
val msg = hl"Not a function: $pt: cannot be followed by ${"_"}"
1846+
val explanation =
1847+
hl"""The syntax ${"x _"} is no longer supported if ${"x"} is not a function.
1848+
|To convert to a function value, you need to explicitly write ${"() => x"}"""
18471849
}
18481850
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,9 +1066,7 @@ class ErrorMessagesTests extends ErrorMessagesTest {
10661066
implicit val ctx: Context = ictx
10671067

10681068
assertMessageCount(1, messages)
1069-
10701069
val OnlyFunctionsCanBeFollowedByUnderscore(pt) :: Nil = messages
1071-
10721070
assertEquals("String(n)", pt.show)
10731071
}
10741072
}

0 commit comments

Comments
 (0)