Nested enum-payload patterns don't codegen #5

Closed
opened 2026-06-15 14:11:36 +02:00 by st · 0 comments
Owner

Repro

fn flatten(o: Option[Option[i64]]): i64 =
  match o with
  | Some(Some(x)) -> x
  | Some(None) -> 1 
  | None -> 2 
  end

fn main(): i64 = 
  flatten(Some(Some(42)))

Error: codegen: payload field access on non-enum (codegen.ml extract_bindings, ~798).

Single-level variant patterns work; nesting a variant pattern inside a payload does not.

Repro ``` fn flatten(o: Option[Option[i64]]): i64 = match o with | Some(Some(x)) -> x | Some(None) -> 1 | None -> 2 end fn main(): i64 = flatten(Some(Some(42))) ``` Error: codegen: payload field access on non-enum (codegen.ml extract_bindings, ~798). Single-level variant patterns work; nesting a variant pattern inside a payload does not.
st 2026-06-15 19:31:32 +02:00
  • closed this issue
  • added the
    bug
    label
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
st/amelie#5
No description provided.