KEMBAR78
show more than two overloads in error message · Issue #9175 · python/mypy · GitHub
Skip to content

show more than two overloads in error message #9175

@Akuli

Description

@Akuli
  • feature request
from typing import overload
@overload
def foo(x: int) -> None: ...
@overload
def foo(x: str) -> None: ...
@overload
def foo(x: bytes) -> None: ...
@overload
def foo(x: bytearray) -> None: ...
def foo(x): return None
def main() -> None: foo(None)
  • Even with verbose, the error message shows only two overloads
$ mypy foo.py 
foo.py:9: error: Overloaded function signature 4 will never be matched: signature 3's parameter type(s) are the same or broader
foo.py:11: error: No overload variant of "foo" matches argument type "None"
foo.py:11: note: Possible overload variants:
foo.py:11: note:     def foo(x: int) -> None
foo.py:11: note:     def foo(x: str) -> None
foo.py:11: note:     <2 more similar overloads not shown, out of 4 total overloads>
Found 2 errors in 1 file (checked 1 source file)
$ mypy -vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv foo.py 2>&1 | grep 'def foo'
foo.py:11: note:     def foo(x: int) -> None
foo.py:11: note:     def foo(x: str) -> None
  • I would expect increased verbosity to increase the number of overloads shown, in case someone wants to see them all
$ mypy --version
mypy 0.782
$ head -1 `which mypy`
#!/home/akuli/.local/bin/python3.8

haven't tried mypy from master yet

  • verbosity flags used as shown above

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions