You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update error message for incompatible args (#6796)
Closes#5025
Updated the error message that is displayed when the argument types of a method in a subclass are incompatible with the arguments of the same method in the superclass.
```python
# sample.py
class A:
def kek(self, lol: int = 0) -> None:
print("Kek in A")
class B(A):
def kek(self, haha: str = "") -> None:
super().kek(1)
print("Kek in B")
```
Output before:
```sh
mypy sample.py
sample.py:11: error: Argument 1 of "kek" incompatible with supertype "A"
```
Output now:
```
mypy sample.py
sample.py:11: error: Argument 1 of "kek" is incompatible with supertype "A"; supertype defines the argument type as "int"
```
Copy file name to clipboardExpand all lines: test-data/unit/check-functions.test
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ class A(object):
45
45
def f(self, a: int, b: str) -> None: pass
46
46
47
47
class B(A):
48
-
def f(self, b: str, a: int) -> None: pass # E: Argument 1 of "f" incompatible with supertype "A"# E: Argument 2 of "f" incompatible with supertype "A"
48
+
def f(self, b: str, a: int) -> None: pass # E: Argument 1 of "f" is incompatible with supertype "A"; supertype defines the argument type as "int" # E: Argument 2 of "f" is incompatible with supertype "A"; supertype defines the argument type as "str"
0 commit comments