mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-19 10:00:42 +00:00
[red-knot] Property tests: account non-fully-static types (#14897)
## Summary Add a `is_fully_static` premise to the equivalence on subtyping property tests. ## Test Plan ``` cargo test -p red_knot_python_semantic -- --ignored types::property_tests::stable ```
This commit is contained in:
parent
2ecd164adb
commit
1a3c311ac5
1 changed files with 8 additions and 2 deletions
|
@ -163,13 +163,13 @@ mod stable {
|
||||||
// `T` is equivalent to itself.
|
// `T` is equivalent to itself.
|
||||||
type_property_test!(
|
type_property_test!(
|
||||||
equivalent_to_is_reflexive, db,
|
equivalent_to_is_reflexive, db,
|
||||||
forall types t. t.is_equivalent_to(db, t)
|
forall types t. t.is_fully_static(db) => t.is_equivalent_to(db, t)
|
||||||
);
|
);
|
||||||
|
|
||||||
// `T` is a subtype of itself.
|
// `T` is a subtype of itself.
|
||||||
type_property_test!(
|
type_property_test!(
|
||||||
subtype_of_is_reflexive, db,
|
subtype_of_is_reflexive, db,
|
||||||
forall types t. t.is_subtype_of(db, t)
|
forall types t. t.is_fully_static(db) => t.is_subtype_of(db, t)
|
||||||
);
|
);
|
||||||
|
|
||||||
// `S <: T` and `T <: U` implies that `S <: U`.
|
// `S <: T` and `T <: U` implies that `S <: U`.
|
||||||
|
@ -214,6 +214,12 @@ mod stable {
|
||||||
forall types t. t.is_singleton(db) => t.is_single_valued(db)
|
forall types t. t.is_singleton(db) => t.is_single_valued(db)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// If `T` contains a gradual form, it should not participate in equivalence
|
||||||
|
type_property_test!(
|
||||||
|
non_fully_static_types_do_not_participate_in_equivalence, db,
|
||||||
|
forall types s, t. !s.is_fully_static(db) => !s.is_equivalent_to(db, t) && !t.is_equivalent_to(db, s)
|
||||||
|
);
|
||||||
|
|
||||||
// If `T` contains a gradual form, it should not participate in subtyping
|
// If `T` contains a gradual form, it should not participate in subtyping
|
||||||
type_property_test!(
|
type_property_test!(
|
||||||
non_fully_static_types_do_not_participate_in_subtyping, db,
|
non_fully_static_types_do_not_participate_in_subtyping, db,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue