dry-python/classes

Mypy crash on calling typeclass with zero args

sobolevn opened this issue · 0 comments

This code:

@typeclass
def some(instance) -> int:
    ...

reveal_type(some())

produces a crash:

ex.py:15: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.910
Traceback (most recent call last):
  File "mypy/checkexpr.py", line 3905, in accept
  File "mypy/checkexpr.py", line 271, in visit_call_expr
  File "mypy/checkexpr.py", line 353, in visit_call_expr_inner
  File "mypy/checkexpr.py", line 858, in check_call_expr_with_callee_type
  File "mypy/checkexpr.py", line 934, in check_call
  File "mypy/checkexpr.py", line 820, in transform_callee_type
  File "mypy/checkexpr.py", line 791, in apply_method_signature_hook
  File "mypy/checkexpr.py", line 762, in apply_signature_hook
  File "mypy/checkexpr.py", line 794, in <lambda>
  File "/Users/sobolev/Documents/github/typeclasses/classes/contrib/mypy/features/typeclass.py", line 277, in call_signature
    passed_type = ctx.api.expr_checker.accept(ctx.args[0][0])  # type: ignore
IndexError: list index out of range
ex.py:15: : note: use --pdb to drop into pdb