Skip to content

Commit f4ab855

Browse files
committed
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.
1 parent 5a5f9d7 commit f4ab855

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/dotty/tools/dotc/core/TypeComparer.scala

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -525,14 +525,10 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
525525
/** if `tp2 == p.type` and `p: q.type` then try `tp1 <:< q.type` as a last effort.*/
526526
def comparePaths = tp2 match {
527527
case tp2: TermRef =>
528-
tp2.info match {
529-
case tp2i: TermRef =>
530-
isSubType(tp1, tp2i)
531-
case ExprType(tp2i: TermRef) if (ctx.phase.id > ctx.gettersPhase.id) =>
532-
// After getters, val x: T becomes def x: T
533-
isSubType(tp1, tp2i)
534-
case _ =>
535-
false
528+
tp2.info.widenExpr match {
529+
case tp2i: SingletonType =>
530+
isSubType(tp1, tp2i) // see z1720.scala for a case where this can arise even in typer.
531+
case _ => false
536532
}
537533
case _ =>
538534
false
File renamed without changes.

0 commit comments

Comments
 (0)