Skip to content

Commit

Permalink
The complete fix for my fork and the mymath library.
Browse files Browse the repository at this point in the history
  • Loading branch information
cfcohen committed Jul 17, 2022
1 parent 09d8367 commit eee71ca
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mypy/subtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,16 @@ def _is_subtype(left: Type, right: Type,
return True
elif is_named_instance(left, 'builtins.complex') and sright in number_types[:2]:
return True
elif is_named_instance(left, 'builtins.float') and sright.startswith('mymath'):
if is_named_instance(right, 'mymath.number.OrderedReal'):
return True
elif is_named_instance(left, 'builtins.int') and sright.startswith('mymath'):
if is_named_instance(right, 'mymath.number.OrderedIntegral'):
return True
elif is_named_instance(right, 'mymath.number.OrderedRational'):
return True
elif is_named_instance(right, 'mymath.number.OrderedReal'):
return True
orig_right = right
orig_left = left
left = get_proper_type(left)
Expand Down

0 comments on commit eee71ca

Please sign in to comment.