Skip to content

Commit 0089ec7

Browse files
committed
fix inference
1 parent dd470e0 commit 0089ec7

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

mypy/constraints.py

+2
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ def visit_type_var(self, template: TypeVarType) -> List[Constraint]:
248248
def visit_instance(self, template: Instance) -> List[Constraint]:
249249
actual = self.actual
250250
res = [] # type: List[Constraint]
251+
if isinstance(actual, CallableType) and actual.fallback is not None:
252+
actual = actual.fallback
251253
if isinstance(actual, Instance):
252254
instance = actual
253255
if (self.direction == SUBTYPE_OF and

test-data/unit/check-classes.test

+4
Original file line numberDiff line numberDiff line change
@@ -2457,3 +2457,7 @@ class GoodMeta(type, Iterable[int]):
24572457

24582458
class Good(metaclass=GoodMeta): pass
24592459
for _ in Good: pass
2460+
reveal_type(list(Good)) # E: Revealed type is 'builtins.list[builtins.int*]'
2461+
2462+
[builtins fixtures/list.pyi]
2463+

0 commit comments

Comments
 (0)