diff options
author | Martin Odersky <odersky@gmail.com> | 2016-02-05 16:56:38 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-02-05 16:56:38 +0100 |
commit | 041d42f58eae860f88d6f1ea54305c1a7dca6c42 (patch) | |
tree | e3acbed013e7ffcba205d573f59dda85096d40ca /src/dotty/tools/dotc/core/TypeComparer.scala | |
parent | 9c38a61d4b3319999a43265ea17f85a1b3ca6886 (diff) | |
download | dotty-041d42f58eae860f88d6f1ea54305c1a7dca6c42.tar.gz dotty-041d42f58eae860f88d6f1ea54305c1a7dca6c42.tar.bz2 dotty-041d42f58eae860f88d6f1ea54305c1a7dca6c42.zip |
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.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeComparer.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/TypeComparer.scala | 7 |
1 files changed, 5 insertions, 2 deletions
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) => |