@@ -21,7 +21,7 @@ import ErrorMessageID._
2121import Denotations .SingleDenotation
2222import dotty .tools .dotc .ast .Trees
2323import dotty .tools .dotc .config .ScalaVersion
24- import dotty .tools .dotc .core .Flags .{ FlagSet , Mutable }
24+ import dotty .tools .dotc .core .Flags ._
2525import dotty .tools .dotc .core .SymDenotations .SymDenotation
2626import scala .util .control .NonFatal
2727
@@ -203,11 +203,11 @@ object messages {
203203 val explanation =
204204 hl """ |Anonymous functions must define a type. For example, if you define a function like this one:
205205 |
206- | ${" val f = { case xs @ List(1, 2, 3) => Some(xs) }" }
206+ | ${" val f = { case x: Int => x + 1 }" }
207207 |
208208 |Make sure you give it a type of what you expect to match and help the type inference system:
209209 |
210- | ${" val f: Seq[Int] => Option[List[ Int]] = { case xs @ List(1, 2, 3) => Some(xs) }" } """
210+ | ${" val f: Any => Int = { case x: Int => x + 1 }" } """
211211 }
212212
213213 case class WildcardOnTypeArgumentNotAllowedOnNew ()(implicit ctx : Context )
@@ -2078,23 +2078,14 @@ object messages {
20782078 }
20792079
20802080 case class JavaSymbolIsNotAValue (symbol : Symbol )(implicit ctx : Context ) extends Message (JavaSymbolIsNotAValueID ) {
2081- val msg = hl " $symbol is not a value "
20822081 val kind = " Type Mismatch"
2083- val explanation = {
2084- val javaCodeExample = """ class A {public static int a() {return 1;}}"""
2085-
2086- val scalaCodeExample =
2087- """ val objectA = A // This does not compile
2088- |val aResult = A.a() // This does compile""" .stripMargin
2082+ val msg = {
2083+ val kind =
2084+ if (symbol is Package ) hl " $symbol"
2085+ else hl " Java defined ${" class " + symbol.name}"
20892086
2090- hl """ Java statics and packages cannot be used as a value.
2091- |For Java statics consider the following Java example:
2092- |
2093- | $javaCodeExample
2094- |
2095- |When used from Scala:
2096- |
2097- | $scalaCodeExample"""
2087+ s " $kind is not a value "
20982088 }
2089+ val explanation = " "
20992090 }
21002091}
0 commit comments