File tree 1 file changed +10
-5
lines changed
compiler/src/dotty/tools/dotc/core
1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -2508,15 +2508,20 @@ object Types {
2508
2508
private def infoDependsOnPrefix (symd : SymDenotation , prefix : Type )(using Context ): Boolean =
2509
2509
2510
2510
def refines (tp : Type , name : Name ): Boolean = tp match
2511
- case AndType (tp1, tp2) =>
2512
- refines(tp1, name) || refines(tp2, name)
2511
+ case tp : TypeRef =>
2512
+ tp.symbol match
2513
+ case cls : ClassSymbol =>
2514
+ val otherd = cls.nonPrivateMembersNamed(name)
2515
+ otherd.exists && ! otherd.containsSym(symd.symbol)
2516
+ case tsym =>
2517
+ refines(tsym.info.hiBound, name)
2518
+ // avoid going through tp.denot, since that might call infoDependsOnPrefix again
2513
2519
case RefinedType (parent, rname, _) =>
2514
2520
rname == name || refines(parent, name)
2515
- case tp : ClassInfo =>
2516
- val otherd = tp.cls.nonPrivateMembersNamed(name)
2517
- otherd.exists && ! otherd.containsSym(symd.symbol)
2518
2521
case tp : TypeProxy =>
2519
2522
refines(tp.underlying, name)
2523
+ case AndType (tp1, tp2) =>
2524
+ refines(tp1, name) || refines(tp2, name)
2520
2525
case _ =>
2521
2526
false
2522
2527
You can’t perform that action at this time.
0 commit comments