File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -8024,7 +8024,15 @@ def conditional_types(
8024
8024
isinstance (proposed_type , CallableType )
8025
8025
or (isinstance (proposed_type , Instance ) and proposed_type .type .is_protocol )
8026
8026
) and is_subtype (current_type , proposed_type , ignore_promotions = True ):
8027
- return default , UninhabitedType ()
8027
+ yes_type = default
8028
+ no_type = (
8029
+ None
8030
+ if yes_type is None
8031
+ else restrict_subtype_away (
8032
+ current_type , yes_type , consider_runtime_isinstance = consider_runtime_isinstance
8033
+ )
8034
+ )
8035
+ return yes_type , no_type
8028
8036
elif not is_overlapping_types (current_type , proposed_type , ignore_promotions = True ):
8029
8037
# Expression is never of any type in proposed_type_ranges
8030
8038
return UninhabitedType (), default
You can’t perform that action at this time.
0 commit comments