@@ -2609,32 +2609,8 @@ class Y(X):
26092609[builtins fixtures/tuple.pyi]
26102610
26112611
2612- [case testDunderReplaceDoesNotBlockAdHocIntersectionNarrowing]
2613- # https://github.com/python/mypy/issues/21635
2614- # flags: --python-version 3.13
2615- from dataclasses import dataclass
2616-
2617- @dataclass
2618- class A: ...
2619- @dataclass
2620- class M: ...
2621- @dataclass
2622- class B(A): ...
2623- @dataclass
2624- class C(M, A): ...
2625-
2626- alist: list[type[A]] = [B, C]
2627- mlist: list[type[M]] = [cls for cls in alist if issubclass(cls, M)]
2628- reveal_type(mlist) # N: Revealed type is "builtins.list[type[__main__.M]]"
2629- [builtins fixtures/isinstancelist.pyi]
2630-
26312612[case testDunderReplaceDoesNotBlockPlainIssubclassNarrowing]
26322613# https://github.com/python/mypy/issues/21635
2633- # Same underlying bug as testDunderReplaceDoesNotBlockAdHocIntersectionNarrowing,
2634- # but without a list/comprehension: plain issubclass() narrowing in an
2635- # ordinary if-statement hit the exact same false "impossible intersection"
2636- # and silently marked the branch as unreachable instead of narrowing (no
2637- # reveal_type note, and the type error below went unreported).
26382614# flags: --python-version 3.13
26392615from dataclasses import dataclass
26402616
@@ -2653,20 +2629,6 @@ if issubclass(cls, M):
26532629 n: int = 'foo' # E: Incompatible types in assignment (expression has type "str", variable has type "int")
26542630[builtins fixtures/isinstancelist.pyi]
26552631
2656- [case testDunderReplaceHandwrittenStillCheckedForCompatibility]
2657- # flags: --python-version 3.13
2658- class A:
2659- def __replace__(self) -> "A":
2660- return A()
2661-
2662- class M:
2663- def __replace__(self) -> "M":
2664- return M()
2665-
2666- class C(M, A): # E: Definition of "__replace__" in base class "M" is incompatible with definition in base class "A"
2667- pass
2668- [builtins fixtures/tuple.pyi]
2669-
26702632
26712633[case testFrozenWithFinal]
26722634from dataclasses import dataclass
0 commit comments