@@ -459,7 +459,7 @@ object Types {
459
459
val jointInfo =
460
460
if (rinfo.isAlias) rinfo
461
461
else if (pdenot.info.isAlias) pdenot.info
462
- else if (ctx.pendingMemberSearches.contains(name)) safeAnd( pdenot.info, rinfo)
462
+ else if (ctx.pendingMemberSearches.contains(name)) pdenot.info safe_& rinfo
463
463
else
464
464
try pdenot.info & rinfo
465
465
catch {
@@ -470,11 +470,14 @@ object Types {
470
470
// the special shortcut for Any in derivesFrom was as yet absent. To reproduce,
471
471
// remove the special treatment of Any in derivesFrom and compile
472
472
// sets.scala.
473
- safeAnd( pdenot.info, rinfo)
473
+ pdenot.info safe_& rinfo
474
474
}
475
475
pdenot.asSingleDenotation.derivedSingleDenotation(pdenot.symbol, jointInfo)
476
- } else
477
- pdenot & (new JointRefDenotation (NoSymbol , rinfo, Period .allInRun(ctx.runId)), pre)
476
+ } else {
477
+ val safeIntersection = ctx.pendingMemberSearches.contains(name)
478
+ pdenot & (new JointRefDenotation (NoSymbol , rinfo, Period .allInRun(ctx.runId)),
479
+ pre, safeIntersection)
480
+ }
478
481
}
479
482
def goThis (tp : ThisType ) = {
480
483
val d = go(tp.underlying)
@@ -501,12 +504,11 @@ object Types {
501
504
go(next)
502
505
}
503
506
}
504
- def goAnd (l : Type , r : Type ) = go(l) & (go(r), pre)
505
- def goOr (l : Type , r : Type ) = go(l) | (go(r), pre)
506
- def safeAnd (tp1 : Type , tp2 : Type ): Type = (tp1, tp2) match {
507
- case (TypeBounds (lo1, hi1), TypeBounds (lo2, hi2)) => TypeBounds (lo1 | lo2, AndType (hi1, hi2))
508
- case _ => tp1 & tp2
507
+ def goAnd (l : Type , r : Type ) = {
508
+ val safeIntersection = ctx.pendingMemberSearches.contains(name)
509
+ go(l) & (go(r), pre, safeIntersection)
509
510
}
511
+ def goOr (l : Type , r : Type ) = go(l) | (go(r), pre)
510
512
511
513
{ val recCount = ctx.findMemberCount + 1
512
514
ctx.findMemberCount = recCount
@@ -705,6 +707,11 @@ object Types {
705
707
ctx.typeComparer.glb(this , that)
706
708
}
707
709
710
+ def safe_& (that : Type )(implicit ctx : Context ): Type = (this , that) match {
711
+ case (TypeBounds (lo1, hi1), TypeBounds (lo2, hi2)) => TypeBounds (lo1 | lo2, AndType (hi1, hi2))
712
+ case _ => this & that
713
+ }
714
+
708
715
def | (that : Type )(implicit ctx : Context ): Type = track(" |" ) {
709
716
ctx.typeComparer.lub(this , that)
710
717
}
0 commit comments