File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -642,7 +642,7 @@ SILValue SILGenFunction::emitLoadGlobalActorExecutor(Type globalActor) {
642
642
actorType->getTypeOfMember (SGM.SwiftModule , sharedInstanceDecl);
643
643
644
644
auto metaRepr =
645
- nominal->isResilient (SGM.SwiftModule , ResilienceExpansion::Maximal )
645
+ nominal->isResilient (SGM.SwiftModule , F. getResilienceExpansion () )
646
646
? MetatypeRepresentation::Thick
647
647
: MetatypeRepresentation::Thin;
648
648
Original file line number Diff line number Diff line change @@ -81,6 +81,10 @@ actor A {
81
81
// CHECK-NOT: ERROR
82
82
// CHECK: finished with return counter = 4
83
83
84
+ // CHECK: detached task not on main queue
85
+ // CHECK: on main queue again
86
+ // CHECK: detached task hopped back
87
+
84
88
@main struct RunIt {
85
89
static func main( ) async {
86
90
print ( " starting " )
@@ -91,5 +95,25 @@ actor A {
91
95
}
92
96
let result = await someFunc ( )
93
97
print ( " finished with return counter = \( result) " )
98
+
99
+ // Check actor hopping with MainActor.run.
100
+ let task = Task . detached {
101
+ if checkIfMainQueue ( expectedAnswer: false ) {
102
+ print ( " detached task not on main queue " )
103
+ } else {
104
+ print ( " ERROR: detached task is on the main queue? " )
105
+ }
106
+
107
+ _ = await MainActor . run {
108
+ checkAnotherFn ( 1 )
109
+ }
110
+
111
+ if checkIfMainQueue ( expectedAnswer: false ) {
112
+ print ( " detached task hopped back " )
113
+ } else {
114
+ print ( " ERROR: detached task is on the main queue? " )
115
+ }
116
+ }
117
+ _ = await task. value
94
118
}
95
119
}
You can’t perform that action at this time.
0 commit comments