Skip to content

Make cont.new a constant expression#148

Open
tlively wants to merge 1 commit into
cont-new-testsfrom
cont-new-constant
Open

Make cont.new a constant expression#148
tlively wants to merge 1 commit into
cont-new-testsfrom
cont-new-constant

Conversation

@tlively
Copy link
Copy Markdown
Member

@tlively tlively commented May 11, 2026

Document this in Explainer.md, update the interpreter, and add tests. Remove a runtime type check during global allocation that incorrectly fails for globals holding continuations because continuations do not contain runtime type information.

Closes #145.

Document this in Explainer.md, update the interpreter, and add tests. Remove a runtime type check during global allocation that incorrectly fails for globals holding continuations because continuations do not contain runtime type information.

Closes #145.
@tlively tlively requested review from fgmccabe and rossberg May 11, 2026 17:11

let alloc (GlobalT (_mut, t) as ty) v =
assert Free.((val_type t).types = Set.empty);
if not (Match.match_val_type [] (type_of_value v) t) then raise Type;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There is a similar check in Table.store, which you'll also need to remove. (Would also be good to have tests for putting conts in tables.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sounds good. I'll do that in a separate PR if that's ok.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You mean the test? Sure, that's fine by me. I'd do the change here, though, to leave it in consistent state.

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