mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-26 18:06:43 +00:00
[ty] Sync vendored typeshed stubs (#20876)
Close and reopen this PR to trigger CI --------- Co-authored-by: typeshedbot <> Co-authored-by: David Peter <mail@david-peter.de>
This commit is contained in:
parent
651f7963a7
commit
cafb96aa7a
27 changed files with 487 additions and 288 deletions
|
|
@ -30,3 +30,27 @@ class B: ...
|
|||
# error: "Operator `|` is unsupported between objects of type `<class 'A'>` and `<class 'B'>`"
|
||||
reveal_type(A | B) # revealed: Unknown
|
||||
```
|
||||
|
||||
## Other binary operations resulting in `UnionType`
|
||||
|
||||
```toml
|
||||
[environment]
|
||||
python-version = "3.12"
|
||||
```
|
||||
|
||||
```py
|
||||
class A: ...
|
||||
class B: ...
|
||||
|
||||
def _(sub_a: type[A], sub_b: type[B]):
|
||||
reveal_type(A | sub_b) # revealed: UnionType
|
||||
reveal_type(sub_a | B) # revealed: UnionType
|
||||
reveal_type(sub_a | sub_b) # revealed: UnionType
|
||||
|
||||
class C[T]: ...
|
||||
class D[T]: ...
|
||||
|
||||
reveal_type(C | D) # revealed: UnionType
|
||||
|
||||
reveal_type(C[int] | D[str]) # revealed: UnionType
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue