@@ -47,9 +47,9 @@ struct DiagnosticTest : ExpressibleByStringLiteral, Hashable, CustomStringConver
47
47
48
48
var mappedToExpression : Self {
49
49
DiagnosticTest (
50
- message. _replacing ( " Predicate " , with: " Expression " ) . _replacing ( " predicate " , with: " expression " ) ,
50
+ message. replacing ( " Predicate " , with: " Expression " ) . replacing ( " predicate " , with: " expression " ) ,
51
51
fixIts: fixIts. map {
52
- FixItTest ( $0. message, result: $0. result. _replacing ( " #Predicate " , with: " #Expression " ) )
52
+ FixItTest ( $0. message, result: $0. result. replacing ( " #Predicate " , with: " #Expression " ) )
53
53
}
54
54
)
55
55
}
@@ -100,7 +100,7 @@ extension Diagnostic {
100
100
} else {
101
101
var result = " Message: \( debugDescription) \n Fix-Its: \n "
102
102
for fixIt in fixIts {
103
- result += " \t \( fixIt. message. message) \n \t \( fixIt. changes. first!. _result. _replacing ( " \n " , with: " \n \t " ) ) "
103
+ result += " \t \( fixIt. message. message) \n \t \( fixIt. changes. first!. _result. replacing ( " \n " , with: " \n \t " ) ) "
104
104
}
105
105
return result
106
106
}
@@ -114,7 +114,7 @@ extension DiagnosticTest {
114
114
} else {
115
115
var result = " Message: \( message) \n Fix-Its: \n "
116
116
for fixIt in fixIts {
117
- result += " \t \( fixIt. message) \n \t \( fixIt. result. _replacing ( " \n " , with: " \n \t " ) ) "
117
+ result += " \t \( fixIt. message) \n \t \( fixIt. result. replacing ( " \n " , with: " \n \t " ) ) "
118
118
}
119
119
return result
120
120
}
@@ -164,21 +164,9 @@ func AssertPredicateExpansion(_ source: String, _ result: String = "", diagnosti
164
164
)
165
165
AssertMacroExpansion (
166
166
macros: [ " Expression " : FoundationMacros . ExpressionMacro. self] ,
167
- source. _replacing ( " #Predicate " , with: " #Expression " ) ,
168
- result. _replacing ( " .Predicate " , with: " .Expression " ) ,
167
+ source. replacing ( " #Predicate " , with: " #Expression " ) ,
168
+ result. replacing ( " .Predicate " , with: " .Expression " ) ,
169
169
diagnostics: Set ( diagnostics. map ( \. mappedToExpression) ) ,
170
170
sourceLocation: sourceLocation
171
171
)
172
172
}
173
-
174
- extension String {
175
- func _replacing( _ text: String , with other: String ) -> Self {
176
- if #available( macOS 13 . 0 , * ) {
177
- // Use the stdlib API if available
178
- self . replacing ( text, with: other)
179
- } else {
180
- // Use the Foundation API on older OSes
181
- self . replacingOccurrences ( of: text, with: other, options: [ . literal] )
182
- }
183
- }
184
- }
0 commit comments