@@ -124,22 +124,6 @@ extension Attachment where AttachableValue: ~Copyable {
124
124
}
125
125
}
126
126
127
- @_spi ( ForToolsIntegrationOnly)
128
- extension Attachment where AttachableValue == AnyAttachable {
129
- /// Create a type-erased attachment from an instance of ``Attachment``.
130
- ///
131
- /// - Parameters:
132
- /// - attachment: The attachment to type-erase.
133
- fileprivate init ( _ attachment: Attachment < some Attachable & Sendable & ~ Copyable> ) {
134
- self . init (
135
- storage: Storage ( AnyAttachable ( attachment) ) ,
136
- fileSystemPath: attachment. fileSystemPath,
137
- _preferredName: attachment. _preferredName,
138
- sourceLocation: attachment. sourceLocation
139
- )
140
- }
141
- }
142
-
143
127
/// A type-erased wrapper type that represents any attachable value.
144
128
///
145
129
/// This type is not generally visible to developers. It is used when posting
@@ -276,8 +260,12 @@ extension Attachment where AttachableValue: Sendable & ~Copyable {
276
260
/// }
277
261
@_documentation ( visibility: private)
278
262
public static func record( _ attachment: consuming Self , sourceLocation: SourceLocation = #_sourceLocation) {
279
- var attachmentCopy = Attachment < AnyAttachable > ( attachment)
280
- attachmentCopy. sourceLocation = sourceLocation
263
+ var attachmentCopy = Attachment < AnyAttachable > (
264
+ AnyAttachable ( copy attachment) ,
265
+ named: attachment. _preferredName,
266
+ sourceLocation: sourceLocation
267
+ )
268
+ attachmentCopy. fileSystemPath = attachment. fileSystemPath
281
269
Event . post ( . valueAttached( attachmentCopy) )
282
270
}
283
271
0 commit comments