-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
Crash Report
The following snippet of code causes a mypy crash:
from typing import ParamSpec, TypeVar, Concatenate, Callable, overload
P = ParamSpec("P")
R = TypeVar("R")
S = TypeVar("S")
@overload
def bar(x: Callable[Concatenate[S, P], R]) -> str: ...
@overload
def bar(x: Callable[P, R]) -> int: ...
def bar(x: Callable[..., R]) -> str | int: ...
Discovered in python/typeshed#7771.
Mypy output
Traceback (most recent call last):
File "/opt/python3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/opt/python3.9/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "mypy/checker.py", line 431, in accept
File "mypy/nodes.py", line 581, in accept
File "mypy/checker.py", line 464, in visit_overloaded_func_def
File "mypy/checker.py", line 491, in _visit_overloaded_func_def
File "mypy/checker.py", line 573, in check_overlapping_overloads
File "mypy/checker.py", line 6118, in is_unsafe_overlapping_overload_signatures
File "mypy/subtypes.py", line 982, in is_callable_compatible
File "mypy/subtypes.py", line 1051, in are_parameters_compatible
File "mypy/subtypes.py", line 1178, in are_args_compatible
File "mypy/subtypes.py", line 1183, in new_is_compat
File "mypy/checker.py", line 6603, in is_overlapping_types_no_promote
File "mypy/meet.py", line 335, in is_overlapping_types
File "mypy/subtypes.py", line 982, in is_callable_compatible
File "mypy/subtypes.py", line 1039, in are_parameters_compatible
File "mypy/subtypes.py", line 1037, in _incompatible
File "mypy/meet.py", line 181, in _is_overlapping_types
File "mypy/meet.py", line 401, in is_overlapping_types
AssertionError:
main.py:7: 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.960
main.py:7: : note: use --pdb to drop into pdb
Note that this is a very similar traceback to #12322, but I have no idea if it's the same issue, since #12322 doesn't have a minimal repro.
To Reproduce
Your Environment
- Mypy version used: 0.960
- Python version used: 3.10