@@ -124,22 +124,6 @@ extension Attachment where AttachableValue: ~Copyable {
124124 }
125125}
126126
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-
143127/// A type-erased wrapper type that represents any attachable value.
144128///
145129/// This type is not generally visible to developers. It is used when posting
@@ -276,8 +260,12 @@ extension Attachment where AttachableValue: Sendable & ~Copyable {
276260 /// }
277261 @_documentation ( visibility: private)
278262 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
281269 Event . post ( . valueAttached( attachmentCopy) )
282270 }
283271
0 commit comments