File tree 3 files changed +38
-2
lines changed 3 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -1712,8 +1712,10 @@ static bool isDefaultActorClass(const ClassMetadata *metadata) {
1712
1712
assert (metadata->isTypeMetadata ());
1713
1713
while (true ) {
1714
1714
// Trust the class descriptor if it says it's a default actor.
1715
- if (metadata->getDescription ()->isDefaultActor ())
1715
+ if (!metadata->isArtificialSubclass () &&
1716
+ metadata->getDescription ()->isDefaultActor ()) {
1716
1717
return true ;
1718
+ }
1717
1719
1718
1720
// Go to the superclass.
1719
1721
metadata = metadata->Superclass ;
Original file line number Diff line number Diff line change @@ -1775,7 +1775,8 @@ static bool isDefaultActorClass(const ClassMetadata *metadata) {
1775
1775
assert (metadata->isTypeMetadata ());
1776
1776
while (true ) {
1777
1777
// Trust the class descriptor if it says it's a default actor.
1778
- if (metadata->getDescription ()->isDefaultActor ()) {
1778
+ if (!metadata->isArtificialSubclass () &&
1779
+ metadata->getDescription ()->isDefaultActor ()) {
1779
1780
return true ;
1780
1781
}
1781
1782
Original file line number Diff line number Diff line change
1
+ // RUN: %target-run-simple-swift(-Xfrontend -disable-availability-checking -parse-as-library)
2
+
3
+ // REQUIRES: executable_test
4
+ // REQUIRES: concurrency
5
+ // REQUIRES: objc_interop
6
+
7
+ // UNSUPPORTED: back_deployment_runtime
8
+ // UNSUPPORTED: use_os_stdlib
9
+
10
+ // Make sure the concurrency runtime tolerates dynamically-subclassed actors.
11
+
12
+ import ObjectiveC
13
+
14
+ actor Foo : NSObject {
15
+ var x = 0
16
+
17
+ func doit( ) async {
18
+ x += 1
19
+ try ! await Task . sleep ( nanoseconds: 1000 )
20
+ x += 1
21
+ }
22
+ }
23
+
24
+ @main
25
+ enum Main {
26
+ static func main( ) async {
27
+ let FooSub = objc_allocateClassPair ( Foo . self, " FooSub " , 0 ) as! Foo . Type
28
+ objc_registerClassPair ( FooSub)
29
+ let foosub = FooSub . init ( )
30
+ await foosub. doit ( )
31
+ }
32
+ }
33
+
You can’t perform that action at this time.
0 commit comments