File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4409,6 +4409,7 @@ def check_lvalue(
44094409 and isinstance (lvalue .node , Var )
44104410 and lvalue .node .is_inferred
44114411 and lvalue .node .type is not None
4412+ and not isinstance (lvalue .node .type , PartialType )
44124413 # Indexes in for loops require special handling, we need to reset them to
44134414 # a literal value on each loop, but binder doesn't work well with literals.
44144415 and not lvalue .node .is_index_var
Original file line number Diff line number Diff line change @@ -1141,6 +1141,23 @@ def f() -> None:
11411141 reveal_type(x) # N: Revealed type is "Any"
11421142[builtins fixtures/tuple.pyi]
11431143
1144+ [case testNewRedefinitionPartialTypeInLoopDeferred]
1145+ # flags: --allow-redefinition-new --local-partial-types
1146+
1147+ def f(self) -> None:
1148+ x = []
1149+ for i in [1, 2, 3]:
1150+ C().x
1151+ x.append(1)
1152+ reveal_type(x) # N: Revealed type is "builtins.list[builtins.int]"
1153+
1154+ class C:
1155+ def __init__(self) -> None:
1156+ self.x = defer()
1157+
1158+ def defer() -> int: ...
1159+ [builtins fixtures/list.pyi]
1160+
11441161[case testNewRedefinePartialTypeForUnderscore]
11451162# flags: --allow-redefinition-new --local-partial-types
11461163
You can’t perform that action at this time.
0 commit comments