Skip to content

Commit 7876d3f

Browse files
committed
fix inference
1 parent 4c70367 commit 7876d3f

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

mypy/constraints.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ def visit_type_var(self, template: TypeVarType) -> List[Constraint]:
294294
def visit_instance(self, template: Instance) -> List[Constraint]:
295295
actual = self.actual
296296
res = [] # type: List[Constraint]
297+
if isinstance(actual, CallableType) and actual.fallback is not None:
298+
actual = actual.fallback
297299
if isinstance(actual, Instance):
298300
instance = actual
299301
if (self.direction == SUBTYPE_OF and

test-data/unit/check-classes.test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2802,3 +2802,7 @@ class GoodMeta(type, Iterable[int]):
28022802

28032803
class Good(metaclass=GoodMeta): pass
28042804
for _ in Good: pass
2805+
reveal_type(list(Good)) # E: Revealed type is 'builtins.list[builtins.int*]'
2806+
2807+
[builtins fixtures/list.pyi]
2808+

0 commit comments

Comments
 (0)