From b2c545173ab4869eb1b193d44f822efb83df104c Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 9 May 2014 18:14:20 +0200 Subject: 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`. --- src/dotty/tools/dotc/typer/ErrorReporting.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/dotty/tools/dotc/typer/ErrorReporting.scala') 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 "" -- cgit v1.2.3