Propagate break through destructuring alternative operator (#3592)
`break $label` is implemented as an error whose message is the label object, so the destructuring alternative operator (`?//`) caught it on backtracking and retried the next pattern instead of letting it reach its label. Detect break's control-flow error, unwrapping the wrapping added by `try`, and propagate it.
This commit is contained in:
1 parent
bf1da84499
commit
6c8be16e2b
2 files changed
+29
-9
No files matched your search
@@ -1086,6 +1086,14 @@ null
|
||||
[5]
|
||||
6
|
||||
|
||||
label $out | . as [$a] ?// $b | {$a, $b}, break $out
|
||||
[7]
|
||||
{"a":7,"b":null}
|
||||
|
||||
[first((. as [$a] ?// $b | {$a, $b})?)]
|
||||
[7]
|
||||
[{"a":7,"b":null}]
|
||||
|
||||
. as $dot|any($dot[];not)
|
||||
[1,2,3,4,true,false,1,2,3,4,5]
|
||||
true
|
||||
|
||||
Reference in new issue
Block a user