Skip to content

Lower multi-field, nested-record, literal and binder patterns #85

Closed

Description

@biuld

Part of #75 (Phase 2). 41-46 passing files stop in pattern lowering. Measured first-failure forms, with representatives:

  1. Multi-field constructor patterns — Person name true -> name (passing/1185.purs). Single-field constructor patterns work; more than one field does not.
  2. Record patterns nested in a constructor pattern — f ( r@{ x } : _ ) = x + r.y (passing/2049.purs).
  3. Pattern bindings — patternNewtype = ... (passing/LetPattern.purs), and the DuplicateDeclarationsInLet2/3 and OverlappingBinders failing cases.
  4. Pattern binders — BindersInFunctions.purs, NegativeBinder.purs, TypedBinders.purs, ParensInTypedBinder.purs.
  5. Literal, array, and named patterns (passing/IntAndChar.purs, passing/NamedPatterns.purs, passing/Patterns.purs).
  6. Operator patterns — passing/ExtendedInfixOperators.purs, passing/MinusConstructor.purs.

Dependencies

Operator and constructor-operator aliases (see the declaration-alias slice) must land first for (6): infixr 6 Cons as : is a declaration our lowering rejects outright.

Pattern bindings and binders also unblock three M2 failing cases that currently report no diagnostic: DuplicateDeclarationsInLet2.purs, DuplicateDeclarationsInLet3.purs, OverlappingBinders.purs.

Note on the backend

PM-01..PM-13 are Verified and the CC/MIR rows are Partial — not because the decision compilation is weak, but because source-path coverage is narrow. Items 1 and 2 are the cases where "a multi-field constructor pattern" and "a record inside a constructor pattern" reach a coverage analysis that has only seen single-field patterns. Landing them is expected to surface backend work, which is Phase 5's input.

Acceptance

Every file in the measured pattern-lowering blocker list lowers; docs/implementation/backend/pattern-matching.md gains source-path evidence for multi-field and nested-record matrices.

Activity

  1. added
    gate:L2Blocks module, import, export and name resolution (D-04 L2)
    area:frontendFrontend: syntax, resolution, kinds, types, classes
    on Oct 1, 2026
  2. biuld commented on Oct 2, 2026

    @biuld
    OwnerAuthor

    Implemented and merged in PR #115.

    The final annotations-oracle scoreboards were rerun against the vendored v0.15.16 corpus. Compared with clean master 5298aad, P2 blockers fell from 61 to 5: all 34 fixed pattern blockers and 22 additional syntax/type/kind/declaration cases now pass P2. The source acceptance test covers 38 unique upstream files, including every named issue fixture. The five remaining P2 cases are outside the pattern target.

    Backend PM-15 now includes verified scalar, array, and named patterns, shared coverage/first-match compilation, array projection guards, and canonical UTF-8 String equality. Seven required Wasmtime source executions passed, including value-sensitive upstream-shaped 1185 (85) and 2049 (84) cases. PM-14 and the broader official runtime gates remain open.

    Validation passed: formatting, the full workspace with PSRS_REQUIRE_WASMTIME=1, warning-free clippy, all four official differential tests, all five ignored scoreboards, diff whitespace checks, and source-file line limits. Current measured gates: L1 904/908, L2 70/72, L3 29/48, L4 16/40, L5 45/89, L6 0/413. D-04 and frontend/backend acceptance records contain the evidence and remaining gaps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:frontendFrontend: syntax, resolution, kinds, types, classesenhancementNew feature or requestgate:L2Blocks module, import, export and name resolution (D-04 L2)

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions