8000 Void function arguments and returns by rtjoa · Pull Request #4088 · oxcaml/oxcaml · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Void function arguments and returns #4088

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

Merged
merged 4 commits into from
Jun 23, 2025
Merged

Conversation

rtjoa
Copy link
Contributor
@rtjoa rtjoa commented Jun 4, 2025

Supports void function arguments and returns. Also adds %unbox_unit to create values of layout void. We still gate void by -extension layouts_alpha.

Implementation

Through typechecking, void is represented as a distinct base sort (as before). In Lambda and Flambda2, terms of layout void are represented as nullary unboxed products, which Flambda was updated to handle in #4083. (Products containing void are products containing empty products, i.e. the tree structure is preserved rather than flattened.)

Testing

The runtime behavior test testsuite/tests/typing-layouts-void/void.ml is adapted from https://github.com/mshinwell/flambda-backend/blob/133dfea83b7eb87dabdb12d2f36bf3836a3dd4bc/up.ml.

Existing tests of void should suffice for typing.

Reviewing

Several errors change from

Error: Non-value layout void detected in [Typeopt.layout] as sort for type
       void_rec. Please report this error to the Jane Street compilers team.

to another "Please report this error to the Jane Street compiler team" error. These should all be fixed when we allow void in blocks, and should not be problematic because void is still in alpha with this PR.

Stack

Depends on:

Full dependency graph:

Support nullary
unboxed products ──> Void args/returns #4088 ──┐
in flambda #4083                               ├──> Void in blocks,
                                               │    move from alpha->stable
                     Delete lbl_pos #4086 ─────┘

@rtjoa rtjoa marked this pull request as ready for review June 4, 2025 17:45
@rtjoa rtjoa requested a review from ccasin June 4, 2025 17:54
@rtjoa rtjoa requested review from dkalinichenko-js and removed request for ccasin June 10, 2025 21:52
Base automatically changed from flambda-patches-for-void to main June 11, 2025 10:22
@rtjoa rtjoa force-pushed the rtjoa.void-args-returns branch 3 times, most recently from db9b4fe to 33820e2 Compare June 11, 2025 18:24
Copy link
Collaborator
@dkalinichenko-js dkalinichenko-js left a comment

Choose a reason for hiding this comment

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

Looks good overall, just needs a few more tests.

@rtjoa rtjoa force-pushed the rtjoa.void-args-returns branch from 33820e2 to a4ec045 Compare June 23, 2025 18:15
@rtjoa rtjoa requested a review from dkalinichenko-js June 23, 2025 18:17
@rtjoa
Copy link
Contributor Author
rtjoa commented Jun 23, 2025

@dkalinichenko-js thanks for the review! See responses to your comments and the two most recent commits (< 8000 tt>ef4e275, a4ec045). I also rebased but the conflicts were trivial.

@dkalinichenko-js dkalinichenko-js merged commit 9c1f699 into main Jun 23, 2025
31 checks passed
@dkalinichenko-js dkalinichenko-js deleted the rtjoa.void-args-returns branch June 23, 2025 19:47
mshinwell pushed a commit to mshinwell/oxcaml that referenced this pull request Jun 24, 2025
* Void arg/return and %unbox_unit

* Promote tests

* Disallow void in C stubs

* Add void product tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0