aboutsummaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-11-30 15:48:21 +0100
committerMartin Odersky <odersky@gmail.com>2016-11-30 15:48:27 +0100
commiteab74a33579636f385d4687e30e811f262d13a0e (patch)
tree17c409b2f67a6a9924d10367ca723716dbe2225a /compiler
parent3f7614ae60263c937f7b2d97f45ef6e7c803ec01 (diff)
downloaddotty-eab74a33579636f385d4687e30e811f262d13a0e.tar.gz
dotty-eab74a33579636f385d4687e30e811f262d13a0e.tar.bz2
dotty-eab74a33579636f385d4687e30e811f262d13a0e.zip
Fix $1753 Better comparison of path types
In this case, a path went through a type parameter which was aliased to a singleton type. Need to dealias to get to the special case handling two paths.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/src/dotty/tools/dotc/core/TypeComparer.scala6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala
index f78820fff..fd954c688 100644
--- a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala
+++ b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -541,9 +541,11 @@ 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.widenExpr match {
+ tp2.info.widenExpr.dealias match {
case tp2i: SingletonType =>
- isSubType(tp1, tp2i) // see z1720.scala for a case where this can arise even in typer.
+ isSubType(tp1, tp2i)
+ // see z1720.scala for a case where this can arise even in typer.
+ // Also, i1753.scala, to show why the dealias above is necessary.
case _ => false
}
case _ =>