diff options
-rw-r--r-- | src/dotty/tools/dotc/core/ConstraintHandling.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Skolemization.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/TypeComparer.scala | 4 | ||||
-rw-r--r-- | tests/pos/caseClassInMethod.scala | 2 | ||||
-rw-r--r-- | tests/pos/refinedSubtyping.scala | 3 |
5 files changed, 7 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/core/ConstraintHandling.scala b/src/dotty/tools/dotc/core/ConstraintHandling.scala index 6371a176b..02f5bf87f 100644 --- a/src/dotty/tools/dotc/core/ConstraintHandling.scala +++ b/src/dotty/tools/dotc/core/ConstraintHandling.scala @@ -35,7 +35,7 @@ trait ConstraintHandling { implicit val ctx: Context - def isSubType(tp1: Type, tp2: Type): Boolean + protected def isSubType(tp1: Type, tp2: Type): Boolean val state: TyperState import state.constraint diff --git a/src/dotty/tools/dotc/core/Skolemization.scala b/src/dotty/tools/dotc/core/Skolemization.scala index 2e517c90e..8bc5c815f 100644 --- a/src/dotty/tools/dotc/core/Skolemization.scala +++ b/src/dotty/tools/dotc/core/Skolemization.scala @@ -7,6 +7,8 @@ import collection.mutable /** Methods to add and remove skolemtypes. * * Skolem types are generated when comparing refinements. + * A skolem type is simply a fresh singleton type that has a given type + * as underlying type. * Two skolem types are equal if they refer to the same underlying type. * To avoid unsoundness, skolem types have to be kept strictly local to the * comparison, they are not allowed to escape the lifetime of a comparison diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala index 1de2d7e98..db6e504d5 100644 --- a/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/src/dotty/tools/dotc/core/TypeComparer.scala @@ -88,7 +88,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling wi assert(isSatisfiable, constraint.show) } - def isSubType(tp1: Type, tp2: Type): Boolean = ctx.traceIndented(s"isSubType ${traceInfo(tp1, tp2)}", subtyping) /*<|<*/ { + protected def isSubType(tp1: Type, tp2: Type): Boolean = ctx.traceIndented(s"isSubType ${traceInfo(tp1, tp2)}", subtyping) /*<|<*/ { if (tp2 eq NoType) false else if (tp1 eq tp2) true else { @@ -179,7 +179,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling wi else (tp1.name eq tp2.name) && isSameType(tp1.prefix, tp2.prefix) && - (tp1.signature == tp1.signature) && + (tp1.signature == tp2.signature) && !tp1.isInstanceOf[WithFixedSym] && !tp2.isInstanceOf[WithFixedSym] ) || diff --git a/tests/pos/caseClassInMethod.scala b/tests/pos/caseClassInMethod.scala index 958e5dd47..2e6484792 100644 --- a/tests/pos/caseClassInMethod.scala +++ b/tests/pos/caseClassInMethod.scala @@ -1,5 +1,5 @@ object t { def f = { object C; case class C(); 1 } - // pending: def g = { case class D(x: Int); object D; 2 } + def g = { case class D(x: Int); object D; 2 } def h = { case class E(y: Int = 10); 3 } } diff --git a/tests/pos/refinedSubtyping.scala b/tests/pos/refinedSubtyping.scala index 329c62314..e6a972e1c 100644 --- a/tests/pos/refinedSubtyping.scala +++ b/tests/pos/refinedSubtyping.scala @@ -60,7 +60,6 @@ class Test3 { y = x } -/* Does not work yet: class Test4 { abstract class A { type T; val xz: Any } @@ -70,4 +69,4 @@ class Test4 { val zz: A { val xz: T } = yy; } -*/ + |