Skip to content

Commit 888a910

Browse files
authored
[red-knot] Demote the negation_reverses_subtype_order test back to flaky (astral-sh#16951)
Fixes astral-sh#16913. See my analysis in the issue for the rationale
1 parent 581b700 commit 888a910

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

crates/red_knot_python_semantic/src/types/property_tests.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,6 @@ mod stable {
103103
forall types s, t. s.is_subtype_of(db, t) && t.is_subtype_of(db, s) => s.is_equivalent_to(db, t)
104104
);
105105

106-
// If `S <: T`, then `~T <: ~S`.
107-
type_property_test!(
108-
negation_reverses_subtype_order, db,
109-
forall types s, t. s.is_subtype_of(db, t) => t.negate(db).is_subtype_of(db, s.negate(db))
110-
);
111-
112106
// `T` is not disjoint from itself, unless `T` is `Never`.
113107
type_property_test!(
114108
disjoint_from_is_irreflexive, db,
@@ -286,4 +280,19 @@ mod flaky {
286280
forall types s, t.
287281
!s.is_disjoint_from(db, union(db, [s, t])) && !t.is_disjoint_from(db, union(db, [s, t]))
288282
);
283+
284+
// If `S <: T`, then `~T <: ~S`.
285+
//
286+
// DO NOT STABILISE this test until the mdtests here pass:
287+
// https://github.com/astral-sh/ruff/blob/2711e08eb8eb38d1ce323aae0517fede371cba15/crates/red_knot_python_semantic/resources/mdtest/type_properties/is_subtype_of.md?plain=1#L276-L315
288+
//
289+
// This test has flakes relating to those subtyping and simplification tests
290+
// (see https://github.com/astral-sh/ruff/issues/16913), but it is hard to
291+
// reliably trigger the flakes when running this test manually as the flakes
292+
// occur very rarely (even running the test with several million seeds does
293+
// not always reliably reproduce the flake).
294+
type_property_test!(
295+
negation_reverses_subtype_order, db,
296+
forall types s, t. s.is_subtype_of(db, t) => t.negate(db).is_subtype_of(db, s.negate(db))
297+
);
289298
}

0 commit comments

Comments
 (0)