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
Relax union math logic to allow signatures with different arg kinds (#5222)
Resolves#5204.
This commit relaxes the union math logic so that it allows signatures
with arg kinds that are nearly identical except that one arg is
positional and the other is optional.
This commit also removes the "names must be the same" restriction mostly
so that the original example given in #4576
will pass. (In retrospect, I think this check didn't really buy us much
-- even if the alternatives share the same arg names, there's no
guarantee the actual implementation signature will also share the same.)
Copy file name to clipboardExpand all lines: test-data/unit/check-overloading.test
+48-12Lines changed: 48 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -2382,7 +2382,7 @@ reveal_type(foo(compat)) # E: Revealed type is 'Union[builtins.int, builtins.st
2382
2382
not_compat: Union[WrapperCo[A], WrapperContra[C]]
2383
2383
foo(not_compat) # E: Argument 1 to "foo" has incompatible type "Union[WrapperCo[A], WrapperContra[C]]"; expected "Union[WrapperCo[B], WrapperContra[B]]"
0 commit comments