File tree Expand file tree Collapse file tree 5 files changed +30
-5
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 5 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -311,8 +311,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
311311 thirdTryNamed(tp2)
312312 else
313313 ( (tp1.name eq tp2.name)
314- && tp1.isMemberRef
315- && tp2.isMemberRef
314+ && tp2.isPrefixDependentMemberRef
316315 && isSubPrefix(tp1.prefix, tp2.prefix)
317316 && tp1.signature == tp2.signature
318317 && ! (sym1.isClass && sym2.isClass) // class types don't subtype each other
Original file line number Diff line number Diff line change @@ -2504,8 +2504,10 @@ object Types {
25042504 symd.maybeOwner.membersNeedAsSeenFrom(prefix) && ! symd.is(NonMember )
25052505 || prefix.isInstanceOf [Types .ThisType ] && symd.is(Opaque ) // see pos/i11277.scala for a test where this matters
25062506
2507- /** Is this a reference to a class or object member? */
2508- def isMemberRef (using Context ): Boolean = designator match {
2507+ /** Is this a reference to a class or object member with an info that might depend
2508+ * on the prefix?
2509+ */
2510+ def isPrefixDependentMemberRef (using Context ): Boolean = designator match {
25092511 case sym : Symbol => infoDependsOnPrefix(sym, prefix)
25102512 case _ => true
25112513 }
Original file line number Diff line number Diff line change @@ -385,7 +385,7 @@ class TreeChecker extends Phase with SymTransformer {
385385
386386 val sym = tree.symbol
387387 val symIsFixed = tpe match {
388- case tpe : TermRef => ctx.erasedTypes || ! tpe.isMemberRef
388+ case tpe : TermRef => ctx.erasedTypes || ! tpe.isPrefixDependentMemberRef
389389 case _ => false
390390 }
391391 if (sym.exists && ! sym.is(Private ) &&
Original file line number Diff line number Diff line change 1+ sealed trait TP :
2+ type C
3+ type P
4+
5+ final class Foo extends TP :
6+ class C
7+ enum P :
8+ case A , B
9+
10+ object Bar extends TP :
11+ class C
12+ enum P :
13+ case A , B , C
14+
15+ // Works
16+ def test =
17+ summon[Foo # P <:< TP # P ]
18+ val a : TP # P = Foo ().P .A
19+
20+ // These fail
21+ val b : TP # P = Bar .P .A : Bar .P
22+ summon[Bar .type # P <:< TP # P ]
23+ summon[Bar .P <:< TP # P ]
24+ val c : TP # C = ??? : Bar .C
File renamed without changes.
You can’t perform that action at this time.
0 commit comments