Skip to content

Commit c51f1c7

Browse files
committed
add test for overlapping TupleType
1 parent d355ff4 commit c51f1c7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test-data/unit/check-classes.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,6 +1751,16 @@ class Fraction(Real):
17511751
[out]
17521752
main:5: error: Signatures of "__radd__" of "Fraction" and "__add__" of "Real" are unsafely overlapping
17531753

1754+
[case testUnsafeOverlappingTuple]
1755+
from typing import Tuple
1756+
1757+
class Real(Tuple[int, int]):
1758+
def __add__(self, other): return 1
1759+
class Fraction(Real):
1760+
def __radd__(self, other: Real) -> Real: return other # E: Signatures of "__radd__" of "Fraction" and "__add__" of "Real" are unsafely overlapping
1761+
1762+
[builtins fixtures/tuple.pyi]
1763+
17541764
[case testOverlappingNormalAndInplaceOperatorMethod]
17551765
import typing
17561766
class A:

0 commit comments

Comments
 (0)