Skip to content

Commit b7bfd16

Browse files
Merge pull request #526 from apple/remove-tilde-equals
Retract ~= for Regex.
2 parents b84f0bd + 0f1d185 commit b7bfd16

File tree

3 files changed

+0
-86
lines changed

3 files changed

+0
-86
lines changed

Sources/_StringProcessing/Regex/Match.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,3 @@ extension BidirectionalCollection where SubSequence == Substring {
177177
try? r.regex.prefixMatch(in: self[...])
178178
}
179179
}
180-
181-
@available(SwiftStdlib 5.7, *)
182-
extension RegexComponent {
183-
public static func ~=(regex: Self, input: String) -> Bool {
184-
input.wholeMatch(of: regex) != nil
185-
}
186-
187-
public static func ~=(regex: Self, input: Substring) -> Bool {
188-
input.wholeMatch(of: regex) != nil
189-
}
190-
}

Tests/RegexBuilderTests/AlgorithmsTests.swift

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -103,66 +103,6 @@ class RegexConsumerTests: XCTestCase {
103103
result: "9+16, 3, 10, 99+1")
104104
)
105105
}
106-
107-
func testSwitches() {
108-
// Failure cases
109-
do {
110-
switch "abcde" {
111-
case Regex {
112-
"a"
113-
ZeroOrMore(.any)
114-
"f"
115-
}:
116-
XCTFail()
117-
118-
case OneOrMore { CharacterClass.whitespace }:
119-
XCTFail()
120-
121-
case "abc":
122-
XCTFail()
123-
124-
case Regex {
125-
"a"
126-
"b"
127-
"c"
128-
}:
129-
XCTFail()
130-
131-
default:
132-
break
133-
}
134-
}
135-
// Success cases
136-
do {
137-
let input = "abcde"
138-
139-
switch input {
140-
case Regex {
141-
"a"
142-
ZeroOrMore(.any)
143-
"e"
144-
}:
145-
break
146-
147-
default:
148-
XCTFail()
149-
}
150-
151-
guard case Regex({
152-
"a"
153-
ZeroOrMore(.any)
154-
"e"
155-
}) = input else {
156-
XCTFail()
157-
return
158-
}
159-
160-
guard case OneOrMore(.word) = input else {
161-
XCTFail()
162-
return
163-
}
164-
}
165-
}
166106
}
167107

168108
class AlgorithmsResultBuilderTests: XCTestCase {

Tests/RegexTests/AlgorithmsTests.swift

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -516,19 +516,4 @@ class AlgorithmTests: XCTestCase {
516516
XCTAssertEqual("Café".replacing(emptyRegex, with: "-"), "-C-a-f-é-")
517517
XCTAssertEqual("Cafe\u{301}".replacing(emptyRegex, with: "-"), "-C-a-f-e-\u{301}-")
518518
}
519-
520-
func testSwitches() {
521-
switch "abcde" {
522-
case try! Regex("a.*f"):
523-
XCTFail()
524-
case try! Regex("abc"):
525-
XCTFail()
526-
527-
case try! Regex("a.*e"):
528-
break // success
529-
530-
default:
531-
XCTFail()
532-
}
533-
}
534519
}

0 commit comments

Comments
 (0)