Skip to content

Commit a91c0a1

Browse files
committed
fix inference
1 parent 48bbe83 commit a91c0a1

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
@@ -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

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

24722472
class Good(metaclass=GoodMeta): pass
24732473
for _ in Good: pass
2474+
reveal_type(list(Good)) # E: Revealed type is 'builtins.list[builtins.int*]'
2475+
2476+
[builtins fixtures/list.pyi]
2477+

0 commit comments

Comments
 (0)