-
-
Notifications
You must be signed in to change notification settings - Fork 419
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
Fix compiler crash from match
with extra parens around let
in tuple
#4595
Fix compiler crash from match
with extra parens around let
in tuple
#4595
Conversation
Fixes ponylang#4412 The compiler would crash if an extra set of parens were added to a single element tuple match of a union type. For example, if `type Foo is (I32 | (I32, I32))` is being matched, then a match clause like `| (123, (let x: I32)) => x` would crash the compiler. This was caused by the codegen for the match not handling the extra SEQ node in the AST created by the parens. This change now skips any extra SEQ nodes when performing codegen for tuple matches.
Hi @chriskdon, The changelog - fixed label was added to this pull request; all PRs with a changelog label need to have release notes included as part of the PR. If you haven't added release notes already, please do. Release notes are added by creating a uniquely named file in the The basic format of the release notes (using markdown) should be:
Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have used Pony test as part of any full program tests. I believe what we want to test is that the program compiles and possibly that it did the match correctly.
For that not using pony test is fine. See the other tests that set the exitcode. You can have a regular program like your minimal example and set the exit code to the extracted match value and then include an "expected exit" file and that will work with the runner as it is designed.
let me know if that makes sense, if not, i can supply a suggestion in the PR that would change the test.
@SeanTAllen thanks for the suggestion. Let me know if you want anything else changed, or the release notes reworded. |
match
with extra parens around let
in tuple
thanks @chriskdon. i can hardly wait for the next PR from you! 😉 |
Thanks! I look forward to contributing more in the future. 😀 |
Fixes #4412
The compiler would crash if an extra set of parens were added to a single element tuple match of a union type. For example, if
type Foo is (I32 | (I32, I32))
is being matched, then a match clause like| (123, (let x: I32)) => x
would crash the compiler. This was caused by the codegen for the match not handling the extra SEQ node in the AST created by the parens. This change now skips any extra SEQ nodes when performing codegen for tuple matches.