@@ -98,8 +98,12 @@ object Types extends TypeUtils {
98
98
// ----- Tests -----------------------------------------------------
99
99
100
100
// // debug only: a unique identifier for a type
101
- // val uniqId = { nextId = nextId + 1; nextId }
102
- // if uniqId == 19555 then trace.dumpStack()
101
+ // val uniqId = {
102
+ // nextId = nextId + 1
103
+ // if (nextId == 19555)
104
+ // println("foo")
105
+ // nextId
106
+ // }
103
107
104
108
/** A cache indicating whether the type was still provisional, last time we checked */
105
109
@ sharable private var mightBeProvisional = true
@@ -5578,25 +5582,24 @@ object Types extends TypeUtils {
5578
5582
}
5579
5583
5580
5584
def & (that : TypeBounds )(using Context ): TypeBounds =
5581
- val lo1 = this .lo.stripLazyRef
5582
- val lo2 = that.lo.stripLazyRef
5583
- val hi1 = this .hi.stripLazyRef
5584
- val hi2 = that.hi.stripLazyRef
5585
-
5586
5585
// This will try to preserve the FromJavaObjects type in upper bounds.
5587
5586
// For example, (? <: FromJavaObjects | Null) & (? <: Any),
5588
5587
// we want to get (? <: FromJavaObjects | Null) intead of (? <: Any),
5589
5588
// because we may check the result <:< (? <: Object | Null) later.
5590
- if hi1.containsFromJavaObject && (hi1 frozen_<:< hi2) && (lo2 frozen_<:< lo1) then
5589
+ if this .hi.containsFromJavaObject
5590
+ && (this .hi frozen_<:< that.hi)
5591
+ && (that.lo frozen_<:< this .lo) then
5591
5592
// FromJavaObject in tp1.hi guarantees tp2.hi <:< tp1.hi
5592
5593
// prefer tp1 if FromJavaObject is in its hi
5593
5594
this
5594
- else if hi2.containsFromJavaObject && (hi2 frozen_<:< hi1) && (lo1 frozen_<:< lo2) then
5595
+ else if that.hi.containsFromJavaObject
5596
+ && (that.hi frozen_<:< this .hi)
5597
+ && (this .lo frozen_<:< that.lo) then
5595
5598
// Similarly, prefer tp2 if FromJavaObject is in its hi
5596
5599
that
5597
- else if (lo1 frozen_<:< lo2 ) && (hi2 frozen_<:< hi1 ) then that
5598
- else if (lo2 frozen_<:< lo1 ) && (hi1 frozen_<:< hi2 ) then this
5599
- else TypeBounds (lo1 | lo2, hi1 & hi2 )
5600
+ else if (this .lo frozen_<:< that.lo ) && (that.hi frozen_<:< this .hi ) then that
5601
+ else if (that.lo frozen_<:< this .lo ) && (this .hi frozen_<:< that.hi ) then this
5602
+ else TypeBounds (this .lo | that.lo, this .hi & that.hi )
5600
5603
5601
5604
def | (that : TypeBounds )(using Context ): TypeBounds =
5602
5605
if ((this .lo frozen_<:< that.lo) && (that.hi frozen_<:< this .hi)) this
@@ -5605,7 +5608,7 @@ object Types extends TypeUtils {
5605
5608
5606
5609
override def & (that : Type )(using Context ): Type = that match {
5607
5610
case that : TypeBounds => this & that
5608
- case _ => super .& (that)
5611
+ case _ => super .& (that)
5609
5612
}
5610
5613
5611
5614
override def | (that : Type )(using Context ): Type = that match {
0 commit comments