File tree 2 files changed +10
-1
lines changed
compiler/src/dotty/tools/dotc/core
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -1955,9 +1955,11 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
1955
1955
isSubInfo(info1, tp2.refinedInfo.widenExpr, m.symbol.info.orElse(info1))
1956
1956
|| matchAbstractTypeMember(m.info)
1957
1957
1958
- tp1.member(name) match // inlined hasAltWith for performance
1958
+ def memberQualifies = tp1.member(name) match // inlined hasAltWith for performance
1959
1959
case mbr : SingleDenotation => qualifies(mbr)
1960
1960
case mbr => mbr hasAltWith qualifies
1961
+
1962
+ memberQualifies || (tp1.isStable && isSub(TermRef (tp1, name), tp2.refinedInfo))
1961
1963
}
1962
1964
1963
1965
final def ensureStableSingleton (tp : Type ): SingletonType = tp.stripTypeVar match {
Original file line number Diff line number Diff line change
1
+ class A :
2
+ val x : AnyRef = Object ()
3
+
4
+ @ main def m : Unit =
5
+ val a = new A
6
+ val b : a.x.type = a.x
7
+ val c : A { val x : a.x.type } = a
You can’t perform that action at this time.
0 commit comments