-
Notifications
You must be signed in to change notification settings - Fork 14
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
Conversation
82ca079
to
842cc21
Compare
Retroactive
|
@mliberman See https://github.com/thebrowsercompany/arc/pull/25526 . Swift is inconsistent here >.> |
@@ -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)); |
There was a problem hiding this comment.
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
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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",
WinRT enums are integers in disguise and projected as typealiases for C enums, so they are always Sendable.