@@ -3309,19 +3309,14 @@ impl<'db> Type<'db> {
3309
3309
let name_str = name. as_str ( ) ;
3310
3310
3311
3311
match self {
3312
- Type :: Union ( union) => union
3313
- . map_with_boundness ( db, |elem| {
3314
- elem. member_lookup_with_policy ( db, name_str. into ( ) , policy)
3315
- . place
3316
- } )
3317
- . into ( ) ,
3312
+ Type :: Union ( union) => union. map_with_boundness_and_qualifiers ( db, |elem| {
3313
+ elem. member_lookup_with_policy ( db, name_str. into ( ) , policy)
3314
+ } ) ,
3318
3315
3319
3316
Type :: Intersection ( intersection) => intersection
3320
- . map_with_boundness ( db, |elem| {
3317
+ . map_with_boundness_and_qualifiers ( db, |elem| {
3321
3318
elem. member_lookup_with_policy ( db, name_str. into ( ) , policy)
3322
- . place
3323
- } )
3324
- . into ( ) ,
3319
+ } ) ,
3325
3320
3326
3321
Type :: Dynamic ( ..) | Type :: Never => Place :: bound ( self ) . into ( ) ,
3327
3322
@@ -9743,21 +9738,20 @@ impl<'db> IntersectionType<'db> {
9743
9738
let mut builder = IntersectionBuilder :: new ( db) ;
9744
9739
let mut qualifiers = TypeQualifiers :: empty ( ) ;
9745
9740
9746
- let mut any_unbound = false ;
9747
- let mut any_possibly_unbound = false ;
9741
+ let mut all_unbound = true ;
9742
+ let mut any_definitely_bound = false ;
9748
9743
for ty in self . positive_elements_or_object ( db) {
9749
9744
let PlaceAndQualifiers {
9750
9745
place : member,
9751
9746
qualifiers : new_qualifiers,
9752
9747
} = transform_fn ( & ty) ;
9753
9748
qualifiers |= new_qualifiers;
9754
9749
match member {
9755
- Place :: Unbound => {
9756
- any_unbound = true ;
9757
- }
9750
+ Place :: Unbound => { }
9758
9751
Place :: Type ( ty_member, member_boundness) => {
9759
- if member_boundness == Boundness :: PossiblyUnbound {
9760
- any_possibly_unbound = true ;
9752
+ all_unbound = false ;
9753
+ if member_boundness == Boundness :: Bound {
9754
+ any_definitely_bound = true ;
9761
9755
}
9762
9756
9763
9757
builder = builder. add_positive ( ty_member) ;
@@ -9766,15 +9760,15 @@ impl<'db> IntersectionType<'db> {
9766
9760
}
9767
9761
9768
9762
PlaceAndQualifiers {
9769
- place : if any_unbound {
9763
+ place : if all_unbound {
9770
9764
Place :: Unbound
9771
9765
} else {
9772
9766
Place :: Type (
9773
9767
builder. build ( ) ,
9774
- if any_possibly_unbound {
9775
- Boundness :: PossiblyUnbound
9776
- } else {
9768
+ if any_definitely_bound {
9777
9769
Boundness :: Bound
9770
+ } else {
9771
+ Boundness :: PossiblyUnbound
9778
9772
} ,
9779
9773
)
9780
9774
} ,
0 commit comments