Skip to content

Overloaded functions and aliases not working together #8216

Closed
@canepan

Description

@canepan

Please provide more information to help us understand the issue:

  • Reporting a bug
  • failing (mock) code:
class CustomType:
    myattr: str = ''

def _custom_repr(v: CustomType) -> str:
    return v.myattr

@attr.s
class MyClass(object)
    myvar: CustomType = attr.ib(repr=_custom_repr)
  • the actual output: error: No overload variant matches argument type "Callable[[Any], str]"
  • the behavior/output I expect: mypy should succeed
  • mypy 0.720
  • mypy flags: --python-version 3.6 --python-executable python3.6
  • mypy flags (from config): ignore_missing_imports = True
  • If mypy crashed with a traceback, please paste
    the full traceback below.

possibly related to: #6157 , #8092

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions