Skip to content

Multiway match typechecking and translation for pattern guards#2

Merged
rajgodse merged 15 commits intomultiway-match-parsingfrom
multiway-match-typechecking
Aug 2, 2023
Merged

Multiway match typechecking and translation for pattern guards#2
rajgodse merged 15 commits intomultiway-match-parsingfrom
multiway-match-typechecking

Conversation

@rajgodse
Copy link
Copy Markdown
Owner

Implements typechecking and translation for pattern guards.

The changes are mostly the straightforward generalization of the single case pattern guard construct.

The main complexity comes from changes related to the restructuring of Typedtree.case, whose field c_rhs used to be of type expression, but is now of type case_rhs, in conjunction with the way that multiway pattern guards change the notion of the rhs of a case.

The changes in ocamldoc are type-directed, but it is not apparent that they exhibit the intended behavior. It is worth trying to figure out the intended behavior of the modified functions through review.

Copy link
Copy Markdown
Collaborator

@ncik-roberts ncik-roberts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The translcore changes are trickier than I thought, but they still seem fine. I left a few mostly-minor comments.

@rajgodse rajgodse force-pushed the multiway-match-parsing branch from e9f2f13 to afa084b Compare July 31, 2023 14:19
@rajgodse rajgodse force-pushed the multiway-match-typechecking branch from 8e2d188 to 92d3138 Compare July 31, 2023 15:54
@rajgodse
Copy link
Copy Markdown
Owner Author

As discussed, rebased onto test changes in other PRs to consolidate tests before restructuring and splitting test cases into different test files.

@rajgodse rajgodse force-pushed the multiway-match-parsing branch from afa084b to 7e4b140 Compare July 31, 2023 18:20
@rajgodse rajgodse force-pushed the multiway-match-typechecking branch from 4a392f5 to 4e9a6c1 Compare July 31, 2023 18:28
@rajgodse
Copy link
Copy Markdown
Owner Author

Rebase onto new parsing

Copy link
Copy Markdown
Collaborator

@ncik-roberts ncik-roberts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few fairly minor suggestions.

@rajgodse rajgodse force-pushed the multiway-match-typechecking branch from 4e9a6c1 to bc3dd1b Compare August 1, 2023 13:40
@rajgodse rajgodse force-pushed the multiway-match-parsing branch from e3d7c76 to 4e22f63 Compare August 1, 2023 19:30
Copy link
Copy Markdown
Collaborator

@ncik-roberts ncik-roberts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will be good to merge after it's rebased and any conflicts are resolved. As discussed, we'll need to open a new PR from multiway-match-parsing into the flambda-backend repo even after this is merged.

@rajgodse rajgodse force-pushed the multiway-match-typechecking branch from bc3dd1b to 3f8864d Compare August 2, 2023 22:20
@rajgodse rajgodse merged commit 278f127 into multiway-match-parsing Aug 2, 2023
rajgodse added a commit that referenced this pull request Aug 2, 2023
* multiway typechecking and translation

* update jane test output

* self-review: format and style in translcore

* more translcore/typedtree cleanup

* expose value `is_guarded_rhs`

* fix typedtree printer

* make discussed changes to ocamldoc

* format: remove unnecessary parens in pattern

Co-authored-by: Nick Roberts <nroberts02@gmail.com>

* improve parmatch variable naming

* explain [exp_attributes] and [exp_extra] weirdness

* improve translcore [event_function*] naming

* inlined transl_body in transl_rhs

* rename pats_exp... to use "rhs" naming

* added test for guarded value/exception or-patterns

* address ocamldoc CRs

---------

Co-authored-by: Nick Roberts <nroberts02@gmail.com>
rajgodse added a commit that referenced this pull request Aug 3, 2023
Multiway match typechecking and translation for pattern guards (#2)

* multiway typechecking and translation

* update jane test output

* self-review: format and style in translcore

* more translcore/typedtree cleanup

* expose value `is_guarded_rhs`

* fix typedtree printer

* make discussed changes to ocamldoc

* format: remove unnecessary parens in pattern



* improve parmatch variable naming

* explain [exp_attributes] and [exp_extra] weirdness

* improve translcore [event_function*] naming

* inlined transl_body in transl_rhs

* rename pats_exp... to use "rhs" naming

* added test for guarded value/exception or-patterns

* address ocamldoc CRs

---------

Co-authored-by: Nick Roberts <nroberts02@gmail.com>
rajgodse added a commit that referenced this pull request Aug 18, 2023
Multiway match typechecking and translation for pattern guards (#2)

* multiway typechecking and translation

* update jane test output

* self-review: format and style in translcore

* more translcore/typedtree cleanup

* expose value `is_guarded_rhs`

* fix typedtree printer

* make discussed changes to ocamldoc

* format: remove unnecessary parens in pattern

* improve parmatch variable naming

* explain [exp_attributes] and [exp_extra] weirdness

* improve translcore [event_function*] naming

* inlined transl_body in transl_rhs

* rename pats_exp... to use "rhs" naming

* added test for guarded value/exception or-patterns

* address ocamldoc CRs

---------

Co-authored-by: Nick Roberts <nroberts02@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants