Skip to content

Open standard library error rows - #10632

Merged
rtfeldman merged 1 commit into
mainfrom
issue-10490-open-stdlib-errors
Aug 6, 2026
Merged

Open standard library error rows#10632
rtfeldman merged 1 commit into
mainfrom
issue-10490-open-stdlib-errors

Conversation

@rtfeldman

Copy link
Copy Markdown
Contributor

Standard library functions currently return a mix of open and closed concrete error rows, which prevents independent failures such as Str.split_first and U16.from_str from composing through ?. This makes concrete Try return rows throughout Builtin.roc extensible, including internal low-level helpers so they specialize directly without retagging wrappers, and adds regression coverage for the reported composition failure.

This keeps the existing closed-row language semantics unchanged; unlike the experiment in #10366, the change is confined to the standard-library API and its implementation contracts.

Closes #10490.

@rtfeldman
rtfeldman marked this pull request as ready for review August 6, 2026 02:18
@rtfeldman
rtfeldman merged commit 0c221b1 into main Aug 6, 2026
21 checks passed
@rtfeldman
rtfeldman deleted the issue-10490-open-stdlib-errors branch August 6, 2026 02:18
@greptile-apps

greptile-apps Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR opens concrete standard-library Try error rows so independent failures can compose through ?, without changing closed-row language semantics.

  • Updates concrete error annotations across JSON, string, iterator, list, and numeric APIs and their internal helpers.
  • Adds a checker regression test composing Str.split_first with U16.from_str.
  • Updates the affected REPL diagnostic snapshot.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete correctness, compatibility, or security failures identified.

The changes consistently open composable concrete error rows, preserve intentionally closed internal contracts, and add direct regression coverage for the reported type-checking failure.

Important Files Changed

Filename Overview
src/build/roc/Builtin.roc Opens concrete Try error rows across standard-library APIs and corresponding helpers while retaining intentionally closed sentinel and capability contracts.
src/check/test/repros_test.zig Adds focused regression coverage proving two independent standard-library failures can compose through ? without type errors.
test/snapshots/repl/json_nominal_scalar_codec.md Updates the expected encode_f64 diagnostic type to display its newly open error row.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    A["Str.split_first(...)"] -->|NotFound| C["Open composed error row"]
    B["U16.from_str(...)"] -->|BadNumStr| C
    C --> D["Propagation through ?"]
    D --> E["Caller specializes the resulting Try row"]
Loading

Reviews (1): Last reviewed commit: "Open standard library error rows" | Re-trigger Greptile

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.

Standard library should use open unions for all errors

1 participant