aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/core/TypeComparer.scala8
-rw-r--r--tests/pending/pos/t762.scala2
-rw-r--r--tests/pos/t762.scala4
3 files changed, 9 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala
index e9300c0ba..538a74198 100644
--- a/src/dotty/tools/dotc/core/TypeComparer.scala
+++ b/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -861,11 +861,13 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
// special case for situations like:
// class C { type T }
// val foo: C
- // foo.type <: C { type T = foo.T }
+ // foo.type <: C { type T {= , <: , >:} foo.T }
def selfReferentialMatch = tp1.isInstanceOf[SingletonType] && {
rinfo2 match {
- case rinfo2: TypeAlias =>
- !defn.isBottomType(tp1.widen) && (tp1 select name) =:= rinfo2.alias
+ case rinfo2: TypeBounds =>
+ val mbr1 = tp1.select(name)
+ !defn.isBottomType(tp1.widen) &&
+ (mbr1 =:= rinfo2.hi || (rinfo2.hi ne rinfo2.lo) && mbr1 =:= rinfo2.lo)
case _ => false
}
}
diff --git a/tests/pending/pos/t762.scala b/tests/pending/pos/t762.scala
deleted file mode 100644
index 76860272e..000000000
--- a/tests/pending/pos/t762.scala
+++ /dev/null
@@ -1,2 +0,0 @@
-trait Foo { type T }
-trait Bar extends Foo { val x : Foo { type T <: Bar.this.T } = this : this.type }
diff --git a/tests/pos/t762.scala b/tests/pos/t762.scala
new file mode 100644
index 000000000..c5bf39b0c
--- /dev/null
+++ b/tests/pos/t762.scala
@@ -0,0 +1,4 @@
+trait Foo { type T }
+trait Bar1 extends Foo { val x : Foo { type T <: Bar1.this.T } = this }
+trait Bar2 extends Foo { val x : Foo { type T = Bar2.this.T } = this }
+trait Bar3 extends Foo { val x : Foo { type T >: Bar3.this.T } = this }