diff options
-rw-r--r-- | src/dotty/tools/dotc/core/Skolemization.scala | 6 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/TypeComparer.scala | 2 | ||||
-rw-r--r-- | tests/pos/compound.scala (renamed from tests/pending/pos/compound.scala) | 4 |
3 files changed, 5 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/core/Skolemization.scala b/src/dotty/tools/dotc/core/Skolemization.scala index 8bc5c815f..2832a3bad 100644 --- a/src/dotty/tools/dotc/core/Skolemization.scala +++ b/src/dotty/tools/dotc/core/Skolemization.scala @@ -20,14 +20,14 @@ trait Skolemization { protected var skolemsOutstanding = false - def ensureSingleton(tp: Type): SingletonType = tp.stripTypeVar match { - case tp: SingletonType => + def ensureStableSingleton(tp: Type): SingletonType = tp.stripTypeVar match { + case tp: SingletonType if tp.isStable => tp case tp: ValueType => skolemsOutstanding = true SkolemType(tp) case tp: TypeProxy => - ensureSingleton(tp.underlying) + ensureStableSingleton(tp.underlying) } /** Approximate a type `tp` with a type that does not contain skolem types. diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala index 1d0ea03c1..9826a23ea 100644 --- a/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/src/dotty/tools/dotc/core/TypeComparer.scala @@ -517,7 +517,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling wi val saved = skolemsOutstanding try { val rebindNeeded = tp2.refinementRefersToThis - val base = if (rebindNeeded) ensureSingleton(tp1) else tp1 + val base = if (rebindNeeded) ensureStableSingleton(tp1) else tp1 val rinfo2 = if (rebindNeeded) tp2.refinedInfo.substSkolem(tp2, base) else tp2.refinedInfo def qualifies(m: SingleDenotation) = isSubType(m.info, rinfo2) def memberMatches(mbr: Denotation): Boolean = mbr match { // inlined hasAltWith for performance diff --git a/tests/pending/pos/compound.scala b/tests/pos/compound.scala index 16dbf9a08..24a936f13 100644 --- a/tests/pending/pos/compound.scala +++ b/tests/pos/compound.scala @@ -1,5 +1,3 @@ -// There's still a problem with var's here, presumably because they are not paths. -// Needs some more investigation. abstract class A { type T } abstract class B { val xz: Any } @@ -11,6 +9,6 @@ abstract class Test { } abstract class Test2 { - val yy: A with B { type T; val xz: T } = null; + var yy: A with B { type T; val xz: T } = null; val xx: A with B { type T; val xz: T } = yy } |