1+ // RUN: %empty-directory(%t)
2+ // RUN: %target-swift-frontend -typecheck -enable-library-evolution -enable-experimental-concurrency -emit-module-interface-path %t/Library.swiftinterface -module-name Library %s
3+ // RUN: %FileCheck --check-prefix CHECK-EXTENSION %s <%t/Library.swiftinterface
4+ // RUN: %FileCheck --check-prefix CHECK %s <%t/Library.swiftinterface
5+
6+ /// This test ensures that, when generating a swiftinterface file,
7+ /// the actor class decl itself is what may conform to the Actor protocol,
8+ /// and not via some extension. The requirement is due to the unique
9+ /// optimizations applied to the implementation of actors.
10+
11+ // CHECK-EXTENSION-NOT: extension {{.+}} : _Concurrency.Actor
12+
13+ // CHECK: actor public class PlainActorClass {
14+ public actor class PlainActorClass {
15+ @actorIndependent public func enqueue( partialTask: PartialAsyncTask ) { }
16+ }
17+
18+ // CHECK: actor public class ExplicitActorClass : _Concurrency.Actor {
19+ public actor class ExplicitActorClass : Actor {
20+ @actorIndependent public func enqueue( partialTask: PartialAsyncTask ) { }
21+ }
22+
23+ // CHECK: actor public class EmptyActorClass {
24+ public actor class EmptyActorClass { }
25+
26+ // CHECK: public protocol Cat : _Concurrency.Actor {
27+ public protocol Cat : Actor {
28+ func mew( )
29+ }
30+
31+ // CHECK: actor public class HouseCat : Library.Cat {
32+ public actor class HouseCat : Cat {
33+ @asyncHandler public func mew( ) { }
34+ @actorIndependent public func enqueue( partialTask: PartialAsyncTask ) { }
35+ }
36+
37+ // CHECK: public protocol ToothyMouth {
38+ public protocol ToothyMouth {
39+ func chew( )
40+ }
41+
42+ // CHECK: actor public class Lion : Library.ToothyMouth, _Concurrency.Actor {
43+ public actor class Lion : ToothyMouth , Actor {
44+ @asyncHandler public func chew( ) { }
45+ @actorIndependent public func enqueue( partialTask: PartialAsyncTask ) { }
46+ }
0 commit comments