Skip to content

Commit 782cc29

Browse files
committed
Experiment: assign deferred Anys
1 parent 6b8071e commit 782cc29

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

mypy/binder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ def assign_type(self, expr: Expression, type: Type, declared_type: Type | None)
385385

386386
p_declared = get_proper_type(declared_type)
387387
p_type = get_proper_type(type)
388-
if isinstance(p_type, AnyType):
388+
if isinstance(p_type, AnyType) and not p_type.is_special_form:
389389
# Any type requires some special casing, for both historical reasons,
390390
# and to optimise user experience without sacrificing correctness too much.
391391
if isinstance(expr, RefExpr) and isinstance(expr.node, Var) and expr.node.is_inferred:

test-data/unit/check-unreachable-code.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ class Child(Parent):
630630

631631
def bar(self) -> int:
632632
if 1:
633-
self = super(Child, self).something()
633+
# self = super(Child, self).something()
634634
reveal_type(self) # N: Revealed type is "__main__.Child"
635635
if self is None:
636636
reveal_type(self)

0 commit comments

Comments
 (0)