aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala2
-rw-r--r--src/dotty/tools/dotc/typer/ErrorReporting.scala6
2 files changed, 6 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index c7e7dc50d..498f912f9 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -418,7 +418,7 @@ object SymDenotations {
/** Is this symbol a class that does not extend `AnyVal`? */
final def isNonValueClass(implicit ctx: Context): Boolean =
- isClass && !derivesFrom(defn.AnyValClass)
+ isClass && !derivesFrom(defn.AnyValClass) && (symbol ne defn.NothingClass)
/** Is this symbol a class references to which that are supertypes of null? */
final def isNullableClass(implicit ctx: Context): Boolean =
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 ""