diff options
Diffstat (limited to 'src/dotty/tools/dotc/reporting/diagnostic/messages.scala')
-rw-r--r-- | src/dotty/tools/dotc/reporting/diagnostic/messages.scala | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/reporting/diagnostic/messages.scala b/src/dotty/tools/dotc/reporting/diagnostic/messages.scala index 67d53fd22..bec49e728 100644 --- a/src/dotty/tools/dotc/reporting/diagnostic/messages.scala +++ b/src/dotty/tools/dotc/reporting/diagnostic/messages.scala @@ -691,4 +691,28 @@ object messages { |${s"trait A[${mods.flags} type $identifier]"} |""".stripMargin } + + case class IdentifierExpected(identifier: String)(implicit ctx: Context) extends Message(25) { + val kind = "Syntax" + + val msg = "identifier expected" + + val wrongIdentifier = s"def foo: $identifier = {...}" + + val validIdentifier = s"def foo = {...}" + + val explanation = { + hl"""|A valid identifier expected, but `$identifier` found. + |Let the compiler infer the type for you. + |For example, instead of: + | + |$wrongIdentifier + | + |Write your code like: + | + |$validIdentifier + | + |""".stripMargin + } + } } |