From 041d42f58eae860f88d6f1ea54305c1a7dca6c42 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 5 Feb 2016 16:56:38 +0100 Subject: Handle subtyping of LazyVals that are in train of being evaluated. Instead of forcing again, and causing an assertion error, back out assuming that the result is false. Fixes first problem with #859. --- src/dotty/tools/dotc/core/TypeComparer.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/dotty/tools/dotc/core/TypeComparer.scala') diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala index f468a573f..592f2c5de 100644 --- a/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/src/dotty/tools/dotc/core/TypeComparer.scala @@ -199,7 +199,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling { } compareWild case tp2: LazyRef => - isSubType(tp1, tp2.ref) + !tp2.evaluating && isSubType(tp1, tp2.ref) case tp2: AnnotatedType => isSubType(tp1, tp2.tpe) // todo: refine? case tp2: ThisType => @@ -299,7 +299,10 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling { } compareWild case tp1: LazyRef => - isSubType(tp1.ref, tp2) + // If `tp1` is in train of being evaluated, don't force it + // because that would cause an assertionError. Return false instead. + // See i859.scala for an example where we hit this case. + !tp1.evaluating && isSubType(tp1.ref, tp2) case tp1: AnnotatedType => isSubType(tp1.tpe, tp2) case AndType(tp11, tp12) => -- cgit v1.2.3