You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Skip reason: non-executable spec sketch for Section 18.6 — Unreachable, Todo, Assert_matches (formerly 25.49); contains pseudo-code for unimplemented feature work
Implementation is required. This issue tracks replacing the skipped test with executable coverage and removing the //! skip: directive.
Acceptance criteria:
Implement the compiler/runtime/stdlib behavior required by this test, or split the spec sketch into concrete executable positive/negative tests.
Remove the //! skip: directive from test/spec/spec_ss18_6_unreachable_todo_assert_matches.w.
The test runs under make test and is not counted as skipped.
todo("...") — works (compiles; panics at runtime).
assert_matches(value, pattern) — not implemented (undefined variable). This needs a pattern-taking builtin (parser + Sema + lowering to a match + panic with the value's Debug repr), not a stdlib function, since the second argument is a pattern.
assert_eq / assert_ne — no generic versions exist; only type-suffixed helpers (assert_eq_i32, assert_eq_str, …) in lib/test/testing.w. The sketch uses the generic forms, so generic assert_eq/assert_ne (which print both values on failure, requiring Debug formatting) are still needed.
So the remaining work here is assert_matches + generic assert_eq/assert_ne.
Design addition (maintainer): regex form of assert_matches
In addition to structural pattern matching (assert_matches(value, Err(_))), assert_matches should support a regex string-matching form backed by the PCRE2 regex runtime (the migrated std.re.pcre2_* / rt/regex_runtime.wwith_regex_* surface) — i.e. assert that a string matches a regex pattern.
Implications:
Two forms to design/lower: structural (pattern-taking builtin: parser + Sema + lowering to a match + panic with the value's Debug repr) and regex (string + pattern → with_regex_* match, panic on no-match showing the subject and pattern).
Remaining for this issue overall: structural assert_matches, the new regex assert_matches form, and generic assert_eq/assert_ne (the sketch uses the generic forms; only type-suffixed helpers exist today in lib/test/testing.w). unreachable() and todo() already work.
Completed in commits 01aa1fd (assert_eq/assert_ne) and 1d22240 (assert_matches) on local main, pending push.
assert_eq / assert_ne: generic prelude assertions over Eq + Debug, showing both values on failure.
assert_matches(value, pattern): special-cased in the parser and desugared to match value { pattern => (), _ => assert_matches_failed() }, reusing existing match infrastructure (no new AST/Sema/MIR).
unreachable() / todo() already worked.
The skipped sketch test/spec/spec_ss18_6_unreachable_todo_assert_matches.w is now executable (5 tests), skip removed.
Note: the spec's nested example uses .Db(.NotFound(..)); the .. rest pattern in tuple variants is a separate pre-existing pattern-parser limitation, filed as #305 (explicit _, _ wildcards used meanwhile).
Verified: build + fixpoint + full test suite green.
Activity
ehartford commentedon May 30, 2026
Current scope (from work on #282):
unreachable()— works.todo("...")— works (compiles; panics at runtime).assert_matches(value, pattern)— not implemented (undefined variable). This needs a pattern-taking builtin (parser + Sema + lowering to a match + panic with the value's Debug repr), not a stdlib function, since the second argument is a pattern.assert_eq/assert_ne— no generic versions exist; only type-suffixed helpers (assert_eq_i32,assert_eq_str, …) inlib/test/testing.w. The sketch uses the generic forms, so genericassert_eq/assert_ne(which print both values on failure, requiring Debug formatting) are still needed.So the remaining work here is
assert_matches+ genericassert_eq/assert_ne.ehartford commentedon May 30, 2026
Design addition (maintainer): regex form of assert_matches
In addition to structural pattern matching (
assert_matches(value, Err(_))),assert_matchesshould support a regex string-matching form backed by the PCRE2 regex runtime (the migratedstd.re.pcre2_*/rt/regex_runtime.wwith_regex_*surface) — i.e. assert that a string matches a regex pattern.Implications:
with_regex_*match, panic on no-match showing the subject and pattern).assert_matchesdepend on the regex runtime being usable on every target, including the C backend. That emit-c regex gap is tracked in emit-c: prelude programs fail to compile — regex runtime functions used without extern declarations #300 — a regexassert_matchesin an emit-c program is blocked until emit-c: prelude programs fail to compile — regex runtime functions used without extern declarations #300 lands.Remaining for this issue overall: structural
assert_matches, the new regexassert_matchesform, and genericassert_eq/assert_ne(the sketch uses the generic forms; only type-suffixed helpers exist today inlib/test/testing.w).unreachable()andtodo()already work.Add generic assert_eq/assert_ne to the prelude
ehartford commentedon May 30, 2026
Completed in commits 01aa1fd (assert_eq/assert_ne) and 1d22240 (assert_matches) on local
main, pending push.assert_eq/assert_ne: generic prelude assertions overEq + Debug, showing both values on failure.assert_matches(value, pattern): special-cased in the parser and desugared tomatch value { pattern => (), _ => assert_matches_failed() }, reusing existing match infrastructure (no new AST/Sema/MIR).unreachable()/todo()already worked.The skipped sketch
test/spec/spec_ss18_6_unreachable_todo_assert_matches.wis now executable (5 tests), skip removed.Note: the spec's nested example uses
.Db(.NotFound(..)); the..rest pattern in tuple variants is a separate pre-existing pattern-parser limitation, filed as #305 (explicit_, _wildcards used meanwhile).Verified: build + fixpoint + full test suite green.
Implement assert_matches via parse-time desugar to a match
Add generic assert_eq/assert_ne to the prelude
Implement assert_matches via parse-time desugar to a match