diff --git a/mypy/messages.py b/mypy/messages.py index c6378c264757..fb7eecb273ae 100644 --- a/mypy/messages.py +++ b/mypy/messages.py @@ -3015,7 +3015,14 @@ def [T <: int] f(self, x: int, y: T) -> None if s: s = ", " + s s = first_arg + s - s = f"{tp.name.split()[0]}({s})" # skip "of Class" part + if ( + isinstance(definition, FuncDef) + and hasattr(definition, "name") + and definition.name == "__init__" + ): + s = f"{definition.name}({s})" + else: + s = f"{tp.name.split()[0]}({s})" # skip "of Class" part else: s = f"({s})" diff --git a/mypy/test/config.py b/mypy/test/config.py index 2dc4208b1e9d..7dd5e3806e6e 100644 --- a/mypy/test/config.py +++ b/mypy/test/config.py @@ -6,7 +6,7 @@ if provided_prefix: PREFIX = provided_prefix else: - this_file_dir = os.path.dirname(os.path.realpath(__file__)) + this_file_dir = os.path.dirname(os.path.abspath(__file__)) PREFIX = os.path.dirname(os.path.dirname(this_file_dir)) # Location of test data files such as test case descriptions. diff --git a/test-data/unit/check-serialize.test b/test-data/unit/check-serialize.test index 1498c8d82826..9c321f0d3ba4 100644 --- a/test-data/unit/check-serialize.test +++ b/test-data/unit/check-serialize.test @@ -312,8 +312,8 @@ class A: [out2] tmp/a.py:2: error: No overload variant of "A" matches argument type "object" tmp/a.py:2: note: Possible overload variants: -tmp/a.py:2: note: def A(self, x: int) -> A -tmp/a.py:2: note: def A(self, x: str) -> A +tmp/a.py:2: note: def __init__(self, x: int) -> A +tmp/a.py:2: note: def __init__(self, x: str) -> A tmp/a.py:7: error: No overload variant of "__init__" of "A" matches argument type "object" tmp/a.py:7: note: Possible overload variants: tmp/a.py:7: note: def __init__(self, x: int) -> None