Skip to content

Commit

Permalink
fix inference
Browse files Browse the repository at this point in the history
  • Loading branch information
elazarg committed Jan 9, 2017
1 parent 48bbe83 commit a91c0a1
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 @@ -248,6 +248,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 @@ -2471,3 +2471,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 a91c0a1

Please sign in to comment.