Skip to content

Commit ddacb65

Browse files
authored
Revert "Change type of userInfo to support `[CodingUserInfoKey: any Sendabl…" (#99)
This reverts commit 467084c.
1 parent da2900b commit ddacb65

File tree

3 files changed

+14
-32
lines changed

3 files changed

+14
-32
lines changed

Sources/SymbolKit/SymbolGraph/Relationship/Relationship.swift

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -148,20 +148,17 @@ extension SymbolGraph.Relationship {
148148
/// or decode that type and thus skips such entries. Note that ``Mixin``s that occur on relationships
149149
/// in the default symbol graph format do not have to be registered!
150150
///
151-
/// `UserInfoValue` is the type of the value in `JSONEncoder.userInfo`. This is generic to support both `Any` and
152-
/// `any Sendable` (rdar://145669600) and must be either of these two types.
153-
///
154151
/// - Parameter userInfo: A property which allows editing the `userInfo` member of the
155152
/// `Encoder`/`Decoder` protocol.
156153
/// - Parameter onEncodingError: Defines the behavior when an error occurs while encoding these types of ``Mixin``s.
157154
/// You can log warnings and either re-throw or consume the error.
158155
/// - Parameter onDecodingError: Defines the behavior when an error occurs while decoding these types of ``Mixin``s.
159156
/// Next to logging warnings, the function allows for either re-throwing the error,
160157
/// skipping the erroneous entry, or providing a default value.
161-
public static func register<M: Sequence, UserInfoValue>(mixins mixinTypes: M,
162-
to userInfo: inout [CodingUserInfoKey: UserInfoValue],
163-
onEncodingError: ((_ error: Error, _ mixin: Mixin) throws -> Void)?,
164-
onDecodingError: ((_ error: Error) throws -> Mixin?)?) where M.Element == Mixin.Type {
158+
public static func register<M: Sequence>(mixins mixinTypes: M,
159+
to userInfo: inout [CodingUserInfoKey: Any],
160+
onEncodingError: ((_ error: Error, _ mixin: Mixin) throws -> Void)?,
161+
onDecodingError: ((_ error: Error) throws -> Mixin?)?) where M.Element == Mixin.Type {
165162
var registeredMixins = userInfo[.relationshipMixinKey] as? [String: RelationshipMixinCodingInfo] ?? [:]
166163

167164
for type in mixinTypes {
@@ -175,11 +172,8 @@ extension SymbolGraph.Relationship {
175172

176173
registeredMixins[type.mixinKey] = info
177174
}
178-
179-
// FIXME: Remove the `UserInfoValue` generic parameter when we no longer need to build swift-docc-symbolkit in
180-
// a configuration that contains https://github.com/swiftlang/swift-foundation/pull/1169 but not
181-
// https://github.com/swiftlang/swift/pull/79382.
182-
userInfo[.relationshipMixinKey] = (registeredMixins as! UserInfoValue)
175+
176+
userInfo[.relationshipMixinKey] = registeredMixins
183177
}
184178
}
185179

Sources/SymbolKit/SymbolGraph/Symbol/KindIdentifier.swift

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -263,27 +263,21 @@ extension SymbolGraph.Symbol.KindIdentifier {
263263
///
264264
/// If a type is not registered, language prefixes cannot be removed correctly.
265265
///
266-
/// `UserInfoValue` is the type of the value in `JSONEncoder.userInfo`. This is generic to support both `Any` and
267-
/// `any Sendable` (rdar://145669600) and must be either of these two types.
268-
///
269266
/// - Note: Registering custom identifiers on your decoder is only necessary when working in an uncontrolled environment where
270267
/// other parts of your executable might be disturbed by your modifications to the symbol graph structure. If that is not the case, use
271268
/// ``SymbolGraph/Symbol/KindIdentifier/register(_:)``.
272269
///
273270
/// - Parameter userInfo: A property which allows editing the `userInfo` member of the
274271
/// `Decoder` protocol.
275-
public static func register<I: Sequence, UserInfoValue>(_ identifiers: I,
276-
to userInfo: inout [CodingUserInfoKey: UserInfoValue]) where I.Element == Self {
272+
public static func register<I: Sequence>(_ identifiers: I,
273+
to userInfo: inout [CodingUserInfoKey: Any]) where I.Element == Self {
277274
var registeredIdentifiers = userInfo[.symbolKindIdentifierKey] as? [String: SymbolGraph.Symbol.KindIdentifier] ?? [:]
278275

279276
for identifier in identifiers {
280277
registeredIdentifiers[identifier.identifier] = identifier
281278
}
282279

283-
// FIXME: Remove the `UserInfoValue` generic parameter when we no longer need to build swift-docc-symbolkit in
284-
// a configuration that contains https://github.com/swiftlang/swift-foundation/pull/1169 but not
285-
// https://github.com/swiftlang/swift/pull/79382.
286-
userInfo[.symbolKindIdentifierKey] = (registeredIdentifiers as! UserInfoValue)
280+
userInfo[.symbolKindIdentifierKey] = registeredIdentifiers
287281
}
288282
}
289283

Sources/SymbolKit/SymbolGraph/Symbol/Symbol.swift

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -302,20 +302,17 @@ extension SymbolGraph.Symbol {
302302
/// or decode that type and thus skips such entries. Note that ``Mixin``s that occur on symbols
303303
/// in the default symbol graph format do not have to be registered!
304304
///
305-
/// `UserInfoValue` is the type of the value in `JSONEncoder.userInfo`. This is generic to support both `Any` and
306-
/// `any Sendable` (rdar://145669600) and must be either of these two types.
307-
///
308305
/// - Parameter userInfo: A property which allows editing the `userInfo` member of the
309306
/// `Encoder`/`Decoder` protocol.
310307
/// - Parameter onEncodingError: Defines the behavior when an error occurs while encoding these types of ``Mixin``s.
311308
/// You can log warnings and either re-throw or consume the error.
312309
/// - Parameter onDecodingError: Defines the behavior when an error occurs while decoding these types of ``Mixin``s.
313310
/// Next to logging warnings, the function allows for either re-throwing the error,
314311
/// skipping the erroneous entry, or providing a default value.
315-
public static func register<M: Sequence, UserInfoValue>(mixins mixinTypes: M,
316-
to userInfo: inout [CodingUserInfoKey: UserInfoValue],
317-
onEncodingError: ((_ error: Error, _ mixin: Mixin) throws -> Void)?,
318-
onDecodingError: ((_ error: Error) throws -> Mixin?)?)
312+
public static func register<M: Sequence>(mixins mixinTypes: M,
313+
to userInfo: inout [CodingUserInfoKey: Any],
314+
onEncodingError: ((_ error: Error, _ mixin: Mixin) throws -> Void)?,
315+
onDecodingError: ((_ error: Error) throws -> Mixin?)?)
319316
where M.Element == Mixin.Type {
320317
var registeredMixins = userInfo[.symbolMixinKey] as? [String: SymbolMixinCodingInfo] ?? [:]
321318

@@ -331,10 +328,7 @@ extension SymbolGraph.Symbol {
331328
registeredMixins[type.mixinKey] = info
332329
}
333330

334-
// FIXME: Remove the `UserInfoValue` generic parameter when we no longer need to build swift-docc-symbolkit in
335-
// a configuration that contains https://github.com/swiftlang/swift-foundation/pull/1169 but not
336-
// https://github.com/swiftlang/swift/pull/79382.
337-
userInfo[.symbolMixinKey] = (registeredMixins as! UserInfoValue)
331+
userInfo[.symbolMixinKey] = registeredMixins
338332
}
339333
}
340334

0 commit comments

Comments
 (0)