Skip to content

Allow destruction in let bindings' pattern - #2117

Merged
voodoos merged 5 commits into
ocaml:mainfrom
panglesd:destruct-in-lets
Aug 18, 2026
Merged

Allow destruction in let bindings' pattern#2117
voodoos merged 5 commits into
ocaml:mainfrom
panglesd:destruct-in-lets

Conversation

@panglesd

Copy link
Copy Markdown
Contributor

Before, it was impossible to obliterate a pattern inside a let-binding (unless the let-binding was turned into a match internally of course)

type t = { a : int; b : int}
let v a b = { a; b }

(* Calling destruct on the _ below would fail *)
let _ : t = v 1 2

As far as I understand, there is no reason for this limitation, it was just not implemented. This PR fixes that.

@panglesd

Copy link
Copy Markdown
Contributor Author

Related to: #1162

@voodoos voodoos left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @panglesd, that's cool ! The changes are surprisingly contained, and feel reasonable.

@voodoos
voodoos merged commit d7ebf76 into ocaml:main Aug 18, 2026
8 of 10 checks passed
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