@@ -1925,7 +1925,6 @@ reveal_type(C().a) # N: Revealed type is "builtins.dict[Any, Any]"
19251925[builtins fixtures/dict.pyi]
19261926
19271927[case testInferAttributeInitializedToNoneAndAssignedClassBody]
1928- # flags: --no-local-partial-types
19291928class C:
19301929 a = None
19311930 def __init__(self) -> None:
@@ -2099,7 +2098,6 @@ x = 1
20992098[out]
21002099
21012100[case testPartiallyInitializedVariableDoesNotEscapeScope2]
2102- # flags: --no-local-partial-types
21032101x = None
21042102def f() -> None:
21052103 x = None
@@ -2127,22 +2125,6 @@ main:6: error: Incompatible types in assignment (expression has type "int", vari
21272125main:7: error: "None" not callable
21282126
21292127[case testGlobalInitializedToNoneSetFromFunction]
2130- # flags: --no-local-partial-types
2131- a = None
2132- def f() -> None:
2133- global a
2134- a = 42
2135- reveal_type(a) # N: Revealed type is "builtins.int"
2136- reveal_type(a) # N: Revealed type is "builtins.int | None"
2137-
2138- b = None
2139- def unchecked():
2140- global b
2141- b = 42
2142- reveal_type(b) # N: Revealed type is "Any | None"
2143-
2144- [case testGlobalInitializedToNoneSetFromFunctionLocalPartialTypes]
2145- # flags: --local-partial-types
21462128a = None
21472129def f() -> None:
21482130 global a
@@ -2157,23 +2139,6 @@ def unchecked():
21572139reveal_type(b) # N: Revealed type is "Any | None"
21582140
21592141[case testGlobalInitializedToNoneSetFromMethod]
2160- # flags: --no-local-partial-types
2161- a = None
2162- class C:
2163- def m(self) -> None:
2164- global a
2165- a = 42
2166- reveal_type(a) # N: Revealed type is "builtins.int | None"
2167-
2168- b = None
2169- class CC:
2170- def unchecked(self):
2171- global b
2172- b = 42
2173- reveal_type(b) # N: Revealed type is "Any | None"
2174-
2175- [case testGlobalInitializedToNoneSetFromMethodLocalPartialTypes]
2176- # flags: --local-partial-types
21772142a = None
21782143class C:
21792144 def m(self) -> None:
@@ -2189,7 +2154,6 @@ class CC:
21892154reveal_type(b) # N: Revealed type is "Any | None"
21902155
21912156[case testPartialTypeErrorSpecialCase1]
2192- # flags: --no-local-partial-types
21932157# This used to crash.
21942158class A:
21952159 x = None
@@ -2208,7 +2172,6 @@ class A:
22082172[builtins fixtures/for.pyi]
22092173
22102174[case testPartialTypeErrorSpecialCase3]
2211- # flags: --no-local-partial-types
22122175class A:
22132176 x = None
22142177 def f(self) -> None:
@@ -2561,7 +2524,6 @@ main:4: error: Unsupported target for indexed assignment ("type[C[T]]")
25612524main:4: error: Invalid type: try using Literal[0] instead?
25622525
25632526[case testNoCrashOnPartialMember]
2564- # flags: --no-local-partial-types
25652527class C:
25662528 x = None
25672529 def __init__(self) -> None:
@@ -2580,7 +2542,6 @@ reveal_type(x) # N: Revealed type is "builtins.str"
25802542[builtins fixtures/tuple.pyi]
25812543
25822544[case testNoCrashOnPartialVariable2]
2583- # flags: --no-local-partial-types
25842545from typing import Tuple, TypeVar
25852546T = TypeVar('T', bound=str)
25862547
@@ -4364,7 +4325,7 @@ def f() -> None:
43644325 global x
43654326 x
43664327
4367- [case testPerFileNoLocalPartialTypesForcesSinglePhase ]
4328+ [case testPerFileNoLocalPartialTypesForcesSinglePhase_no_parallel ]
43684329# mypy: no-local-partial-types
43694330
43704331x = []
@@ -4374,3 +4335,15 @@ def func() -> None:
43744335
43754336reveal_type(x) # N: Revealed type is "builtins.list[builtins.int]"
43764337[builtins fixtures/list.pyi]
4338+
4339+ [case testPerFileNoLocalPartialTypesForcesSinglePhase_parallel_only]
4340+ # mypy: no-local-partial-types
4341+
4342+ x = []
4343+
4344+ def func() -> None:
4345+ x.append(1)
4346+ [builtins fixtures/list.pyi]
4347+ [out]
4348+ main:1: error: --local-partial-types must be enabled in parallel mode
4349+ main:3: error: Need type annotation for "x" (hint: "x: list[<type>] = ...")
0 commit comments