File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed
Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -636,3 +636,11 @@ def _(arg: str) -> str: # E: Name "_" already defined (possibly by an import)
636636[file a.py]
637637def f(s: str) -> str:
638638 return s
639+
640+ [case testRedefineListComprehension]
641+ # flags: --allow-redefinition
642+ def process(items: list[str]) -> None:
643+ reveal_type(items) # N: Revealed type is "builtins.list[builtins.str]"
644+ items = [item.split() for item in items]
645+ reveal_type(items) # N: Revealed type is "builtins.list[builtins.list[builtins.str]]"
646+ [builtins fixtures/primitives.pyi]
Original file line number Diff line number Diff line change @@ -1197,3 +1197,11 @@ x = 0
11971197if int():
11981198 x = ""
11991199reveal_type(x) # N: Revealed type is "builtins.int | builtins.str"
1200+
1201+ [case testNewRedefineListComprehension]
1202+ # flags: --allow-redefinition-new --local-partial-types
1203+ def process(items: list[str]) -> None:
1204+ reveal_type(items) # N: Revealed type is "builtins.list[builtins.str]"
1205+ items = [item.split() for item in items]
1206+ reveal_type(items) # N: Revealed type is "builtins.list[builtins.list[builtins.str]]"
1207+ [builtins fixtures/primitives.pyi]
Original file line number Diff line number Diff line change @@ -35,6 +35,8 @@ class str(Sequence[str]):
3535 def __contains__ (self , other : object ) -> bool : pass
3636 def __getitem__ (self , item : int ) -> str : pass
3737 def format (self , * args : object , ** kwargs : object ) -> str : pass
38+ # Note: this is a simplification of the actual signature
39+ def split (self , sep : str | None = None ) -> list [str ]: pass
3840class bytes (Sequence [int ]):
3941 def __iter__ (self ) -> Iterator [int ]: pass
4042 def __contains__ (self , other : object ) -> bool : pass
You can’t perform that action at this time.
0 commit comments