Files
swift-mirror/test/ClangImporter/Inputs/DoubleMainActor.h
Kavon Farvardin 64f6182cc7 prevent double @MainActor annotation in ClangImporter
This can lead to latent type errors for API users,
because a swiftmodule would otherwise be emitted,
without any diagnostics, containing imported decl
with two global actor annotations on it. Such
decls will always be an error to the typechecker
when its eventually encountered.

This patch drops all `@MainActor` annotations after
the first one in the ClangImporter, regardless of
whether its the safe or unsafe version, and emits
a warning when doing so.
2021-03-31 17:11:45 -07:00

18 lines
502 B
Objective-C

@import Foundation;
#pragma clang assume_nonnull begin
#define SWIFT_MAIN_ACTOR __attribute__((swift_attr("@MainActor")))
#define SWIFT_UI_ACTOR __attribute__((swift_attr("@UIActor")))
// NOTE: If you ever end up removing support for the "@UIActor" alias,
// just change both to be @MainActor and it won't change the purpose of
// this test.
SWIFT_UI_ACTOR SWIFT_MAIN_ACTOR @protocol DoubleMainActor
@required
- (NSString *)createSeaShanty:(NSInteger)number;
@end
#pragma clang assume_nonnull end