Skip to content

Commit

Permalink
Allow for subtypes to be sendable
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaysharm committed Nov 13, 2024
1 parent ebe003a commit b44167b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CodeGen/Sources/LucidCodeGen/Meta/MetaSubtype.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ struct MetaSubtype {
let type = Type(identifier: subtype.typeID())
.with(accessLevel: .public)
.adding(inheritedType: .codable)
.adding(inheritedType: subtype.sendable ? .sendable : nil)
.adding(inheritedType: .hashable)

switch subtype.items {
Expand Down
2 changes: 2 additions & 0 deletions CodeGen/Sources/LucidCodeGenCore/Codable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,7 @@ extension Subtype: Codable {
case objc
case objcNoneCase
case platforms
case sendable
}

public init(from decoder: Decoder) throws {
Expand All @@ -765,6 +766,7 @@ extension Subtype: Codable {
name = try container.decode(String.self, forKey: .name)
manualImplementations = Set(try container.decodeIfPresent([`Protocol`].self, forKey: .manualImplementations) ?? [])
platforms = try container.decodeIfPresent(Set<Platform>.self, forKey: .platforms) ?? DescriptionDefaults.platforms
sendable = try container.decodeIfPresent(Bool.self, forKey: .sendable) ?? DescriptionDefaults.sendable

if let usedCases = try container.decodeIfPresent([String].self, forKey: .cases) {
let unusedCases = try container.decodeIfPresent([String].self, forKey: .unusedCases) ?? []
Expand Down
2 changes: 2 additions & 0 deletions CodeGen/Sources/LucidCodeGenCore/Descriptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,8 @@ public struct Subtype: Equatable {
public let objc: Bool

public let platforms: Set<Platform>

public let sendable: Bool
}

// MARK: - Conversions
Expand Down

0 comments on commit b44167b

Please sign in to comment.