mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-24 09:06:17 +00:00
This eliminates the panic reported in https://github.com/astral-sh/ty/issues/909, though it doesn't address the underlying cause, which is that we aren't yet checking the types of the fields of a protocol when checking whether a class implements the protocol. And in particular, if a class explictly opts out of iteration via ```py class NotIterable: __iter__ = None ``` we currently treat that as "having an `__iter__`" member, and therefore implementing `Iterable`. Note that the assumption that was in the comment before is still correct: call binding will have already checked that the argument satisfies `Iterable`, and so it shouldn't be an error to iterate over said argument. But arguably, the new logic in this PR is a better way to discharge that assumption — instead of panicking if we happen to be wrong, fall back on an unknown iteration result. |
||
|---|---|---|
| .. | ||
| module_resolver | ||
| semantic_index | ||
| types | ||
| util | ||
| ast_node_ref.rs | ||
| db.rs | ||
| dunder_all.rs | ||
| lib.rs | ||
| lint.rs | ||
| list.rs | ||
| module_name.rs | ||
| node_key.rs | ||
| place.rs | ||
| program.rs | ||
| pull_types.rs | ||
| python_platform.rs | ||
| rank.rs | ||
| semantic_index.rs | ||
| semantic_model.rs | ||
| site_packages.rs | ||
| suppression.rs | ||
| types.rs | ||
| unpack.rs | ||