mirror of
https://github.com/astral-sh/ruff
synced 2026-01-10 08:04:26 -05:00
## Summary Two minor cleanups: - Return `Option<ClassType>` rather than `Option<ClassLiteral>` from `TypeInferenceBuilder::class_context_of_current_method`. Now that `ClassType::is_protocol` exists as a method as well as `ClassLiteral::is_protocol`, this simplifies most of the call-sites of the `class_context_of_current_method()` method. - Make more use of the `MethodDecorator::try_from_fn_type` method in `class.rs`. Under the hood, this method uses the new methods `FunctionType::is_classmethod()` and `FunctionType::is_staticmethod()` that @sharkdp recently added, so it gets the semantics more precisely correct than the code it's replacing in `infer.rs` (by accounting for implicit staticmethods/classmethods as well as explicit ones). By using these methods we can delete some code elsewhere (the `FunctionDecorators::from_decorator_types()` constructor) ## Test Plan Existing tests