diff options
author | Thiago Pereira <thiagoandrade6@gmail.com> | 2016-10-25 00:08:37 -0200 |
---|---|---|
committer | Thiago Pereira <thiago.pereira@vivareal.com> | 2016-10-31 10:43:20 -0200 |
commit | 1c0e48fe8cd0b44bfcfbd3705c4f7fcbe448a5be (patch) | |
tree | 98d56876973bd95fb9ec6928d630e54d89d17b28 /src/dotty/tools/dotc/reporting/diagnostic/messages.scala | |
parent | 9f3005c1b742b6d05e94a93ad9ac31b02f951008 (diff) | |
download | dotty-1c0e48fe8cd0b44bfcfbd3705c4f7fcbe448a5be.tar.gz dotty-1c0e48fe8cd0b44bfcfbd3705c4f7fcbe448a5be.tar.bz2 dotty-1c0e48fe8cd0b44bfcfbd3705c4f7fcbe448a5be.zip |
Add error message IdentifierExpected
This commit adds the semantic object fir the ```identifier expected``` error.
It is part of the https://github.com/lampepfl/dotty/issues/1589
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 + } + } } |