From 9b52fb76dd63b473504aa4f13fd2b318840e0fa6 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Tue, 8 Oct 2019 18:47:12 +0200 Subject: [PATCH] Fix #7387: Avoid comparing NoType with other types --- compiler/src/dotty/tools/dotc/core/TypeComparer.scala | 1 + tests/neg/i7387.scala | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 tests/neg/i7387.scala diff --git a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala index cb037b3275f5..83bfed2312d3 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala @@ -549,6 +549,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w case tp1: RecType => val rthis1 = tp1.recThis recur(tp1.parent, tp2.parent.substRecThis(tp2, rthis1)) + case NoType => false case _ => val tp1stable = ensureStableSingleton(tp1) recur(fixRecs(tp1stable, tp1stable.widenExpr), tp2.parent.substRecThis(tp2, tp1stable)) diff --git a/tests/neg/i7387.scala b/tests/neg/i7387.scala new file mode 100644 index 000000000000..4c64340c0153 --- /dev/null +++ b/tests/neg/i7387.scala @@ -0,0 +1,2 @@ +type E = A.B { type C = D } // error: Not found: A +def g = summon[E] // error: no implicit argument of type E