@@ -115,7 +115,11 @@ class Base:
115
115
__hash__ = None
116
116
117
117
class Derived(Base):
118
- def __hash__(self) -> int: # E: Signature of "__hash__" incompatible with supertype "Base"
118
+ def __hash__(self) -> int: # E: Signature of "__hash__" incompatible with supertype "Base" \
119
+ # N: Superclass: \
120
+ # N: None \
121
+ # N: Subclass: \
122
+ # N: def __hash__(self) -> int
119
123
pass
120
124
121
125
# Correct:
@@ -157,7 +161,11 @@ class Base:
157
161
158
162
159
163
class Derived(Base):
160
- def partial_type(self) -> int: # E: Signature of "partial_type" incompatible with supertype "Base"
164
+ def partial_type(self) -> int: # E: Signature of "partial_type" incompatible with supertype "Base" \
165
+ # N: Superclass: \
166
+ # N: List[Any] \
167
+ # N: Subclass: \
168
+ # N: def partial_type(self) -> int
161
169
...
162
170
163
171
@@ -567,8 +575,16 @@ class A:
567
575
568
576
class B(A):
569
577
@dec
570
- def f(self) -> int: pass # E: Signature of "f" incompatible with supertype "A"
571
- def g(self) -> int: pass # E: Signature of "g" incompatible with supertype "A"
578
+ def f(self) -> int: pass # E: Signature of "f" incompatible with supertype "A" \
579
+ # N: Superclass: \
580
+ # N: def f(self) -> str \
581
+ # N: Subclass: \
582
+ # N: str
583
+ def g(self) -> int: pass # E: Signature of "g" incompatible with supertype "A" \
584
+ # N: Superclass: \
585
+ # N: str \
586
+ # N: Subclass: \
587
+ # N: def g(self) -> int
572
588
@dec
573
589
def h(self) -> str: pass
574
590
@@ -4223,11 +4239,12 @@ class A:
4223
4239
def a(self) -> None: pass
4224
4240
b = 1
4225
4241
class B(A):
4226
- a = 1
4227
- def b(self) -> None: pass
4228
- [out]
4229
- main:5: error: Incompatible types in assignment (expression has type "int", base class "A" defined the type as "Callable[[A], None]")
4230
- main:6: error: Signature of "b" incompatible with supertype "A"
4242
+ a = 1 # E: Incompatible types in assignment (expression has type "int", base class "A" defined the type as "Callable[[A], None]")
4243
+ def b(self) -> None: pass # E: Signature of "b" incompatible with supertype "A" \
4244
+ # N: Superclass: \
4245
+ # N: int \
4246
+ # N: Subclass: \
4247
+ # N: def b(self) -> None
4231
4248
4232
4249
[case testVariableProperty]
4233
4250
class A:
@@ -6166,7 +6183,11 @@ import a
6166
6183
[file b.py]
6167
6184
import a
6168
6185
class Sub(a.Base):
6169
- def x(self) -> int: pass # E: Signature of "x" incompatible with supertype "Base"
6186
+ def x(self) -> int: pass # E: Signature of "x" incompatible with supertype "Base" \
6187
+ # N: Superclass: \
6188
+ # N: int \
6189
+ # N: Subclass: \
6190
+ # N: def x(self) -> int
6170
6191
6171
6192
[file a.py]
6172
6193
import b
@@ -6182,7 +6203,11 @@ import a
6182
6203
import c
6183
6204
class Sub(a.Base):
6184
6205
@c.deco
6185
- def x(self) -> int: pass # E: Signature of "x" incompatible with supertype "Base"
6206
+ def x(self) -> int: pass # E: Signature of "x" incompatible with supertype "Base" \
6207
+ # N: Superclass: \
6208
+ # N: int \
6209
+ # N: Subclass: \
6210
+ # N: def x(*Any, **Any) -> Tuple[int, int]
6186
6211
6187
6212
[file a.py]
6188
6213
import b
@@ -6204,7 +6229,11 @@ import a
6204
6229
import c
6205
6230
class Sub(a.Base):
6206
6231
@c.deco
6207
- def x(self) -> int: pass # E: Signature of "x" incompatible with supertype "Base"
6232
+ def x(self) -> int: pass # E: Signature of "x" incompatible with supertype "Base" \
6233
+ # N: Superclass: \
6234
+ # N: int \
6235
+ # N: Subclass: \
6236
+ # N: def x(*Any, **Any) -> Tuple[int, int]
6208
6237
6209
6238
[file a.py]
6210
6239
import b
@@ -7687,13 +7716,29 @@ class Parent:
7687
7716
foobar = TypeVar("foobar")
7688
7717
7689
7718
class Child(Parent):
7690
- def foo(self, val: int) -> int: # E: Signature of "foo" incompatible with supertype "Parent"
7719
+ def foo(self, val: int) -> int: # E: Signature of "foo" incompatible with supertype "Parent" \
7720
+ # N: Superclass: \
7721
+ # N: None \
7722
+ # N: Subclass: \
7723
+ # N: def foo(self, val: int) -> int
7691
7724
return val
7692
- def bar(self, val: str) -> str: # E: Signature of "bar" incompatible with supertype "Parent"
7725
+ def bar(self, val: str) -> str: # E: Signature of "bar" incompatible with supertype "Parent" \
7726
+ # N: Superclass: \
7727
+ # N: None \
7728
+ # N: Subclass: \
7729
+ # N: def bar(self, val: str) -> str
7693
7730
return val
7694
- def baz(self, val: float) -> float: # E: Signature of "baz" incompatible with supertype "Parent"
7731
+ def baz(self, val: float) -> float: # E: Signature of "baz" incompatible with supertype "Parent" \
7732
+ # N: Superclass: \
7733
+ # N: None \
7734
+ # N: Subclass: \
7735
+ # N: def baz(self, val: float) -> float
7695
7736
return val
7696
- def foobar(self) -> bool: # E: Signature of "foobar" incompatible with supertype "Parent"
7737
+ def foobar(self) -> bool: # E: Signature of "foobar" incompatible with supertype "Parent" \
7738
+ # N: Superclass: \
7739
+ # N: None \
7740
+ # N: Subclass: \
7741
+ # N: def foobar(self) -> bool
7697
7742
return False
7698
7743
7699
7744
x: Parent.foo = lambda: 5
@@ -7761,7 +7806,11 @@ class B:
7761
7806
...
7762
7807
class C(B):
7763
7808
@property
7764
- def foo(self) -> int: # E: Signature of "foo" incompatible with supertype "B"
7809
+ def foo(self) -> int: # E: Signature of "foo" incompatible with supertype "B" \
7810
+ # N: Superclass: \
7811
+ # N: def foo(self) -> int \
7812
+ # N: Subclass: \
7813
+ # N: int
7765
7814
...
7766
7815
[builtins fixtures/property.pyi]
7767
7816
@@ -7771,7 +7820,11 @@ class B:
7771
7820
def foo(self) -> int:
7772
7821
...
7773
7822
class C(B):
7774
- def foo(self) -> int: # E: Signature of "foo" incompatible with supertype "B"
7823
+ def foo(self) -> int: # E: Signature of "foo" incompatible with supertype "B" \
7824
+ # N: Superclass: \
7825
+ # N: int \
7826
+ # N: Subclass: \
7827
+ # N: def foo(self) -> int
7775
7828
...
7776
7829
[builtins fixtures/property.pyi]
7777
7830
0 commit comments