Skip to content

Commit ca92db7

Browse files
committed
Further refactor to work around type checker regression
1 parent 083d32a commit ca92db7

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

Tests/RegexBuilderTests/RegexDSLTests.swift

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,17 +1100,25 @@ class RegexDSLTests: XCTestCase {
11001100
let _: (Substring, Substring, Int, Double?).Type
11011101
= type(of: regex3).RegexOutput.self
11021102

1103-
// FIXME: Remove explicit type when type checker regression is fixed
1103+
// FIXME: Remove explicit type and `subregex1` and `subregex2` when type checker regression is fixed
1104+
let subregex1: Regex<(Substring, Substring?)> = Regex {
1105+
ZeroOrMore(Capture("d"))
1106+
}
1107+
let subregex2: Regex<(
1108+
Substring, Substring, Substring, Substring?
1109+
)> = Regex {
1110+
Capture(OneOrMore("b"))
1111+
Capture(ZeroOrMore("c"))
1112+
subregex1
1113+
Optionally("e")
1114+
}
11041115
let regex4: Regex<(
11051116
Substring, Substring, Substring, Substring, Substring?
11061117
)> = Regex {
11071118
OneOrMore("a")
11081119
Capture {
11091120
OneOrMore {
1110-
Capture(OneOrMore("b"))
1111-
Capture(ZeroOrMore("c"))
1112-
ZeroOrMore(Capture("d"))
1113-
Optionally("e")
1121+
subregex2
11141122
}
11151123
}
11161124
}

0 commit comments

Comments
 (0)