Closed
Description
Mypy crashes with a simple script (valid or not) when using TypeVarTuple
feature.
Python 3.11.3, Mypy 1.4.1.
$ cat ann.py
import typing as tp
Ts = tp.TypeVarTuple('Ts')
def f(x: Ts) -> Ts:
return x
v = f(1, 2, "A")
reveal_type(v)
$ mypy ann.py
ann.py:3: error: "TypeVarTuple" support is experimental, use --enable-incomplete-feature=TypeVarTuple to enable [misc]
ann.py:5: error: Variable "ann.Ts" is not valid as a type [valid-type]
ann.py:5: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
ann.py:8: error: Too many arguments for "f" [call-arg]
ann.py:9: note: Revealed type is "Ts?"
Found 3 errors in 1 file (checked 1 source file)
$ mypy --enable-incomplete-feature=TypeVarTuple ann.py
ann.py:8: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
If this issue continues with mypy master, please report a bug at https://github.com/python/mypy/issues
version: 1.4.1
ann.py:8: : note: please use --show-traceback to print a traceback when reporting a bug
$ mypy --show-traceback --enable-incomplete-feature=TypeVarTuple ann.py
ann.py:8: 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: 1.4.1
Traceback (most recent call last):
File "mypy/checkexpr.py", line 4961, in accept
File "mypy/nodes.py", line 1901, in accept
File "mypy/checkexpr.py", line 428, in visit_call_expr
File "mypy/checkexpr.py", line 548, in visit_call_expr_inner
File "mypy/checkexpr.py", line 1208, in check_call_expr_with_callee_type
File "mypy/checkexpr.py", line 1291, in check_call
File "mypy/checkexpr.py", line 1431, in check_callable_call
File "mypy/expandtype.py", line 136, in freshen_function_type_vars
File "mypy/expandtype.py", line 71, in expand_type
File "mypy/types.py", line 1917, in accept
File "mypy/expandtype.py", line 429, in visit_callable_type
File "mypy/expandtype.py", line 536, in expand_types
File "mypy/types.py", line 841, in accept
File "mypy/expandtype.py", line 274, in visit_type_var_tuple
NotImplementedError:
ann.py:8: : note: use --pdb to drop into pdb