Logic · rule
syntax.match_pattern
Expected a match pattern.
Area 3, Logic; not declinable; the next step is usually the agent's.
A match arm names a case's data in brackets, not braces:
type ReceiptId = Uuid {}type Label = Text {}type PaymentOutcome = Enum { pending paid: { receipt_id: ReceiptId }}function label(outcome: PaymentOutcome) -> Label { return match outcome { PaymentOutcome.pending -> "pending" PaymentOutcome.paid { receipt_id } -> "paid" }}
error: A match arm names a case's data in brackets --> main.jadpo:15:29 |15 | PaymentOutcome.paid { receipt_id } -> "paid" | ^^^^^^^^^^^^^^ expected `(name)` reason: An arm binds a case's data to one name, `PaymentOutcome.paid(paid)`, and reads its fields from it, as in `paid.field`. next: Write `PaymentOutcome.paid(paid)` (agent) rule: syntax.match_pattern help: https://jadpo.dev/docs/errors/syntax.match_patterncheck failed: 1 error, 1 file
The match examples below share a hidden file declaring
DeliveryState { pending, sent, failed },
PaymentOutcome { pending, paid: { receipt_id } } and Label = Text.
Markdown for agents: /docs/errors/syntax.match_pattern.md.Built from Jadpo main at a707efb.