File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -328,6 +328,8 @@ def _infer_constraints(
328
328
template = mypy .typeops .make_simplified_union (template .items , keep_erased = True )
329
329
if isinstance (actual , UnionType ):
330
330
actual = mypy .typeops .make_simplified_union (actual .items , keep_erased = True )
331
+ if isinstance (actual , TypeVarType ) and actual .has_default ():
332
+ actual = get_proper_type (actual .default )
331
333
332
334
# Ignore Any types from the type suggestion engine to avoid them
333
335
# causing us to infer Any in situations where a better job could
Original file line number Diff line number Diff line change @@ -303,6 +303,9 @@ def _is_subtype(
303
303
# ErasedType as we do for non-proper subtyping.
304
304
return True
305
305
306
+ if not proper_subtype and isinstance (right , TypeVarType ) and right .has_default ():
307
+ return left .accept (SubtypeVisitor (right .default , subtype_context , proper_subtype ))
308
+
306
309
if isinstance (right , UnionType ) and not isinstance (left , UnionType ):
307
310
# Normally, when 'left' is not itself a union, the only way
308
311
# 'left' can be a subtype of the union 'right' is if it is a
You can’t perform that action at this time.
0 commit comments