Skip to content

Commit 56602ea

Browse files
authored
Add regression test for ignored diagnostics (#22261)
These would have caught the issue with #20696 by testing code paths where removing diagnostics affects checking Co-authored by Codex
1 parent d8497d2 commit 56602ea

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

‎test-data/unit/check-flags.test‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,48 @@ mod + 0 # E: Unsupported left operand type for + (Module)
572572
x = 0
573573
x += ""
574574

575+
[case testFollowImportsSilentOverloadResolution]
576+
# flags: --follow-imports=silent
577+
from mod import x
578+
reveal_type(x) # N: Revealed type is "builtins.str"
579+
[file mod.py]
580+
from typing import overload
581+
@overload
582+
def f(x: int) -> int: ...
583+
@overload
584+
def f(x: str) -> str: ...
585+
def f(x: int | str) -> int | str:
586+
return x
587+
x = f("")
588+
589+
[case testFollowImportsSilentReverseOperator]
590+
# flags: --follow-imports=silent
591+
from mod import x
592+
reveal_type(x) # N: Revealed type is "builtins.str"
593+
[file mod.py]
594+
class A:
595+
def __add__(self, other: int) -> int: ...
596+
class B:
597+
def __radd__(self, other: A) -> str: ...
598+
x = A() + B()
599+
600+
[case testFollowImportsSilentTypedDictUnion]
601+
# flags: --follow-imports=silent
602+
from mod import x
603+
reveal_type(x) # N: Revealed type is "builtins.str"
604+
[file mod.py]
605+
from typing_extensions import TypedDict
606+
class A(TypedDict):
607+
value: int
608+
class B(TypedDict):
609+
value: str
610+
data: A | B
611+
data = {"value": ""}
612+
x = data["value"]
613+
[file typing_extensions.pyi]
614+
TypedDict = 0
615+
class _TypedDict: pass
616+
575617
[case testFollowImportsSilentTypeIgnore]
576618
# flags: --warn-unused-ignores --follow-imports=silent
577619
import mod

0 commit comments

Comments
 (0)