Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark enums as Sendable #165

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion swiftwinrt/code_writers.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace swiftwinrt
}
w.write("}\n");

w.write("extension %: ^@retroactive Hashable, ^@retroactive Codable {}\n\n", get_full_swift_type_name(w, type));
w.write("extension %: ^@retroactive Hashable, ^@retroactive Codable, ^@retroactive Sendable {}\n\n", get_full_swift_type_name(w, type));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tristanlabelle i.e. I think this needs to be

Suggested change
w.write("extension %: ^@retroactive Hashable, ^@retroactive Codable, ^@retroactive Sendable {}\n\n", get_full_swift_type_name(w, type));
w.write("extension %: ^@retroactive Hashable, ^@retroactive Codable, ^@retroactive @unchecked Sendable {}\n\n", get_full_swift_type_name(w, type));
Comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes probably, will update. It's a bummer that Swift is inconsistent.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 it doesn't seem inconsistent to me, I think the error message is just poorly worded.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I think I get it but yeah the message is misleading because @retroactive allows the conformance to be in a different module, which seems like a superset of @unchecked which is described as allowing the conformance to be in a different file.

conformance to 'Sendable' must occur in the same source file as struct '__x_ABI_CArcCoreWinRT_CAdhocHistogramType'; use '@unchecked Sendable' for retroactive conformance; this is an error in the Swift 6 language mode",

}

static void write_guid_value(writer& w, std::vector<FixedArgSig> const& args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,5 +503,5 @@ extension test_component.CollectionChange {
CollectionChange_ItemChanged
}
}
extension test_component.CollectionChange: @retroactive Hashable, @retroactive Codable {}
extension test_component.CollectionChange: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ extension test_component.AsyncStatus {
__x_ABI_CWindows_CFoundation_CAsyncStatus_Started
}
}
extension test_component.AsyncStatus: @retroactive Hashable, @retroactive Codable {}
extension test_component.AsyncStatus: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.PropertyType {
public static var empty : test_component.PropertyType {
Expand Down Expand Up @@ -855,5 +855,5 @@ extension test_component.PropertyType {
__x_ABI_CWindows_CFoundation_CPropertyType_OtherTypeArray
}
}
extension test_component.PropertyType: @retroactive Hashable, @retroactive Codable {}
extension test_component.PropertyType: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ extension test_component.PhotoOrientation {
__x_ABI_CWindows_CStorage_CFileProperties_CPhotoOrientation_Rotate90
}
}
extension test_component.PhotoOrientation: @retroactive Hashable, @retroactive Codable {}
extension test_component.PhotoOrientation: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.PropertyPrefetchOptions {
public static var none : test_component.PropertyPrefetchOptions {
Expand All @@ -808,7 +808,7 @@ extension test_component.PropertyPrefetchOptions {
__x_ABI_CWindows_CStorage_CFileProperties_CPropertyPrefetchOptions_BasicProperties
}
}
extension test_component.PropertyPrefetchOptions: @retroactive Hashable, @retroactive Codable {}
extension test_component.PropertyPrefetchOptions: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.ThumbnailMode {
public static var picturesView : test_component.ThumbnailMode {
Expand All @@ -830,7 +830,7 @@ extension test_component.ThumbnailMode {
__x_ABI_CWindows_CStorage_CFileProperties_CThumbnailMode_SingleItem
}
}
extension test_component.ThumbnailMode: @retroactive Hashable, @retroactive Codable {}
extension test_component.ThumbnailMode: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.ThumbnailOptions {
public static var none : test_component.ThumbnailOptions {
Expand All @@ -846,7 +846,7 @@ extension test_component.ThumbnailOptions {
__x_ABI_CWindows_CStorage_CFileProperties_CThumbnailOptions_UseCurrentScale
}
}
extension test_component.ThumbnailOptions: @retroactive Hashable, @retroactive Codable {}
extension test_component.ThumbnailOptions: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.ThumbnailType {
public static var image : test_component.ThumbnailType {
Expand All @@ -856,7 +856,7 @@ extension test_component.ThumbnailType {
__x_ABI_CWindows_CStorage_CFileProperties_CThumbnailType_Icon
}
}
extension test_component.ThumbnailType: @retroactive Hashable, @retroactive Codable {}
extension test_component.ThumbnailType: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.VideoOrientation {
public static var normal : test_component.VideoOrientation {
Expand All @@ -872,5 +872,5 @@ extension test_component.VideoOrientation {
__x_ABI_CWindows_CStorage_CFileProperties_CVideoOrientation_Rotate270
}
}
extension test_component.VideoOrientation: @retroactive Hashable, @retroactive Codable {}
extension test_component.VideoOrientation: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ extension test_component.CommonFileQuery {
__x_ABI_CWindows_CStorage_CSearch_CCommonFileQuery_OrderByDate
}
}
extension test_component.CommonFileQuery: @retroactive Hashable, @retroactive Codable {}
extension test_component.CommonFileQuery: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.CommonFolderQuery {
public static var defaultQuery : test_component.CommonFolderQuery {
Expand Down Expand Up @@ -586,7 +586,7 @@ extension test_component.CommonFolderQuery {
__x_ABI_CWindows_CStorage_CSearch_CCommonFolderQuery_GroupByType
}
}
extension test_component.CommonFolderQuery: @retroactive Hashable, @retroactive Codable {}
extension test_component.CommonFolderQuery: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.DateStackOption {
public static var none : test_component.DateStackOption {
Expand All @@ -599,7 +599,7 @@ extension test_component.DateStackOption {
__x_ABI_CWindows_CStorage_CSearch_CDateStackOption_Month
}
}
extension test_component.DateStackOption: @retroactive Hashable, @retroactive Codable {}
extension test_component.DateStackOption: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.FolderDepth {
public static var shallow : test_component.FolderDepth {
Expand All @@ -609,7 +609,7 @@ extension test_component.FolderDepth {
__x_ABI_CWindows_CStorage_CSearch_CFolderDepth_Deep
}
}
extension test_component.FolderDepth: @retroactive Hashable, @retroactive Codable {}
extension test_component.FolderDepth: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.IndexedState {
public static var unknown : test_component.IndexedState {
Expand All @@ -625,7 +625,7 @@ extension test_component.IndexedState {
__x_ABI_CWindows_CStorage_CSearch_CIndexedState_FullyIndexed
}
}
extension test_component.IndexedState: @retroactive Hashable, @retroactive Codable {}
extension test_component.IndexedState: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.IndexerOption {
public static var useIndexerWhenAvailable : test_component.IndexerOption {
Expand All @@ -641,5 +641,5 @@ extension test_component.IndexerOption {
__x_ABI_CWindows_CStorage_CSearch_CIndexerOption_OnlyUseIndexerAndOptimizeForIndexedProperties
}
}
extension test_component.IndexerOption: @retroactive Hashable, @retroactive Codable {}
extension test_component.IndexerOption: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ extension test_component.InputStreamOptions {
__x_ABI_CWindows_CStorage_CStreams_CInputStreamOptions_ReadAhead
}
}
extension test_component.InputStreamOptions: @retroactive Hashable, @retroactive Codable {}
extension test_component.InputStreamOptions: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.UnicodeEncoding {
public static var utf8 : test_component.UnicodeEncoding {
Expand All @@ -297,5 +297,5 @@ extension test_component.UnicodeEncoding {
__x_ABI_CWindows_CStorage_CStreams_CUnicodeEncoding_Utf16BE
}
}
extension test_component.UnicodeEncoding: @retroactive Hashable, @retroactive Codable {}
extension test_component.UnicodeEncoding: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,7 @@ extension test_component.CreationCollisionOption {
__x_ABI_CWindows_CStorage_CCreationCollisionOption_OpenIfExists
}
}
extension test_component.CreationCollisionOption: @retroactive Hashable, @retroactive Codable {}
extension test_component.CreationCollisionOption: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.FileAccessMode {
public static var read : test_component.FileAccessMode {
Expand All @@ -1301,7 +1301,7 @@ extension test_component.FileAccessMode {
__x_ABI_CWindows_CStorage_CFileAccessMode_ReadWrite
}
}
extension test_component.FileAccessMode: @retroactive Hashable, @retroactive Codable {}
extension test_component.FileAccessMode: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.FileAttributes {
public static var normal : test_component.FileAttributes {
Expand All @@ -1323,7 +1323,7 @@ extension test_component.FileAttributes {
__x_ABI_CWindows_CStorage_CFileAttributes_LocallyIncomplete
}
}
extension test_component.FileAttributes: @retroactive Hashable, @retroactive Codable {}
extension test_component.FileAttributes: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.NameCollisionOption {
public static var generateUniqueName : test_component.NameCollisionOption {
Expand All @@ -1336,7 +1336,7 @@ extension test_component.NameCollisionOption {
__x_ABI_CWindows_CStorage_CNameCollisionOption_FailIfExists
}
}
extension test_component.NameCollisionOption: @retroactive Hashable, @retroactive Codable {}
extension test_component.NameCollisionOption: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.StorageDeleteOption {
public static var `default` : test_component.StorageDeleteOption {
Expand All @@ -1346,7 +1346,7 @@ extension test_component.StorageDeleteOption {
__x_ABI_CWindows_CStorage_CStorageDeleteOption_PermanentDelete
}
}
extension test_component.StorageDeleteOption: @retroactive Hashable, @retroactive Codable {}
extension test_component.StorageDeleteOption: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.StorageItemTypes {
public static var none : test_component.StorageItemTypes {
Expand All @@ -1359,7 +1359,7 @@ extension test_component.StorageItemTypes {
__x_ABI_CWindows_CStorage_CStorageItemTypes_Folder
}
}
extension test_component.StorageItemTypes: @retroactive Hashable, @retroactive Codable {}
extension test_component.StorageItemTypes: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.StorageLibraryChangeType {
public static var created : test_component.StorageLibraryChangeType {
Expand Down Expand Up @@ -1393,7 +1393,7 @@ extension test_component.StorageLibraryChangeType {
__x_ABI_CWindows_CStorage_CStorageLibraryChangeType_ChangeTrackingLost
}
}
extension test_component.StorageLibraryChangeType: @retroactive Hashable, @retroactive Codable {}
extension test_component.StorageLibraryChangeType: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.StorageOpenOptions {
public static var none : test_component.StorageOpenOptions {
Expand All @@ -1406,7 +1406,7 @@ extension test_component.StorageOpenOptions {
__x_ABI_CWindows_CStorage_CStorageOpenOptions_AllowReadersAndWriters
}
}
extension test_component.StorageOpenOptions: @retroactive Hashable, @retroactive Codable {}
extension test_component.StorageOpenOptions: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.StreamedFileFailureMode {
public static var failed : test_component.StreamedFileFailureMode {
Expand All @@ -1419,5 +1419,5 @@ extension test_component.StreamedFileFailureMode {
__x_ABI_CWindows_CStorage_CStreamedFileFailureMode_Incomplete
}
}
extension test_component.StreamedFileFailureMode: @retroactive Hashable, @retroactive Codable {}
extension test_component.StreamedFileFailureMode: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

Original file line number Diff line number Diff line change
Expand Up @@ -1982,7 +1982,7 @@ extension test_component.Fruit {
__x_ABI_Ctest__component_CFruit_Pineapple
}
}
extension test_component.Fruit: @retroactive Hashable, @retroactive Codable {}
extension test_component.Fruit: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.Keywords {
public static var `as` : test_component.Keywords {
Expand Down Expand Up @@ -2112,7 +2112,7 @@ extension test_component.Keywords {
__x_ABI_Ctest__component_CKeywords_While
}
}
extension test_component.Keywords: @retroactive Hashable, @retroactive Codable {}
extension test_component.Keywords: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.Signed {
public static var first : test_component.Signed {
Expand All @@ -2125,7 +2125,7 @@ extension test_component.Signed {
__x_ABI_Ctest__component_CSigned_Third
}
}
extension test_component.Signed: @retroactive Hashable, @retroactive Codable {}
extension test_component.Signed: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.SwiftifiableNames {
public static var camelCase : test_component.SwiftifiableNames {
Expand All @@ -2147,7 +2147,7 @@ extension test_component.SwiftifiableNames {
__x_ABI_Ctest__component_CSwiftifiableNames_UUID
}
}
extension test_component.SwiftifiableNames: @retroactive Hashable, @retroactive Codable {}
extension test_component.SwiftifiableNames: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

extension test_component.Unsigned {
public static var first : test_component.Unsigned {
Expand All @@ -2160,5 +2160,5 @@ extension test_component.Unsigned {
__x_ABI_Ctest__component_CUnsigned_Third
}
}
extension test_component.Unsigned: @retroactive Hashable, @retroactive Codable {}
extension test_component.Unsigned: @retroactive Hashable, @retroactive Codable, @retroactive Sendable {}

Loading