Skip to content

Commit 8c6d1db

Browse files
committed
Add a test case
1 parent 0ee410b commit 8c6d1db

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test-data/unit/check-overloading.test

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6863,3 +6863,20 @@ def foo(x: int) -> None: ...
68636863
def foo(x) -> None: pass
68646864

68656865
foo(reveal_type(['str'])) # N: Revealed type is "builtins.list[Literal['str']]"
6866+
6867+
[case testOverloadUnionArgumentsEvaluated]
6868+
from typing import overload, Optional
6869+
6870+
@overload
6871+
def blah(k: str, o: None = None) -> Optional[str]: ...
6872+
6873+
@overload
6874+
def blah(k: str, o: int) -> str: ...
6875+
6876+
def blah(k, o=None) -> Optional[str]: ...
6877+
6878+
class X:
6879+
m: str
6880+
6881+
x: Optional[X] = None
6882+
blah(x.m) # E: Item "None" of "Optional[X]" has no attribute "m"

0 commit comments

Comments
 (0)