Skip to content

Commit

Permalink
fix inference
Browse files Browse the repository at this point in the history
  • Loading branch information
elazarg committed Feb 6, 2017
1 parent 4c70367 commit 7876d3f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mypy/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ def visit_type_var(self, template: TypeVarType) -> List[Constraint]:
def visit_instance(self, template: Instance) -> List[Constraint]:
actual = self.actual
res = [] # type: List[Constraint]
if isinstance(actual, CallableType) and actual.fallback is not None:
actual = actual.fallback
if isinstance(actual, Instance):
instance = actual
if (self.direction == SUBTYPE_OF and
Expand Down
4 changes: 4 additions & 0 deletions test-data/unit/check-classes.test
Original file line number Diff line number Diff line change
Expand Up @@ -2802,3 +2802,7 @@ class GoodMeta(type, Iterable[int]):

class Good(metaclass=GoodMeta): pass
for _ in Good: pass
reveal_type(list(Good)) # E: Revealed type is 'builtins.list[builtins.int*]'

[builtins fixtures/list.pyi]

0 comments on commit 7876d3f

Please sign in to comment.