What happened
Perry's codegen aborts with a hard "not yet supported" message on any use of String.prototype.matchAll(regex):
perry-codegen Phase 2: expression StringMatchAll not yet supported
Surfaced compiling effect/src/internal/cause.ts (func 140) during the #309 compat sweep.
What you expected
MDN spec for String.prototype.matchAll: returns an iterator of all matches of a (global) regex against a string. Standard ES2020 surface, widely used.
Minimal reproduction
const text = "key=val&foo=bar&baz=qux";
const re = /([a-z]+)=([a-z]+)/g;
for (const m of text.matchAll(re)) {
console.log(m[1], "->", m[2]);
}
perry compile repro.ts -o /tmp/out
# fails with: perry-codegen Phase 2: expression StringMatchAll not yet supported
Likely fix site
The HIR variant Expr::StringMatchAll already exists (the error message comes from a missing codegen arm), so HIR lowering is done. Adding the codegen arm in crates/perry-codegen/src/expr.rs and a runtime helper in crates/perry-runtime/src/string.rs (or a regex-aware path) should be a contained change. Consider matching the iterator-protocol shape String.prototype.match with the global flag already produces (returns array, not iterator) — matchAll is the iterator version.
Environment
- Perry version: 0.5.405
- Host OS: macOS 26.4 (arm64)
- Target: native
- Effect version: 3.21.2 (where this surfaced)
Discovered as part of the #309 long tail.
What happened
Perry's codegen aborts with a hard "not yet supported" message on any use of
String.prototype.matchAll(regex):Surfaced compiling
effect/src/internal/cause.ts(func 140) during the #309 compat sweep.What you expected
MDN spec for String.prototype.matchAll: returns an iterator of all matches of a (global) regex against a string. Standard ES2020 surface, widely used.
Minimal reproduction
perry compile repro.ts -o /tmp/out # fails with: perry-codegen Phase 2: expression StringMatchAll not yet supportedLikely fix site
The HIR variant
Expr::StringMatchAllalready exists (the error message comes from a missing codegen arm), so HIR lowering is done. Adding the codegen arm incrates/perry-codegen/src/expr.rsand a runtime helper incrates/perry-runtime/src/string.rs(or a regex-aware path) should be a contained change. Consider matching the iterator-protocol shapeString.prototype.matchwith the global flag already produces (returns array, not iterator) —matchAllis the iterator version.Environment
Discovered as part of the #309 long tail.