Skip to content

Commit b9ecdf5

Browse files
author
Guido van Rossum
committed
Cleaner (?) fix for crash in #2302
See #2302 (comment)
1 parent b8aa01b commit b9ecdf5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mypy/checkexpr.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1373,7 +1373,9 @@ def visit_reveal_type_expr(self, expr: RevealTypeExpr) -> Type:
13731373

13741374
def visit_type_application(self, tapp: TypeApplication) -> Type:
13751375
"""Type check a type application (expr[type, ...])."""
1376-
tp = cast(CallableType, self.accept(tapp.expr))
1376+
tp = self.accept(tapp.expr)
1377+
if not isinstance(tp, CallableType):
1378+
return AnyType()
13771379
return self.apply_generic_arguments(tp, tapp.types, tapp)
13781380

13791381
def visit_type_alias_expr(self, alias: TypeAliasExpr) -> Type:

0 commit comments

Comments
 (0)