Skip to content

Support constructor closures - #2230

Merged
jhjourdan merged 2 commits into
masterfrom
ctor-fn
Aug 18, 2026
Merged

Support constructor closures#2230
jhjourdan merged 2 commits into
masterfrom
ctor-fn

Conversation

@Lysxia

@Lysxia Lysxia commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Close #2223

Generate a simplified body of the closure (directly call the continuation after asserting the expected invariant):

let c_Some [@coma:extspec] (x: a) (return (x: option_a) = {inv (Some x)} return {Some x}

Then reuse the pre- and post-conditions inferred by Coma (c_Some'pre, c_Some'post'return).

@jhjourdan
jhjourdan merged commit b51327d into master Aug 18, 2026
10 checks passed
@jhjourdan
jhjourdan deleted the ctor-fn branch August 18, 2026 19:27
@jhjourdan

Copy link
Copy Markdown
Collaborator

Out of curiosity, why did you not choose to synthesize the pre- and postconditions?

@Lysxia

Lysxia commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator Author

Looking for an excuse to use coma:extspec.

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.

Support using variant constructors as function values (e.g., .map(E::A))

2 participants