forked from astral-sh/ruff
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…h#15218) ## Summary Remove `Type::tuple` in favor of `TupleType::from_elements`, avoid a few intermediate `Vec`tors. Resolves an old [review comment](astral-sh#14744 (comment)). ## Test Plan New regression test for something I ran into while implementing this.
- Loading branch information
Showing
4 changed files
with
39 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
crates/red_knot_workspace/resources/test/corpus/88_regression_tuple_type_short_circuit.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
""" | ||
Regression test that makes sure we do not short-circuit here after | ||
determining that the overall type will be `Never` and still infer | ||
a type for the second tuple element `2`. | ||
Relevant discussion: | ||
https://github.com/astral-sh/ruff/pull/15218#discussion_r1900811073 | ||
""" | ||
|
||
from typing_extensions import Never | ||
|
||
|
||
def never() -> Never: | ||
return never() | ||
|
||
|
||
(never(), 2) |