diff options
author | Martin Odersky <odersky@gmail.com> | 2016-08-18 09:08:34 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-08-18 10:10:01 +0200 |
commit | f4ab855b03e9fc0fac31018bf9383220d2399697 (patch) | |
tree | 1ceae06e1b7b033cde52d8954640cdc66074220a | |
parent | 5a5f9d7ed37ca6449ef61ee5e0f6fbf9731df795 (diff) | |
download | dotty-f4ab855b03e9fc0fac31018bf9383220d2399697.tar.gz dotty-f4ab855b03e9fc0fac31018bf9383220d2399697.tar.bz2 dotty-f4ab855b03e9fc0fac31018bf9383220d2399697.zip |
Fixes in comparisons between singleton types
Needed to address problem shown by z1720.scala.
Another fix to avoidance is needed to make it pass completely.
-rw-r--r-- | src/dotty/tools/dotc/core/TypeComparer.scala | 12 | ||||
-rw-r--r-- | tests/pos/z1720.scala (renamed from tests/pending/pos/z1720.scala) | 0 |
2 files changed, 4 insertions, 8 deletions
diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala index 0757c8187..8d7e9d164 100644 --- a/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/src/dotty/tools/dotc/core/TypeComparer.scala @@ -525,14 +525,10 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling { /** if `tp2 == p.type` and `p: q.type` then try `tp1 <:< q.type` as a last effort.*/ def comparePaths = tp2 match { case tp2: TermRef => - tp2.info match { - case tp2i: TermRef => - isSubType(tp1, tp2i) - case ExprType(tp2i: TermRef) if (ctx.phase.id > ctx.gettersPhase.id) => - // After getters, val x: T becomes def x: T - isSubType(tp1, tp2i) - case _ => - false + tp2.info.widenExpr match { + case tp2i: SingletonType => + isSubType(tp1, tp2i) // see z1720.scala for a case where this can arise even in typer. + case _ => false } case _ => false diff --git a/tests/pending/pos/z1720.scala b/tests/pos/z1720.scala index 7394d428c..7394d428c 100644 --- a/tests/pending/pos/z1720.scala +++ b/tests/pos/z1720.scala |