diff options
author | Sebastian Harko <sebastian.harko@lightbend.com> | 2016-10-21 10:59:33 -0700 |
---|---|---|
committer | Sebastian Harko <sebastian.harko@lightbend.com> | 2016-10-21 10:59:33 -0700 |
commit | ac24603b7c04739d2ea2e2441e3b1f76dc2c9281 (patch) | |
tree | 317d0f2abc4f8b75532a721de9e8b8ba4b38a2a3 /src/dotty/tools/dotc/reporting | |
parent | 0d1721c8aebaf6877e9d1ea3d65d40446a869170 (diff) | |
download | dotty-ac24603b7c04739d2ea2e2441e3b1f76dc2c9281.tar.gz dotty-ac24603b7c04739d2ea2e2441e3b1f76dc2c9281.tar.bz2 dotty-ac24603b7c04739d2ea2e2441e3b1f76dc2c9281.zip |
add messages for interpolated string error and repeated modifier error
Diffstat (limited to 'src/dotty/tools/dotc/reporting')
-rw-r--r-- | src/dotty/tools/dotc/reporting/diagnostic/messages.scala | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/reporting/diagnostic/messages.scala b/src/dotty/tools/dotc/reporting/diagnostic/messages.scala index 633501295..c05110b66 100644 --- a/src/dotty/tools/dotc/reporting/diagnostic/messages.scala +++ b/src/dotty/tools/dotc/reporting/diagnostic/messages.scala @@ -400,4 +400,51 @@ object messages { | ((${nestedRepresentation}))""".stripMargin } } + + case class RepeatedModifier(modifier: String)(implicit ctx:Context) extends Message(14) { + val kind = "Syntax" + + val msg = hl"""repeated modifier $modifier""" + + val code1 = hl"""private private val Origin = Point(0, 0)""" + + val code2 = hl"""private final val Origin = Point(0, 0)""" + + val explanation = + hl"""This happens when you accidentally specify the same modifier twice. + | + |Example: + | + |$code1 + | + |instead of + | + |$code2 + | + |""".stripMargin + } + + case class InterpolatedStringError()(implicit ctx:Context) extends Message(15) { + val kind = "Syntax" + + val msg = "error in interpolated string: identifier or block expected" + + val code1 = "s\"$new Point(0, 0)\"" + + val code2 = "s\"${new Point(0, 0)}\"" + + val explanation = + hl""" + |This usually happens when you forget to place your expressions inside curly braces. + | + |$code1 + | + |should be written as + | + |$code2 + | + |""".stripMargin + + } + } |