Skip to content

Commit 5fc190d

Browse files
committed
Fix the same issue for captures in atomic groups
1 parent 6acea5c commit 5fc190d

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

Sources/_StringProcessing/ByteCodeGen.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ fileprivate extension Compiler.ByteCodeGen {
386386
builder.buildSave(intercept)
387387
try emitNode(child)
388388
builder.buildClearThrough(intercept)
389-
builder.buildFail()
389+
builder.buildFail(preservingCaptures: true) // Atomic group succeeds here
390390

391391
builder.label(intercept)
392392
builder.buildClear()

Tests/RegexTests/MatchTests.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,8 +1804,7 @@ extension RegexTests {
18041804
firstMatchTests(
18051805
#"(?>(\d+))\w+\1"#,
18061806
(input: "23x23", match: "23x23"),
1807-
(input: "123x23", match: "23x23"),
1808-
xfail: true)
1807+
(input: "123x23", match: "23x23"))
18091808

18101809
// Backreferences in scalar mode
18111810
// In scalar mode the backreference should not match

0 commit comments

Comments
 (0)