@@ -1728,12 +1728,14 @@ b[{}] = 1
17281728[builtins fixtures/dict.pyi]
17291729
17301730[case testInferDictInitializedToEmptyAndUpdatedFromMethod]
1731+ # flags: --no-local-partial-types
17311732map = {}
17321733def add() -> None:
17331734 map[1] = 2
17341735[builtins fixtures/dict.pyi]
17351736
17361737[case testInferDictInitializedToEmptyAndUpdatedFromMethodUnannotated]
1738+ # flags: --no-local-partial-types
17371739map = {}
17381740def add():
17391741 map[1] = 2
@@ -1921,6 +1923,7 @@ reveal_type(C().a) # N: Revealed type is "builtins.dict[Any, Any]"
19211923[builtins fixtures/dict.pyi]
19221924
19231925[case testInferAttributeInitializedToNoneAndAssignedClassBody]
1926+ # flags: --no-local-partial-types
19241927class C:
19251928 a = None
19261929 def __init__(self) -> None:
@@ -2069,6 +2072,7 @@ x = 1
20692072[out]
20702073
20712074[case testPartiallyInitializedVariableDoesNotEscapeScope2]
2075+ # flags: --no-local-partial-types
20722076x = None
20732077def f() -> None:
20742078 x = None
@@ -2114,36 +2118,32 @@ class C:
21142118-- ------------------------
21152119
21162120[case testPartialTypeErrorSpecialCase1]
2121+ # flags: --no-local-partial-types
21172122# This used to crash.
21182123class A:
21192124 x = None
21202125 def f(self) -> None:
2121- for a in self.x:
2126+ for a in self.x: # E: "None" has no attribute "__iter__" (not iterable)
21222127 pass
21232128[builtins fixtures/for.pyi]
2124- [out]
2125- main:5: error: "None" has no attribute "__iter__" (not iterable)
21262129
21272130[case testPartialTypeErrorSpecialCase2]
21282131# This used to crash.
21292132class A:
2130- x = []
2133+ x = [] # E: Need type annotation for "x" (hint: "x: List[<type>] = ...")
21312134 def f(self) -> None:
21322135 for a in self.x:
21332136 pass
21342137[builtins fixtures/for.pyi]
2135- [out]
2136- main:3: error: Need type annotation for "x" (hint: "x: List[<type>] = ...")
21372138
21382139[case testPartialTypeErrorSpecialCase3]
2140+ # flags: --no-local-partial-types
21392141class A:
21402142 x = None
21412143 def f(self) -> None:
2142- for a in A.x:
2144+ for a in A.x: # E: "None" has no attribute "__iter__" (not iterable)
21432145 pass
21442146[builtins fixtures/for.pyi]
2145- [out]
2146- main:4: error: "None" has no attribute "__iter__" (not iterable)
21472147
21482148[case testPartialTypeErrorSpecialCase4]
21492149# This used to crash.
@@ -2492,6 +2492,7 @@ main:4: error: Unsupported target for indexed assignment ("Type[C[T]]")
24922492main:4: error: Invalid type: try using Literal[0] instead?
24932493
24942494[case testNoCrashOnPartialMember]
2495+ # flags: --no-local-partial-types
24952496class C:
24962497 x = None
24972498 def __init__(self) -> None:
@@ -2512,6 +2513,7 @@ reveal_type(x) # N: Revealed type is "builtins.str"
25122513[out]
25132514
25142515[case testNoCrashOnPartialVariable2]
2516+ # flags: --no-local-partial-types
25152517from typing import Tuple, TypeVar
25162518T = TypeVar('T', bound=str)
25172519
0 commit comments