diff options
author | Martin Odersky <odersky@gmail.com> | 2015-01-28 19:01:09 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-01-28 19:03:55 +0100 |
commit | 70e55d26100199b99502705233786bbdc15c4c6b (patch) | |
tree | 97fbfa865286a60ad90230b868179c3e61143eec /src/dotty/tools | |
parent | 37918e5d1eb53014b1116ea65381a56e93a3c855 (diff) | |
download | dotty-70e55d26100199b99502705233786bbdc15c4c6b.tar.gz dotty-70e55d26100199b99502705233786bbdc15c4c6b.tar.bz2 dotty-70e55d26100199b99502705233786bbdc15c4c6b.zip |
Fixed problem with ensureSingleton
Need to also ensure that the singleton is stable. This makes
compound.scala pass.
Diffstat (limited to 'src/dotty/tools')
-rw-r--r-- | src/dotty/tools/dotc/core/Skolemization.scala | 6 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/TypeComparer.scala | 2 |
2 files changed, 4 insertions, 4 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 |