aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TypeComparer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-08-24 12:37:50 +0200
committerMartin Odersky <odersky@gmail.com>2016-08-26 11:13:17 +0200
commiteb529b556f92a5ab0329899762b43eea7103ad59 (patch)
treeeacf21670fe6bc75fa4f9c3696da8f2d64965982 /src/dotty/tools/dotc/core/TypeComparer.scala
parentf8970818e3d285b7827a035bffb26c1a4b97319e (diff)
downloaddotty-eb529b556f92a5ab0329899762b43eea7103ad59.tar.gz
dotty-eb529b556f92a5ab0329899762b43eea7103ad59.tar.bz2
dotty-eb529b556f92a5ab0329899762b43eea7103ad59.zip
Generalize self-referential member comparisons.
The special case in hasMatchingMember dealing with self-refential members has to be generalized to deal lower and upper bounds. Test case is t762.scala
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeComparer.scala')
-rw-r--r--src/dotty/tools/dotc/core/TypeComparer.scala8
1 files changed, 5 insertions, 3 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
}
}