aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Trousdale <adam.trousdale@sky.com>2016-12-21 20:12:56 +0000
committerFelix Mulder <felix.mulder@gmail.com>2016-12-21 21:12:56 +0100
commitee4f4a109b3ec3190886c75bb6d140087c33287d (patch)
tree704d89e1c3f3465afee76178c746382e22235512
parentf3bf225c241fcf0db8f71585e15161f2cda9bd59 (diff)
downloaddotty-ee4f4a109b3ec3190886c75bb6d140087c33287d.tar.gz
dotty-ee4f4a109b3ec3190886c75bb6d140087c33287d.tar.bz2
dotty-ee4f4a109b3ec3190886c75bb6d140087c33287d.zip
Add error messages - Parsers.scala:712 (#1842)
* Add error messages - Parsers.scala:712 * Tidy up imports and formatting
-rw-r--r--compiler/src/dotty/tools/dotc/parsing/Parsers.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala26
2 files changed, 25 insertions, 3 deletions
diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala
index 76f82d8af..57dd1ea20 100644
--- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala
+++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala
@@ -730,7 +730,7 @@ object Parsers {
in.token match {
case ARROW => functionRest(t :: Nil)
- case FORSOME => syntaxError("existential types no longer supported; use a wildcard type or dependent type instead"); t
+ case FORSOME => syntaxError(ExistentialTypesNoLongerSupported()); t
case _ => t
}
}
diff --git a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
index 9dda233bf..b55b7e868 100644
--- a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
+++ b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
@@ -5,8 +5,7 @@ package diagnostic
import dotc.core._
import Contexts.Context, Decorators._, Symbols._, Names._, NameOps._, Types._
-import util.{SourceFile, NoSource}
-import util.{SourcePosition, NoSourcePosition}
+import util.SourcePosition
import config.Settings.Setting
import interfaces.Diagnostic.{ERROR, WARNING, INFO}
import printing.Highlighting._
@@ -901,4 +900,27 @@ object messages {
val msg = hl"trying to define package with same name as `$existing`"
val explanation = ""
}
+
+ case class ExistentialTypesNoLongerSupported()(implicit ctx: Context) extends Message(34) {
+ val kind = "Syntax"
+ val msg =
+ hl"""|Existential types are no longer supported -
+ |use a wildcard or dependent type instead"""
+ val explanation =
+ hl"""|The use of existential types is no longer supported.
+ |
+ |You should use a wildcard or dependent type instead.
+ |
+ |For example:
+ |
+ |Instead of using ${"forSome"} to specify a type variable
+ |
+ |${"List[T forSome { type T }]"}
+ |
+ |Try using a wildcard type variable
+ |
+ |${"List[_]"}
+ |"""
+ }
+
}