| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Inspired by @Copilot in 35ae089
for more information, see https://pre-commit.ci
|
This is now ready for review. |
Sorry, something went wrong.
| elif not tuple_types and not sequence_types and not unknown_type: | ||
| return self.early_non_match() | ||
| elif tuple_types: | ||
| inner_types = [make_simplified_union([*sequence_types, *x]) for x in zip(*tuple_types)] |
There was a problem hiding this comment.
I think this zip isn't quite right, I will push the fix + test
Sorry, something went wrong.
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
Sorry, something went wrong.
|
Thank you! |
Sorry, something went wrong.
I realised there is a simpler and more powerful approach than the one taken in python#19600. This basically adds the new "Step 2" to the original code.
I realised there is a simpler and more powerful approach than the one taken in python#19600. This basically adds the new "Step 2" to the original code.
|
Thank you for fixing this up! Excited to have this working now :) |
Sorry, something went wrong.
I realised there is a simpler and more complete approach than the one taken in #19600. This adds the new "Step 2" to the original code. Best way to review the diff is probably to check it out and review it squashed with #19600 , but really the net logic change is just "Step 2" Fixes #15190 Fixes #17549 Fixes #17600 Mostly fixes #18039 Helps with things in #19081
| Back | FazBrowse Home | New Git URL |
This pull request fixes handling of union types containing tuples in match statements. Previously, when a tuple was part of a union, all its items would be unioned together and treated as a homogeneous tuple of that union type, which was incorrect.
It still fallbacks on this behavior if we there are multiple tuples in the union with Unpack in them, but otherwise now it should be handled correctly.
I attempted to keep as much of the existing semantics the same besides for this change. I also tried to keep the performance roughly similar, not unioning types more than needed.
Fixes #19599
Fixes #19082