[syntax-errors] Alternative match patterns bind different names#20682
Conversation
|
test Thank you |
ntBre
left a comment
There was a problem hiding this comment.
Thank you! This looks good overall. I just had a couple of suggestions about test cases and a bit of a simplification/possible performance improvement.
Yes, I think you can stack the comments, although you may need to move the existing one to the previous line like this: |
Sure, have added accordingly. |
|
Signed-off-by: 11happy <soni5happy@gmail.com>
Signed-off-by: 11happy <soni5happy@gmail.com>
Signed-off-by: 11happy <soni5happy@gmail.com>
Signed-off-by: 11happy <soni5happy@gmail.com>
Signed-off-by: 11happy <soni5happy@gmail.com>
Signed-off-by: 11happy <soni5happy@gmail.com>
Signed-off-by: 11happy <soni5happy@gmail.com>
0035102 to
95e7a77
Compare
|
rebased : ) |
Signed-off-by: 11happy <soni5happy@gmail.com>
Signed-off-by: 11happy <soni5happy@gmail.com>
ntBre
left a comment
There was a problem hiding this comment.
Thank you!
I pushed two small commits, one using the full match pattern's range like CPython does. I think the narrower range could be helpful in the future, but the whole thing seems okay for now. And one renaming the error to DifferentMatchPatternBindings. I still don't totally love the name, but it's not user-facing, so we can always iterate on it if needed.
match patterns bind different names
|
This change seems to now cause a SyntaxError on the following valid code that doesn't use different names: |
Summary
This PR implements semantic syntax error where alternative patterns bind different names
Test Plan
I have written inline tests as directed in #17412