Skip to content

Commit

Permalink
Generate agile classes as @unchecked Sendable
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlabelle committed Sep 4, 2024
1 parent 8b3bc8b commit e3c5c6e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Generator/Sources/SwiftWinRT/Writing/ClassDefinition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ internal func writeClassDefinition(_ classDefinition: ClassDefinition, projectio
protocolConformances.append(.identifier(try projection.toProtocolName(interfaceDefinition)))
}

if (try? classDefinition.findAttribute(MarshalingBehaviorAttribute.self))?.type == .agile {
// SwiftType cannot represent attributed types, so abuse the type name string.
protocolConformances.append(.identifier("@unchecked Sendable"))
}

try writer.writeClass(
documentation: projection.getDocumentationComment(classDefinition),
visibility: SwiftProjection.toVisibility(classDefinition.visibility, inheritableClass: !classDefinition.isSealed),
Expand Down

0 comments on commit e3c5c6e

Please sign in to comment.