Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[red-knot] Support assert_type #15194

Merged
merged 3 commits into from
Jan 10, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Fix
InSyncWithFoo committed Jan 10, 2025
commit 050b832f7b149e15c09dfd294dde4e6b04f04582
Original file line number Diff line number Diff line change
@@ -96,8 +96,8 @@ def _(a: tuple[Any, ...], b: tuple[Unknown, ...]):
assert_type(a, tuple[Any, ...]) # fine
assert_type(a, tuple[Unknown, ...]) # fine

assert_type(b, tuple[Any, ...]) # fine
assert_type(b, tuple[Unknown, ...]) # fine
assert_type(b, tuple[Any, ...]) # fine
```

## Unions
2 changes: 1 addition & 1 deletion crates/red_knot_python_semantic/src/types.rs
Original file line number Diff line number Diff line change
@@ -1140,7 +1140,7 @@ impl<'db> Type<'db> {
let second_elements = second.elements(db);

first_elements.len() == second_elements.len()
&& iter::zip(first_elements, first_elements).all(equivalent)
&& iter::zip(first_elements, second_elements).all(equivalent)
}

// TODO: Handle equivalent unions with items in different order