diff options
author | Martin Odersky <odersky@gmail.com> | 2013-08-14 18:24:51 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-08-14 18:24:51 +0200 |
commit | b90aca7ae53d27b442445b9c08c7b485211da9bc (patch) | |
tree | 868a94fae93eb57d3e2233b41aca5a9508d335fa | |
parent | f814becef39d8d0bb54b4ef101c5f2a310664d75 (diff) | |
download | dotty-b90aca7ae53d27b442445b9c08c7b485211da9bc.tar.gz dotty-b90aca7ae53d27b442445b9c08c7b485211da9bc.tar.bz2 dotty-b90aca7ae53d27b442445b9c08c7b485211da9bc.zip |
ErrorSymbols now have TypeBounds as info when they are type symbols.
-rw-r--r-- | src/dotty/tools/dotc/core/Symbols.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/ErrorReporting.scala | 37 |
3 files changed, 26 insertions, 17 deletions
diff --git a/src/dotty/tools/dotc/core/Symbols.scala b/src/dotty/tools/dotc/core/Symbols.scala index 6edc5c973..1e3fe4e52 100644 --- a/src/dotty/tools/dotc/core/Symbols.scala +++ b/src/dotty/tools/dotc/core/Symbols.scala @@ -235,6 +235,10 @@ trait Symbols { this: Context => def newSkolem(tp: Type) = newSymbol(defn.RootClass, nme.SKOLEM, SyntheticArtifact, tp) + def newErrorSymbol(owner: Symbol, name: Name) = + newSymbol(owner, name, SyntheticArtifact, + if (name.isTypeName) TypeAlias(ErrorType) else ErrorType) + type OwnerMap = Symbol => Symbol /** Map given symbols, subjecting all types to given type map and owner map. diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index ff0f2e990..49ad67c49 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -376,6 +376,8 @@ object Types { l.findMember(name, pre, excluded) & (r.findMember(name, pre, excluded), pre) case OrType(l, r) => l.findMember(name, pre, excluded) | (r.findMember(name, pre, excluded), pre) + case ErrorType => + ctx.newErrorSymbol(pre.classSymbol orElse defn.RootClass, name) case NoType => NoDenotation } /* !!! DEBUG ensuring { denot => diff --git a/src/dotty/tools/dotc/typer/ErrorReporting.scala b/src/dotty/tools/dotc/typer/ErrorReporting.scala index 694f81135..8bbf1eba0 100644 --- a/src/dotty/tools/dotc/typer/ErrorReporting.scala +++ b/src/dotty/tools/dotc/typer/ErrorReporting.scala @@ -77,27 +77,30 @@ object ErrorReporting { def err(implicit ctx: Context): Errors = new Errors - def isSensical(arg: Any)(implicit ctx: Context): Boolean = arg match { - case tpe: Type if tpe.isErroneous => false - case NoSymbol => false - case _ => true - } - - def treatArg(arg: Any, suffix: String)(implicit ctx: Context): (Any, String) = arg match { - case arg: Showable => - (arg.show, suffix) - case arg: List[_] if suffix.head == '%' => - val (sep, rest) = suffix.tail.span(_ != '%') - if (rest.nonEmpty) (arg mkString sep, rest.tail) - else (arg, suffix) - case _ => - (arg, suffix) - } - /** Implementation of i"..." string interpolator */ implicit class InfoString(val sc: StringContext) extends AnyVal { def i(args: Any*)(implicit ctx: Context): String = { + + def isSensical(arg: Any): Boolean = arg match { + case tpe: Type if tpe.isErroneous => false + case NoType => false + case sym: Symbol if sym.isCompleted => + sym.info != ErrorType && sym.info != TypeAlias(ErrorType) && sym.info != NoType + case _ => true + } + + def treatArg(arg: Any, suffix: String): (Any, String) = arg match { + case arg: Showable => + (arg.show, suffix) + case arg: List[_] if suffix.head == '%' => + val (sep, rest) = suffix.tail.span(_ != '%') + if (rest.nonEmpty) (arg mkString sep, rest.tail) + else (arg, suffix) + case _ => + (arg, suffix) + } + if (ctx.reporter.hasErrors && ctx.suppressNonSensicalErrors && !ctx.settings.YshowSuppressedErrors.value && |