mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-21 07:41:53 +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
|
@ -14,7 +14,11 @@ a = NotSubscriptable()[0] # error: "Cannot subscript object of type `NotSubscri
|
|||
class NotSubscriptable:
|
||||
__getitem__ = None
|
||||
|
||||
# error: "Method `__getitem__` of type `Unknown | None` is possibly not callable on object of type `NotSubscriptable`"
|
||||
# TODO: this would be more user-friendly if the `call-non-callable` diagnostic was
|
||||
# transformed into a `not-subscriptable` diagnostic with a subdiagnostic explaining
|
||||
# that this was because `__getitem__` was possibly not callable
|
||||
#
|
||||
# error: [call-non-callable] "Method `__getitem__` of type `Unknown | None` may not be callable on object of type `NotSubscriptable`"
|
||||
a = NotSubscriptable()[0]
|
||||
```
|
||||
|
||||
|
@ -82,7 +86,7 @@ class NoSetitem:
|
|||
__setitem__ = None
|
||||
|
||||
a = NoSetitem()
|
||||
a[0] = 0 # error: "Method `__setitem__` of type `Unknown | None` is possibly not callable on object of type `NoSetitem`"
|
||||
a[0] = 0 # error: "Method `__setitem__` of type `Unknown | None` may not be callable on object of type `NoSetitem`"
|
||||
```
|
||||
|
||||
## Valid `__setitem__` method
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue