-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[ty] Infer type of self for decorated methods and properties
#21123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
Contributor
Diagnostic diff on typing conformance testsNo changes detected when running ty on typing conformance tests ✅ |
Contributor
|
Contributor
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
unresolved-attribute |
10,151 | 0 | 0 |
possibly-missing-attribute |
607 | 0 | 23 |
invalid-argument-type |
245 | 0 | 2 |
unused-ignore-comment |
0 | 222 | 0 |
invalid-return-type |
134 | 3 | 2 |
invalid-assignment |
106 | 0 | 0 |
non-subscriptable |
103 | 0 | 0 |
unsupported-operator |
53 | 0 | 2 |
call-non-callable |
51 | 0 | 0 |
possibly-unresolved-reference |
0 | 43 | 0 |
not-iterable |
24 | 0 | 0 |
no-matching-overload |
13 | 0 | 0 |
too-many-positional-arguments |
6 | 0 | 0 |
division-by-zero |
4 | 0 | 0 |
unknown-argument |
3 | 0 | 0 |
invalid-context-manager |
2 | 0 | 0 |
invalid-await |
1 | 0 | 0 |
missing-argument |
1 | 0 | 0 |
| Total | 11,504 | 268 | 29 |
1028870 to
7233df1
Compare
Contributor
|
7233df1 to
9798eb0
Compare
self for propertiesself for decorated methods and properties
self for decorated methods and propertiesself for decorated methods and properties
sharkdp
commented
Oct 29, 2025
Contributor
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is a regression or an improvement.
9798eb0 to
2772944
Compare
dcreager
approved these changes
Oct 29, 2025
AlexWaygood
approved these changes
Oct 29, 2025
dcreager
added a commit
that referenced
this pull request
Oct 30, 2025
* origin/main: (21 commits) [ty] Update "constraint implication" relation to work on constraints between two typevars (#21068) [`flake8-type-checking`] Fix `TC003` false positive with `future-annotations` (#21125) [ty] Fix lookup of `__new__` on instances (#21147) Fix syntax error false positive on nested alternative patterns (#21104) [`pyupgrade`] Fix false positive for `TypeVar` with default on Python <3.13 (`UP046`,`UP047`) (#21045) [ty] Reachability and narrowing for enum methods (#21130) [ty] Use `range` instead of custom `IntIterable` (#21138) [`ruff`] Add support for additional eager conversion patterns (`RUF065`) (#20657) [`ruff-ecosystem`] Fix CLI crash on Python 3.14 (#21092) [ty] Infer type of `self` for decorated methods and properties (#21123) [`flake8-bandit`] Fix correct example for `S308` (#21128) [ty] Dont provide goto definition for definitions which are not reexported in builtins (#21127) [`airflow`] warning `airflow....DAG.create_dagrun` has been removed (`AIR301`) (#21093) [ty] follow the breaking API changes made in salsa-rs/salsa#1015 (#21117) [ty] Rename `Type::into_nominal_instance` (#21124) [ty] Filter out "unimported" from the current module [ty] Add evaluation test for auto-import including symbols in current module [ty] Refactor `ty_ide` completion tests [ty] Render `import <...>` in completions when "label details" isn't supported [`refurb`] Preserve digit separators in `Decimal` constructor (`FURB157`) (#20588) ...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Infer a type of unannotated
selfparameters in decorated methods / properties.closes astral-sh/ty#1448
Test Plan
Existing tests, some new tests.