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
=> I'm working on a fix already and plan to open a PR soon.
To Reproduce
fromtypingimportoverloadclassA: ...
classB: ...
classC: ...
classD: ...
@overloaddeff1(g: A) ->A: ...
ifTrue:
@overloaddeff1(g: B) ->B: ...
ifTrue:
@overloaddeff1(g: C) ->C: ...
@overloaddeff1(g: D) ->D: ...
deff1(g): ...
Expected Behavior
Overloads should merge just fine.
reveal_type(f1(A())) # N: Revealed type is "__main__.A"reveal_type(f1(B())) # N: Revealed type is "__main__.B"reveal_type(f1(C())) # N: Revealed type is "__main__.C"reveal_type(f1(D())) # N: Revealed type is "__main__.D"
Actual Behavior
test.py:8: error: Single overload definition, multiple required
test.py:11: error: Name "f1" already defined on line 8
test.py:11: error: An overloaded function outside a stub file must have an implementation
test.py:18: error: Name "f1" already defined on line 8
Your Environment
Mypy version used: mypy 0.960+dev.44993e6a18f852a9296786267ecf26ea730b4f31
Bug Report
Mypy can't merge nested overloads. Those can happen if all are wrapped with
if TYPE_CHECKING
and combined with a nested conditional overload.https://mypy.readthedocs.io/en/stable/more_types.html#conditional-overloads
=> I'm working on a fix already and plan to open a PR soon.
To Reproduce
Expected Behavior
Overloads should merge just fine.
Actual Behavior
Your Environment
mypy test2.py --always-true True --always-false False
The text was updated successfully, but these errors were encountered: