mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:25:17 +00:00
[red-knot] Add failing tests for iterating over maybe-iterable unions (#14016)
This commit is contained in:
parent
9a6b08b557
commit
d1189c20df
2 changed files with 61 additions and 3 deletions
|
@ -1090,7 +1090,7 @@ impl<'db> Type<'db> {
|
|||
};
|
||||
}
|
||||
|
||||
if let Type::Unknown | Type::Any = self {
|
||||
if matches!(self, Type::Unknown | Type::Any | Type::Todo) {
|
||||
// Explicit handling of `Unknown` and `Any` necessary until `type[Unknown]` and
|
||||
// `type[Any]` are not defined as `Todo` anymore.
|
||||
return IterationOutcome::Iterable { element_ty: self };
|
||||
|
@ -1185,9 +1185,9 @@ impl<'db> Type<'db> {
|
|||
// TODO can we do better here? `type[LiteralString]`?
|
||||
Type::StringLiteral(_) | Type::LiteralString => KnownClass::Str.to_class(db),
|
||||
// TODO: `type[Any]`?
|
||||
Type::Any => Type::Todo,
|
||||
Type::Any => Type::Any,
|
||||
// TODO: `type[Unknown]`?
|
||||
Type::Unknown => Type::Todo,
|
||||
Type::Unknown => Type::Unknown,
|
||||
// TODO intersections
|
||||
Type::Intersection(_) => Type::Todo,
|
||||
Type::Todo => Type::Todo,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue