Skip to content

Commit 336f9c5

Browse files
authored
Merge pull request #643 from milseman/typechecker_workaround
Type checker workaround: adjust test
2 parents 1358fc0 + ca92db7 commit 336f9c5

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

Tests/RegexBuilderTests/RegexDSLTests.swift

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,15 +1099,26 @@ class RegexDSLTests: XCTestCase {
10991099
}
11001100
let _: (Substring, Substring, Int, Double?).Type
11011101
= type(of: regex3).RegexOutput.self
1102-
1103-
let regex4 = Regex {
1102+
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+
}
1115+
let regex4: Regex<(
1116+
Substring, Substring, Substring, Substring, Substring?
1117+
)> = Regex {
11041118
OneOrMore("a")
11051119
Capture {
11061120
OneOrMore {
1107-
Capture(OneOrMore("b"))
1108-
Capture(ZeroOrMore("c"))
1109-
ZeroOrMore(Capture("d"))
1110-
Optionally("e")
1121+
subregex2
11111122
}
11121123
}
11131124
}

0 commit comments

Comments
 (0)