Skip to content

Commit e814c47

Browse files
authored
Fix incremental crash on generic function appearing in nested position (#14148)
Fixes #14137 Fix is trivial, I just forgot to call `super()` in one of my previous PRs.
1 parent 56e9396 commit e814c47

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

mypy/checkmember.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,7 @@ class FreezeTypeVarsVisitor(TypeTraverserVisitor):
806806
def visit_callable_type(self, t: CallableType) -> None:
807807
for v in t.variables:
808808
v.id.meta_level = 0
809+
super().visit_callable_type(t)
809810

810811

811812
def lookup_member_var_or_accessor(info: TypeInfo, name: str, is_lvalue: bool) -> SymbolNode | None:

test-data/unit/check-incremental.test

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6334,3 +6334,17 @@ reveal_type(D().meth)
63346334
[out2]
63356335
tmp/m.py:4: note: Revealed type is "def [Self <: lib.C] (self: Self`0, other: Self`0) -> Self`0"
63366336
tmp/m.py:5: note: Revealed type is "def (other: m.D) -> m.D"
6337+
6338+
[case testIncrementalNestedGenericCallableCrash]
6339+
from typing import TypeVar, Callable
6340+
6341+
T = TypeVar("T")
6342+
6343+
class B:
6344+
def foo(self) -> Callable[[T], T]: ...
6345+
6346+
class C(B):
6347+
def __init__(self) -> None:
6348+
self.x = self.foo()
6349+
[out]
6350+
[out2]

0 commit comments

Comments
 (0)