Skip to content

Commit 6767774

Browse files
authored
[Debug] Remove temp workaround in DebugDescriptionMacro (#70746)
This workaround is no longer needed, as of #70435.
1 parent 48fba26 commit 6767774

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

lib/Macros/Sources/SwiftMacros/DebugDescriptionMacro.swift

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import SwiftSyntax
1414
import SwiftSyntaxMacros
1515
import SwiftDiagnostics
16-
import _StringProcessing // for String.contains(_:)
1716

1817
public enum DebugDescriptionMacro {}
1918
public enum _DebugDescriptionPropertyMacro {}
@@ -51,18 +50,6 @@ extension DebugDescriptionMacro: MemberAttributeMacro {
5150
return []
5251
}
5352

54-
// Expansion is performed multiple times. Exit early to avoid emitting duplicate macros,
55-
// which leads to duplicate symbol errors. To distinguish been invocations, inspect the
56-
// current mangled name. This ignores the invocation that adds a "__vg" suffix to the member
57-
// name, ex "description__vg". See https://github.com/apple/swift/pull/65559.
58-
let mangledName = context.makeUniqueName("").text
59-
let substring = "\(propertyName)__vg"
60-
// Ex: "15description__vg"
61-
let runlengthSubstring = "\(substring.count)\(substring)"
62-
guard !mangledName.hasSubstring(runlengthSubstring) else {
63-
return []
64-
}
65-
6653
var properties: [String: PatternBindingSyntax] = [:]
6754
for member in declaration.memberBlock.members {
6855
for binding in member.decl.as(VariableDeclSyntax.self)?.bindings ?? [] {
@@ -501,18 +488,3 @@ extension Collection {
501488
count == 1 ? first : nil
502489
}
503490
}
504-
505-
extension String {
506-
fileprivate func hasSubstring(_ substring: String) -> Bool {
507-
if #available(macOS 13, *) {
508-
return self.contains(substring)
509-
}
510-
511-
for index in self.indices {
512-
if self.suffix(from: index).hasPrefix(substring) {
513-
return true
514-
}
515-
}
516-
return false
517-
}
518-
}

0 commit comments

Comments
 (0)