mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-31 15:47:41 +00:00
[ty] Minor tweaks to "list all members" docs and tests (#18388)
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / Fuzz for new ty panics (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / check playground (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
[ty Playground] Release / publish (push) Waiting to run
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / Fuzz for new ty panics (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / check playground (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
[ty Playground] Release / publish (push) Waiting to run
Ref https://github.com/astral-sh/ruff/pull/18251#pullrequestreview-2881810681
This commit is contained in:
parent
77c8ddf101
commit
fc549bda94
2 changed files with 5 additions and 9 deletions
|
@ -23,13 +23,11 @@ x = ("quux", "bar", "baz")
|
|||
static_assert("foo" not in x)
|
||||
```
|
||||
|
||||
## Statically unknown results in a type error
|
||||
## Statically unknown results in a `bool`
|
||||
|
||||
```py
|
||||
from ty_extensions import static_assert
|
||||
|
||||
def _(a: str, b: str):
|
||||
static_assert("foo" in (a, b)) # error: [static-assert-error]
|
||||
reveal_type("foo" in (a, b)) # revealed: bool
|
||||
```
|
||||
|
||||
## Values being unknown doesn't mean the result is unknown
|
||||
|
@ -46,8 +44,6 @@ def _(a: int, b: int):
|
|||
## Failure cases
|
||||
|
||||
```py
|
||||
from ty_extensions import static_assert
|
||||
|
||||
# We don't support byte strings.
|
||||
static_assert(b"foo" not in (b"quux", b"foo", b"baz")) # error: [static-assert-error]
|
||||
reveal_type(b"foo" not in (b"quux", b"foo", b"baz")) # revealed: bool
|
||||
```
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
<!-- snapshot-diagnostics -->
|
||||
|
||||
The `ty_extensions.all_members` function allows access to a list of accessible members/attributes on
|
||||
a given object. For example, all member functions of `str` are available on `"a"`:
|
||||
The `ty_extensions.all_members` function allows access to a tuple of accessible members/attributes
|
||||
on a given object. For example, all member functions of `str` are available on `"a"`:
|
||||
|
||||
```py
|
||||
from ty_extensions import all_members, static_assert
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue