Skip to content

Commit df5eba7

Browse files
authored
[ty] Mark all_type_assignable_to_iterable_are_iterable as flaky (#19574)
1 parent 469c50b commit df5eba7

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

crates/ty_python_semantic/src/types/property_tests.rs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ macro_rules! type_property_test {
6868

6969
mod stable {
7070
use super::union;
71-
use crate::types::{CallableType, KnownClass, Type};
71+
use crate::types::{CallableType, Type};
7272

7373
// Reflexivity: `T` is equivalent to itself.
7474
type_property_test!(
@@ -205,16 +205,6 @@ mod stable {
205205
all_fully_static_type_pairs_are_subtype_of_their_union, db,
206206
forall fully_static_types s, t. s.is_subtype_of(db, union(db, [s, t])) && t.is_subtype_of(db, union(db, [s, t]))
207207
);
208-
209-
// Any type assignable to `Iterable[object]` should be considered iterable.
210-
//
211-
// Note that the inverse is not true, due to the fact that we recognize the old-style
212-
// iteration protocol as well as the new-style iteration protocol: not all objects that
213-
// we consider iterable are assignable to `Iterable[object]`.
214-
type_property_test!(
215-
all_type_assignable_to_iterable_are_iterable, db,
216-
forall types t. t.is_assignable_to(db, KnownClass::Iterable.to_specialized_instance(db, [Type::object(db)])) => t.try_iterate(db).is_ok()
217-
);
218208
}
219209

220210
/// This module contains property tests that currently lead to many false positives.
@@ -227,6 +217,8 @@ mod stable {
227217
mod flaky {
228218
use itertools::Itertools;
229219

220+
use crate::types::{KnownClass, Type};
221+
230222
use super::{intersection, union};
231223

232224
// Negating `T` twice is equivalent to `T`.
@@ -321,4 +313,16 @@ mod flaky {
321313
bottom_materialization_of_type_is_assigneble_to_type, db,
322314
forall types t. t.bottom_materialization(db).is_assignable_to(db, t)
323315
);
316+
317+
// Any type assignable to `Iterable[object]` should be considered iterable.
318+
//
319+
// Note that the inverse is not true, due to the fact that we recognize the old-style
320+
// iteration protocol as well as the new-style iteration protocol: not all objects that
321+
// we consider iterable are assignable to `Iterable[object]`.
322+
//
323+
// Currently flaky due to <https://github.com/astral-sh/ty/issues/889>
324+
type_property_test!(
325+
all_type_assignable_to_iterable_are_iterable, db,
326+
forall types t. t.is_assignable_to(db, KnownClass::Iterable.to_specialized_instance(db, [Type::object(db)])) => t.try_iterate(db).is_ok()
327+
);
324328
}

0 commit comments

Comments
 (0)