You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The old code always generated a conjunction, where we sometimes want a
disjunction. Since we can't represent or solve a disjunction of
constraints, need to approximate.
In the presence of Unions, the constraints inferred from (template,
actual, direction) are not necessarily the reverses of the constraints
inferred from (template, actual, neg_op(direction)). The
visit_instance and visit_callable cases were updated accordingly. Test
testGenericFunctionSubtypingWithUnions fails without this change.
Fixespython#1458 and the remaining part of python#1241.
rwbarton
added a commit
to rwbarton/mypy
that referenced
this issue
May 3, 2016
The old code always generated a conjunction, where we sometimes want a
disjunction. Since we can't represent or solve a disjunction of
constraints, need to approximate.
In the presence of Unions, the constraints inferred from (template,
actual, direction) are not necessarily the reverses of the constraints
inferred from (template, actual, neg_op(direction)). The
visit_instance and visit_callable cases were updated accordingly. Test
testGenericFunctionSubtypingWithUnions fails without this change.
Fixespython#1458 and the remaining part of python#1241.
This fails:
with error message:
This also fails with a similar error message:
This works however:
I was expecting empty dict to work with
Union
, since the following 2 statements work:d = {} # type: Dict[str, int]
d = 3 # type: Union[int, str]
The text was updated successfully, but these errors were encountered: