Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions crates/ty_python_semantic/resources/mdtest/binary/in.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
```
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down