Skip to content

Add (more) layout restrictions on unnamed values in the toplevel#2732

Merged
ccasin merged 5 commits intooxcaml:mainfrom
ccasin:toplevel-nonvalues
Jul 18, 2024
Merged

Add (more) layout restrictions on unnamed values in the toplevel#2732
ccasin merged 5 commits intooxcaml:mainfrom
ccasin:toplevel-nonvalues

Conversation

@ccasin
Copy link
Copy Markdown
Collaborator

@ccasin ccasin commented Jun 25, 2024

This bans some uses of non-values in the toplevel, particularly e;; and let _ = e;; when e's type does not have layout value. Those cases currently hit an exception in the middle end, and have for a while - as unboxed types become more widely used we should give a nicer error, at least.

There are a few ways to arrange for this - I'm not sure I've chosen the cleanest, but eventually we'll eliminate this restriction and this code will go away.

Review: @ncik-roberts perhaps?

@ccasin ccasin requested a review from ncik-roberts June 25, 2024 21:46
@ccasin
Copy link
Copy Markdown
Collaborator Author

ccasin commented Jun 25, 2024

Note this PR is conservative: We could allow these things in the bytecode toplevel but not in the nativecode toplevel. It doesn't seem worth the additional effort to thread that distinction to the right place, though, and in any event we expect these toplevels to behave similarly (there are tests for this).

@ccasin ccasin force-pushed the toplevel-nonvalues branch from e74a266 to 78bfd9c Compare June 25, 2024 21:52
@ccasin ccasin merged commit 46a9610 into oxcaml:main Jul 18, 2024
@ccasin ccasin deleted the toplevel-nonvalues branch October 4, 2024 15:22
lukemaurer pushed a commit that referenced this pull request Oct 23, 2024
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.

4 participants