mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-02 04:48:07 +00:00
[ty] Rename "possibly unbound" diagnostics to "possibly missing" (#20492)
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
This commit is contained in:
parent
4ed8c65d29
commit
bf38e69870
41 changed files with 213 additions and 194 deletions
|
|
@ -69,7 +69,7 @@ instance = C()
|
|||
instance.non_existent = 1 # error: [unresolved-attribute]
|
||||
```
|
||||
|
||||
## Possibly-unbound attributes
|
||||
## Possibly-missing attributes
|
||||
|
||||
When trying to set an attribute that is not defined in all branches, we emit errors:
|
||||
|
||||
|
|
@ -79,10 +79,10 @@ def _(flag: bool) -> None:
|
|||
if flag:
|
||||
attr: int = 0
|
||||
|
||||
C.attr = 1 # error: [possibly-unbound-attribute]
|
||||
C.attr = 1 # error: [possibly-missing-attribute]
|
||||
|
||||
instance = C()
|
||||
instance.attr = 1 # error: [possibly-unbound-attribute]
|
||||
instance.attr = 1 # error: [possibly-missing-attribute]
|
||||
```
|
||||
|
||||
## Data descriptors
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ async def main() -> None:
|
|||
await MissingAwait() # error: [invalid-await]
|
||||
```
|
||||
|
||||
## Custom type with possibly unbound `__await__`
|
||||
## Custom type with possibly missing `__await__`
|
||||
|
||||
This diagnostic also points to the method definition if available.
|
||||
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ def _(n: int):
|
|||
# error: [invalid-argument-type] "Argument to function `f5` is incorrect: Expected `str`, found `Literal[3]`"
|
||||
# error: [no-matching-overload] "No overload of function `f6` matches arguments"
|
||||
# error: [call-non-callable] "Object of type `Literal[5]` is not callable"
|
||||
# error: [call-non-callable] "Object of type `PossiblyNotCallable` is not callable (possibly unbound `__call__` method)"
|
||||
# error: [call-non-callable] "Object of type `PossiblyNotCallable` is not callable (possibly missing `__call__` method)"
|
||||
x = f(3)
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue