Closed
Description
@send external matches: (t, @as(1) _) => array<string> = "slice"
This has the return type array<string>
, but it should likely be array<option<string>>
. Minimal repro:
let foo ="x"
let re = %re("/(y)?(z)?/")
switch foo->String.match(re) {
| Some(m) =>
let matches = m->RegExp.Result.matches
switch matches {
| [a, b] =>
Console.log2(a, b)
Console.log(matches)
}
}
Output:
undefined undefined
[null,null]
If array<string>
was correct, output should be ["", ""]. Replace Console.log2(a, b)
with the following for runtime breakage:
Console.log(a->String.length)
Metadata
Metadata
Assignees
Labels
No labels