diff options
Diffstat (limited to 'compiler/src')
-rw-r--r-- | compiler/src/dotty/tools/dotc/parsing/Parsers.scala | 2 | ||||
-rw-r--r-- | compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala | 26 |
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[_]"} + |""" + } + } |