[ty] Detect invalid uses of @final on non-methods by AlexWaygood · Pull Request #23604 · astral-sh/ruff (original) (raw)
and others added 5 commits
…functions
Per the typing spec, @final is only valid on methods and classes. Using it
on a module-level function or a nested function is an error. This adds a new
final-on-non-method lint rule that detects this misuse and emits a
diagnostic.
This should cause the upstream conformance test
qualifiers_final_decorator.py to pass, as the only previously missing
check was for @final applied to non-method functions.
https://claude.ai/code/session_015ajybUNEuqCYeVVnSsiFCS
Co-authored-by: David Peter sharkdp@users.noreply.github.com
AlexWaygood deleted the claude/typing-final-diagnostic-VlF5R branch
carljm added a commit that referenced this pull request
- main:
[ty] Take myself out of the reviewer pool for the next few days (#23618)
[ty] Fix bug where ty would think that a
Callablewith a variadic positional parameter could be a subtype of aCallablewith a positional-or-keyword parameter (#23610) [ruff] Add fix fornone-not-at-end-of-union(RUF036) (#22829) Bump cargo dist to 0.31 (#23614) [pyflakes] Fix false positive for names shadowing re-exports (F811) (#23356) [fastapi] Handle callable class dependencies with__call__method (FAST003) (#23553) [ty] Recurse into tuples and nested tuples when applying special-cased validation ofisinstance()andissubclass()(#23607) Update typing conformance suite commit (#23606) [ty] Detect invalid uses of@finalon non-methods (#23604) [ty] Move the type hierarchy request handlers to individual modules [ty] Wire up the type hierarchy implementation with the LSP [ty] Add routine for mapping from system path to vendored path [ty] Implement internal routines for providing the LSP "type hierarchy" feature [ty] Add some helper methods onClassLiteral[ty] Move some module name helper routines to methods onModuleName[ty] Bump version oflsp-types[ty] Refactor to support building constraint sets differently (#23600) [ty] Dataclass transform: neither frozen nor non-frozen (#23366) [ty] Add snapshot tests for advancedinvalid-assignmentscenarios (#23581) [ty] disallow negative narrowing on SubclassOf types (#23598)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})