File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
crates/ty_python_semantic/src/types Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -218,6 +218,7 @@ mod flaky {
218
218
use itertools:: Itertools ;
219
219
220
220
use super :: { intersection, union} ;
221
+ use crate :: types:: { KnownClass , Type } ;
221
222
222
223
// Negating `T` twice is equivalent to `T`.
223
224
type_property_test ! (
@@ -311,4 +312,14 @@ mod flaky {
311
312
bottom_materialization_of_type_is_assigneble_to_type, db,
312
313
forall types t. t. bottom_materialization( db) . is_assignable_to( db, t)
313
314
) ;
315
+
316
+ // Any type assignable to `Iterable[object]` should be considered iterable.
317
+ //
318
+ // Note that the inverse is not true, due to the fact that we recognize the old-style
319
+ // iteration protocol as well as the new-style iteration protocol: not all objects that
320
+ // we consider iterable are assignable to `Iterable[object]`.
321
+ type_property_test ! (
322
+ all_type_assignable_to_iterable_are_iterable, db,
323
+ forall types t. t. is_assignable_to( db, KnownClass :: Iterable . to_specialized_instance( db, [ Type :: object( db) ] ) ) => t. try_iterate( db) . is_ok( )
324
+ ) ;
314
325
}
You can’t perform that action at this time.
0 commit comments