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(
80248024 isinstance (proposed_type , CallableType )
80258025 or (isinstance (proposed_type , Instance ) and proposed_type .type .is_protocol )
80268026 ) 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
80288036 elif not is_overlapping_types (current_type , proposed_type , ignore_promotions = True ):
80298037 # Expression is never of any type in proposed_type_ranges
80308038 return UninhabitedType (), default
You can’t perform that action at this time.
0 commit comments