aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/ErrorReporting.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-05-09 18:14:20 +0200
committerSamuel Gruetter <samuel.gruetter@epfl.ch>2014-05-20 13:38:49 +0200
commitb2c545173ab4869eb1b193d44f822efb83df104c (patch)
tree9f081bbaebbe03e5824d8acc2332f48b47483e26 /src/dotty/tools/dotc/typer/ErrorReporting.scala
parent27081ae59ba5b00b6ae05bb3cdd9c3ff7db0a28e (diff)
downloaddotty-b2c545173ab4869eb1b193d44f822efb83df104c.tar.gz
dotty-b2c545173ab4869eb1b193d44f822efb83df104c.tar.bz2
dotty-b2c545173ab4869eb1b193d44f822efb83df104c.zip
Nothing is not a superclass of Null.
Fix so it isn't. This caused an error in ErrorReporting because we do not propagate bounds into a type like ValOrDefDef[_]. Error in `ErrorReporting` is now fixed but the problem is reflected in test case `boundspropagation`.
Diffstat (limited to 'src/dotty/tools/dotc/typer/ErrorReporting.scala')
-rw-r--r--src/dotty/tools/dotc/typer/ErrorReporting.scala6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/ErrorReporting.scala b/src/dotty/tools/dotc/typer/ErrorReporting.scala
index 8f9b01fe6..0b016769b 100644
--- a/src/dotty/tools/dotc/typer/ErrorReporting.scala
+++ b/src/dotty/tools/dotc/typer/ErrorReporting.scala
@@ -28,7 +28,11 @@ object ErrorReporting {
def errorMsg(msg: String, cx: Context): String =
if (cx.mode is Mode.InferringReturnType) {
cx.tree match {
- case tree: Trees.ValOrDefDef[_] =>
+ case tree: untpd.ValOrDefDef =>
+ // Dotty deviation: Was Trees.ValOrDefDef[_], but this gives ValOrDefDef[Nothing] instead of
+ // ValOrDefDel[Null]. Scala handles it, but it looks accidental because bounds propagation
+ // fails if the parameter is invariant or cotravariant.
+ // See test pending/pos/boundspropagation.scala
val treeSym = ctx.symOfContextTree(tree)
if (treeSym.exists && treeSym.name == cycleSym.name && treeSym.owner == cycleSym.owner) {
val result = if (cycleSym.isSourceMethod) " result" else ""