File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
lib/Macros/Sources/SwiftMacros Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ extension DebugDescriptionMacro: MemberAttributeMacro {
59
59
let substring = " \( propertyName) __vg "
60
60
// Ex: "15description__vg"
61
61
let runlengthSubstring = " \( substring. count) \( substring) "
62
- guard !mangledName. contains ( runlengthSubstring) else {
62
+ guard !mangledName. hasSubstring ( runlengthSubstring) else {
63
63
return [ ]
64
64
}
65
65
@@ -366,7 +366,6 @@ extension DeclGroupSyntax {
366
366
// New types of decls are not presumed to be valid.
367
367
return nil
368
368
}
369
- return nil
370
369
}
371
370
}
372
371
@@ -485,3 +484,18 @@ extension Collection {
485
484
count == 1 ? first : nil
486
485
}
487
486
}
487
+
488
+ extension String {
489
+ fileprivate func hasSubstring( _ substring: String ) -> Bool {
490
+ if #available( macOS 13 , * ) {
491
+ return self . contains ( substring)
492
+ }
493
+
494
+ for index in self . indices {
495
+ if self . suffix ( from: index) . hasPrefix ( substring) {
496
+ return true
497
+ }
498
+ }
499
+ return false
500
+ }
501
+ }
You can’t perform that action at this time.
0 commit comments