File: transfernonsendable_closureliterals_isolationinference.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (740 lines) | stat: -rw-r--r-- 42,883 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
// RUN: %target-swift-frontend -emit-sil -parse-as-library -disable-availability-checking -swift-version 5 -strict-concurrency=complete %s -o - | %FileCheck %s
// RUN: %target-swift-frontend -emit-sil -parse-as-library -disable-availability-checking -swift-version 6 -verify %s -o /dev/null

// REQUIRES: concurrency
// REQUIRES: asserts

// This test validates the behavior of transfernonsendable around
// closure literals

////////////////////////
// MARK: Declarations //
////////////////////////

class NonSendableKlass {}

actor CustomActorInstance {}

@globalActor
struct CustomActor {
  static let shared = CustomActorInstance()
}

func normalAcceptsClosure(_ x: () -> ()) {}
func normalAcceptsSendingClosure(_ x: sending () -> ()) {}
func normalAcceptsSendableClosure(_ x: @Sendable () -> ()) {}

func inheritActorContextAcceptsClosure(@_inheritActorContext _ x: () -> ()) { }
func inheritActorContextAcceptsSendingClosure(@_inheritActorContext _ x: sending () -> ()) { }
func inheritActorContextAcceptsSendableClosure(@_inheritActorContext _ x: @Sendable () -> ()) { }

@MainActor
func normalGlobalActorAcceptsClosure(_ x: () -> ()) { }
@MainActor
func normalGlobalActorAcceptsSendingClosure(_ x: sending () -> ()) { }
@MainActor
func normalGlobalActorAcceptsSendableClosure(_ x: @Sendable () -> ()) { }

@MainActor
func inheritActorContextGlobalActorAcceptsClosure(@_inheritActorContext _ x: () -> ()) { }
@MainActor
func inheritActorContextGlobalActorAcceptsSendingClosure(@_inheritActorContext _ x: sending () -> ()) { }
@MainActor
func inheritActorContextGlobalActorAcceptsSendableClosure(@_inheritActorContext _ x: @Sendable () -> ()) { }

func normalAcceptsAsyncClosure(_ x: () async -> ()) {}
func normalAcceptsSendingAsyncClosure(_ x: sending () async -> ()) {}
func normalAcceptsSendableAsyncClosure(_ x: @Sendable () async -> ()) {}

func inheritActorContextAcceptsAsyncClosure(@_inheritActorContext _ x: () async -> ()) { }
func inheritActorContextAcceptsSendingAsyncClosure(@_inheritActorContext _ x: sending () async -> ()) { }
func inheritActorContextAcceptsSendableAsyncClosure(@_inheritActorContext _ x: @Sendable () async -> ()) { }

@MainActor
func normalGlobalActorAcceptsAsyncClosure(_ x: () async -> ()) { }
@MainActor
func normalGlobalActorAcceptsSendingAsyncClosure(_ x: sending () async -> ()) { }
@MainActor
func normalGlobalActorAcceptsSendableAsyncClosure(_ x: @Sendable () async -> ()) { }

@MainActor
func inheritActorContextGlobalActorAcceptsAsyncClosure(@_inheritActorContext _ x: () async -> ()) { }
@MainActor
func inheritActorContextGlobalActorAcceptsSendingAsyncClosure(@_inheritActorContext _ x: sending () async -> ()) { }
@MainActor
func inheritActorContextGlobalActorAcceptsSendableAsyncClosure(@_inheritActorContext _ x: @Sendable () async -> ()) { }

func asyncNormalAcceptsClosure(_ x: () -> ()) async {}
func asyncNormalAcceptsSendingClosure(_ x: sending () -> ()) async {}
func asyncNormalAcceptsSendableClosure(_ x: @Sendable () -> ()) async {}

func asyncInheritActorContextAcceptsClosure(@_inheritActorContext _ x: () -> ()) async {}
func asyncInheritActorContextAcceptsSendingClosure(@_inheritActorContext _ x: sending () -> ()) async {}
func asyncInheritActorContextAcceptsSendableClosure(@_inheritActorContext _ x: @Sendable () -> ()) async {}

@MainActor
func asyncNormalGlobalActorAcceptsClosure(_ x: () -> ()) async {}
@MainActor
func asyncNormalGlobalActorAcceptsSendingClosure(_ x: sending () -> ()) async {}
@MainActor
func asyncNormalGlobalActorAcceptsSendableClosure(_ x: @Sendable () -> ()) async {}

@MainActor
func asyncInheritActorContextGlobalActorAcceptsClosure(@_inheritActorContext _ x: () -> ()) async {}
@MainActor
func asyncInheritActorContextGlobalActorAcceptsSendingClosure(@_inheritActorContext _ x: sending () -> ()) async {}
@MainActor
func asyncInheritActorContextGlobalActorAcceptsSendableClosure(@_inheritActorContext _ x: @Sendable () -> ()) async {}

func asyncNormalAcceptsAsyncClosure(_ x: () async -> ()) async {}
func asyncNormalAcceptsSendingAsyncClosure(_ x: sending () async -> ()) async {}
func asyncNormalAcceptsSendableAsyncClosure(_ x: @Sendable () async -> ()) async {}

func asyncInheritActorContextAcceptsAsyncClosure(@_inheritActorContext _ x: () async -> ()) async {}
func asyncInheritActorContextAcceptsSendingAsyncClosure(@_inheritActorContext _ x: sending () async -> ()) async {}
func asyncInheritActorContextAcceptsSendableAsyncClosure(@_inheritActorContext _ x: @Sendable () async -> ()) async {}

@MainActor
func asyncNormalGlobalActorAcceptsAsyncClosure(_ x: () async -> ()) async {}
@MainActor
func asyncNormalGlobalActorAcceptsSendingAsyncClosure(_ x: sending () async -> ()) async {}
@MainActor
func asyncNormalGlobalActorAcceptsSendableAsyncClosure(_ x: @Sendable () async -> ()) async {}

@MainActor
func asyncInheritActorContextGlobalActorAcceptsAsyncClosure(@_inheritActorContext _ x: () async -> ()) async {}
@MainActor
func asyncInheritActorContextGlobalActorAcceptsSendingAsyncClosure(@_inheritActorContext _ x: sending () async -> ()) async {}
@MainActor
func asyncInheritActorContextGlobalActorAcceptsSendableAsyncClosure(@_inheritActorContext _ x: @Sendable () async -> ()) async {}

actor MyActor {}

@MainActor
var mainActorIsolatedValue = NonSendableKlass()

func useValue<T>(_ x: T) { }

//////////////////////////////////////////////////////
// MARK: Global Actor: Sync User Sync Closure Tests //
//////////////////////////////////////////////////////

@CustomActor
func test_CallerSyncNormal_CalleeSyncNonIsolated() async {
    // Just to help start our pattern matchin since the closure #$NUM line
    // appears in other parts of the file.
    // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference028test_CallerSyncNormal_CalleeF11NonIsolatedyyYaF'

    // CHECK-LABEL: closure #1 in test_CallerSyncNormal_CalleeSyncNonIsolated()
    // CHECK-NEXT: Isolation: global_actor. type: CustomActor
    normalAcceptsClosure { }

    // CHECK-LABEL: closure #2 in test_CallerSyncNormal_CalleeSyncNonIsolated()
    // CHECK-NEXT: Isolation: nonisolated
    normalAcceptsSendingClosure { }

    // CHECK-LABEL: // closure #3 in test_CallerSyncNormal_CalleeSyncNonIsolated()
    // CHECK-NEXT: // Isolation: nonisolated
    normalAcceptsSendableClosure { }
}

@CustomActor
func test_CallerSyncInheritsActorContext_CalleeSyncNonisolated() {
    // CHECK: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference042test_CallerSyncInheritsActorContext_CalleeF11NonisolatedyyF'

    // CHECK-LABEL: // closure #1 in test_CallerSyncInheritsActorContext_CalleeSyncNonisolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    inheritActorContextAcceptsClosure { }

    // This is a synchronous closure, so we error here.
    //
    // CHECK-LABEL: // closure #2 in test_CallerSyncInheritsActorContext_CalleeSyncNonisolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    inheritActorContextAcceptsSendingClosure { } // expected-error {{global actor 'CustomActor'-isolated value of type '() -> ()' passed as a strongly transferred parameter}}

    // CHECK-LABEL: // closure #3 in test_CallerSyncInheritsActorContext_CalleeSyncNonisolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    inheritActorContextAcceptsSendableClosure { }
}

@CustomActor
func test_CallerSyncNormal_CalleeSyncMainActorIsolated() async {
    // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference028test_CallerSyncNormal_CalleeF17MainActorIsolatedyyYaF'

    // CHECK-LABEL: // closure #1 in test_CallerSyncNormal_CalleeSyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await normalGlobalActorAcceptsClosure { } // expected-error {{sending global actor 'CustomActor'-isolated value of type '() -> ()' with later accesses to main actor-isolated context risks causing data races}}

    // CHECK-LABEL: // closure #2 in test_CallerSyncNormal_CalleeSyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: nonisolated
    await normalGlobalActorAcceptsSendingClosure { }

    // CHECK-LABEL: // closure #3 in test_CallerSyncNormal_CalleeSyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: nonisolated
    await normalGlobalActorAcceptsSendableClosure { }
}

@CustomActor
func test_CallerSyncInheritsActorContext_CalleeSyncMainActorIsolated() async {
    // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference042test_CallerSyncInheritsActorContext_Calleef4MainH8IsolatedyyYaF'

    // CHECK-LABEL: // closure #1 in test_CallerSyncInheritsActorContext_CalleeSyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await inheritActorContextGlobalActorAcceptsClosure { } // expected-error {{sending global actor 'CustomActor'-isolated value of type '() -> ()' with later accesses to main actor-isolated context risks causing data races}}

    // This is a synchronous closure, so we error here.
    //
    // CHECK-LABEL: // closure #2 in test_CallerSyncInheritsActorContext_CalleeSyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await inheritActorContextGlobalActorAcceptsSendingClosure { } // expected-error {{global actor 'CustomActor'-isolated value of type '() -> ()' passed as a strongly transferred parameter}}

    // CHECK-LABEL: // closure #3 in test_CallerSyncInheritsActorContext_CalleeSyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await inheritActorContextGlobalActorAcceptsSendableClosure { }
}

////////////////////////////////////////////////
// MARK: Global Actor Sync User Async Closure //
////////////////////////////////////////////////

@CustomActor
func test_CallerSyncNormal_CalleeAsyncNonIsolated() async {
    // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference44test_CallerSyncNormal_CalleeAsyncNonIsolatedyyYaF'
    // CHECK-LABEL: closure #1 in test_CallerSyncNormal_CalleeAsyncNonIsolated()
    // CHECK-NEXT: Isolation: global_actor. type: CustomActor
    normalAcceptsAsyncClosure { }

    // CHECK-LABEL: closure #2 in test_CallerSyncNormal_CalleeAsyncNonIsolated()
    // CHECK-NEXT: Isolation: nonisolated
    normalAcceptsSendingAsyncClosure { }

    // CHECK-LABEL: // closure #3 in test_CallerSyncNormal_CalleeAsyncNonIsolated()
    // CHECK-NEXT: // Isolation: nonisolated
    normalAcceptsSendableAsyncClosure { }
}

@CustomActor
func test_CallerSyncInheritsActorContext_CalleeAsyncNonisolated() {
    // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference58test_CallerSyncInheritsActorContext_CalleeAsyncNonisolatedyyF'

    // CHECK-LABEL: // closure #1 in test_CallerSyncInheritsActorContext_CalleeAsyncNonisolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    inheritActorContextAcceptsAsyncClosure { }

    // CHECK-LABEL: // closure #2 in test_CallerSyncInheritsActorContext_CalleeAsyncNonisolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    inheritActorContextAcceptsSendingAsyncClosure { }

    // CHECK-LABEL: // closure #3 in test_CallerSyncInheritsActorContext_CalleeAsyncNonisolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    inheritActorContextAcceptsSendableAsyncClosure { }
}

@CustomActor
func test_CallerSyncNormal_CalleeAsyncMainActorIsolated() async {
    // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference50test_CallerSyncNormal_CalleeAsyncMainActorIsolatedyyYaF'

    // CHECK-LABEL: // closure #1 in test_CallerSyncNormal_CalleeAsyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await normalGlobalActorAcceptsAsyncClosure { } // expected-error {{sending global actor 'CustomActor'-isolated value of type '() async -> ()' with later accesses to main actor-isolated context risks causing data races}}

    // CHECK-LABEL: // closure #2 in test_CallerSyncNormal_CalleeAsyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: nonisolated
    await normalGlobalActorAcceptsSendingAsyncClosure { }

    // CHECK-LABEL: // closure #3 in test_CallerSyncNormal_CalleeAsyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: nonisolated
    await normalGlobalActorAcceptsSendableAsyncClosure { }
}

@CustomActor
func test_CallerSyncInheritsActorContext_CalleeAsyncMainActorIsolated() async {
    // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference051test_CallerSyncInheritsActorContext_CalleeAsyncMainH8IsolatedyyYaF'

    // CHECK-LABEL: // closure #1 in test_CallerSyncInheritsActorContext_CalleeAsyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await inheritActorContextGlobalActorAcceptsAsyncClosure { }

    // CHECK-LABEL: // closure #2 in test_CallerSyncInheritsActorContext_CalleeAsyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await inheritActorContextGlobalActorAcceptsSendingAsyncClosure { }

    // CHECK-LABEL: // closure #3 in test_CallerSyncInheritsActorContext_CalleeAsyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await inheritActorContextGlobalActorAcceptsSendableAsyncClosure { }
}

//////////////////////////////////////////////////////
// MARK: Global Actor Async User Sync Closure Tests //
//////////////////////////////////////////////////////

@CustomActor
func test_CallerAsyncNormal_CalleeSyncNonIsolated() async {
    // Just to help start our pattern matchin since the closure #$NUM line
    // appears in other parts of the file.
    // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference44test_CallerAsyncNormal_CalleeSyncNonIsolatedyyYaF'

    // CHECK-LABEL: closure #1 in test_CallerAsyncNormal_CalleeSyncNonIsolated()
    // CHECK-NEXT: Isolation: global_actor. type: CustomActor
    await asyncNormalAcceptsClosure { } // expected-error {{sending global actor 'CustomActor'-isolated value of type '() -> ()' with later accesses to nonisolated context risks causing data races}}

    // CHECK-LABEL: closure #2 in test_CallerAsyncNormal_CalleeSyncNonIsolated()
    // CHECK-NEXT: Isolation: nonisolated
    await asyncNormalAcceptsSendingClosure { }

    // CHECK-LABEL: // closure #3 in test_CallerAsyncNormal_CalleeSyncNonIsolated()
    // CHECK-NEXT: // Isolation: nonisolated
    await asyncNormalAcceptsSendableClosure { }
}

@CustomActor
func test_CallerAsyncInheritsActorContext_CalleeSyncNonisolated() async {
    // CHECK: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference58test_CallerAsyncInheritsActorContext_CalleeSyncNonisolatedyyYaF'

    // CHECK-LABEL: // closure #1 in test_CallerAsyncInheritsActorContext_CalleeSyncNonisolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await asyncInheritActorContextAcceptsClosure { } // expected-error {{sending global actor 'CustomActor'-isolated value of type '() -> ()' with later accesses to nonisolated context risks causing data races}}

    // This is a synchronous closure, so we error here.
    //
    // CHECK-LABEL: // closure #2 in test_CallerAsyncInheritsActorContext_CalleeSyncNonisolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await asyncInheritActorContextAcceptsSendingClosure { } // expected-error {{global actor 'CustomActor'-isolated value of type '() -> ()' passed as a strongly transferred parameter}}

    // CHECK-LABEL: // closure #3 in test_CallerAsyncInheritsActorContext_CalleeSyncNonisolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await asyncInheritActorContextAcceptsSendableClosure { }
}

@CustomActor
func test_CallerAsyncNormal_CalleeSyncMainActorIsolated() async {
    // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference50test_CallerAsyncNormal_CalleeSyncMainActorIsolatedyyYaF'

    // CHECK-LABEL: // closure #1 in test_CallerAsyncNormal_CalleeSyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await asyncNormalGlobalActorAcceptsClosure { } // expected-error {{sending global actor 'CustomActor'-isolated value of type '() -> ()' with later accesses to main actor-isolated context risks causing data races}}

    // CHECK-LABEL: // closure #2 in test_CallerAsyncNormal_CalleeSyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: nonisolated
    await asyncNormalGlobalActorAcceptsSendingClosure { }

    // CHECK-LABEL: // closure #3 in test_CallerAsyncNormal_CalleeSyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: nonisolated
    await asyncNormalGlobalActorAcceptsSendableClosure { }
}

@CustomActor
func test_CallerAsyncInheritsActorContext_CalleeSyncMainActorIsolated() async {
    // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference051test_CallerAsyncInheritsActorContext_CalleeSyncMainH8IsolatedyyYaF'

    // CHECK-LABEL: // closure #1 in test_CallerAsyncInheritsActorContext_CalleeSyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await asyncInheritActorContextGlobalActorAcceptsClosure { } // expected-error {{sending global actor 'CustomActor'-isolated value of type '() -> ()' with later accesses to main actor-isolated context risks causing data races}}

    // This is a synchronous closure, so we error here.
    //
    // CHECK-LABEL: // closure #2 in test_CallerAsyncInheritsActorContext_CalleeSyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await asyncInheritActorContextGlobalActorAcceptsSendingClosure { } // expected-error {{global actor 'CustomActor'-isolated value of type '() -> ()' passed as a strongly transferred parameter}}

    // CHECK-LABEL: // closure #3 in test_CallerAsyncInheritsActorContext_CalleeSyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await asyncInheritActorContextGlobalActorAcceptsSendableClosure { }
}

/////////////////////////////////////////////////
// MARK: Global Actor Async User Async Closure //
/////////////////////////////////////////////////

@CustomActor
func test_CallerAsyncNormal_CalleeAsyncNonIsolated() async {
    // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference029test_CallerAsyncNormal_CalleeF11NonIsolatedyyYaF'

    // CHECK-LABEL: closure #1 in test_CallerAsyncNormal_CalleeAsyncNonIsolated()
    // CHECK-NEXT: Isolation: global_actor. type: CustomActor
    await asyncNormalAcceptsAsyncClosure { } // expected-error {{sending global actor 'CustomActor'-isolated value of type '() async -> ()' with later accesses to nonisolated context risks causing data races}}

    // CHECK-LABEL: closure #2 in test_CallerAsyncNormal_CalleeAsyncNonIsolated()
    // CHECK-NEXT: Isolation: nonisolated
    await asyncNormalAcceptsSendingAsyncClosure { }

    // CHECK-LABEL: // closure #3 in test_CallerAsyncNormal_CalleeAsyncNonIsolated()
    // CHECK-NEXT: // Isolation: nonisolated
    await asyncNormalAcceptsSendableAsyncClosure { }
}

@CustomActor
func test_CallerAsyncInheritsActorContext_CalleeAsyncNonisolated() async {
    // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference043test_CallerAsyncInheritsActorContext_CalleeF11NonisolatedyyYaF'

    // CHECK-LABEL: // closure #1 in test_CallerAsyncInheritsActorContext_CalleeAsyncNonisolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await asyncInheritActorContextAcceptsAsyncClosure { }

    // CHECK-LABEL: // closure #2 in test_CallerAsyncInheritsActorContext_CalleeAsyncNonisolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await asyncInheritActorContextAcceptsSendingAsyncClosure { }

    // CHECK-LABEL: // closure #3 in test_CallerAsyncInheritsActorContext_CalleeAsyncNonisolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await asyncInheritActorContextAcceptsSendingAsyncClosure { @CustomActor in }

    // CHECK-LABEL: // closure #4 in test_CallerAsyncInheritsActorContext_CalleeAsyncNonisolated()
    // CHECK-NEXT: // Isolation: global_actor. type: MainActor
    await asyncInheritActorContextAcceptsSendingAsyncClosure { @MainActor in }

    // CHECK-LABEL: // closure #5 in test_CallerAsyncInheritsActorContext_CalleeAsyncNonisolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await asyncInheritActorContextAcceptsSendableAsyncClosure { }
}

@CustomActor
func test_CallerAsyncNormal_CalleeAsyncMainActorIsolated() async {
    // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference029test_CallerAsyncNormal_CalleeF17MainActorIsolatedyyYaF'

    // CHECK-LABEL: // closure #1 in test_CallerAsyncNormal_CalleeAsyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await asyncNormalGlobalActorAcceptsAsyncClosure { } // expected-error {{sending global actor 'CustomActor'-isolated value of type '() async -> ()' with later accesses to main actor-isolated context risks causing data races}}

    // CHECK-LABEL: // closure #2 in test_CallerAsyncNormal_CalleeAsyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: nonisolated
    await asyncNormalGlobalActorAcceptsSendingAsyncClosure { }

    // CHECK-LABEL: // closure #3 in test_CallerAsyncNormal_CalleeAsyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: nonisolated
    await asyncNormalGlobalActorAcceptsSendableAsyncClosure { }
}

@CustomActor
func test_CallerAsyncInheritsActorContext_CalleeAsyncMainActorIsolated() async {
    // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference043test_CallerAsyncInheritsActorContext_Calleef4MainH8IsolatedyyYaF'

    // CHECK-LABEL: // closure #1 in test_CallerAsyncInheritsActorContext_CalleeAsyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await asyncInheritActorContextGlobalActorAcceptsAsyncClosure { }

    // CHECK-LABEL: // closure #2 in test_CallerAsyncInheritsActorContext_CalleeAsyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await asyncInheritActorContextGlobalActorAcceptsSendingAsyncClosure { }

    // CHECK-LABEL: // closure #3 in test_CallerAsyncInheritsActorContext_CalleeAsyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await asyncInheritActorContextGlobalActorAcceptsSendingAsyncClosure { @CustomActor in }

    // CHECK-LABEL: // closure #4 in test_CallerAsyncInheritsActorContext_CalleeAsyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: global_actor. type: MainActor
    await asyncInheritActorContextGlobalActorAcceptsSendingAsyncClosure { @MainActor in }

    // CHECK-LABEL: // closure #5 in test_CallerAsyncInheritsActorContext_CalleeAsyncMainActorIsolated()
    // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
    await asyncInheritActorContextGlobalActorAcceptsSendableAsyncClosure { }
}

////////////////////////////////////////////////////////
// MARK: Actor Instance: Sync User Sync Closure Tests //
////////////////////////////////////////////////////////

extension MyActor {
    func test_CallerSyncNormal_CalleeSyncNonIsolated() async {
        // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference7MyActorC028test_CallerSyncNormal_CalleeH11NonIsolatedyyYaF'

        // CHECK-LABEL: closure #1 in MyActor.test_CallerSyncNormal_CalleeSyncNonIsolated()
        // CHECK-NEXT: Isolation: actor_instance. name: 'self'
        normalAcceptsClosure { print(self) }

        // CHECK-LABEL: closure #2 in MyActor.test_CallerSyncNormal_CalleeSyncNonIsolated()
        // CHECK-NEXT: Isolation: nonisolated
        normalAcceptsSendingClosure { print(self) }

        // CHECK-LABEL: // closure #3 in MyActor.test_CallerSyncNormal_CalleeSyncNonIsolated()
        // CHECK-NEXT: // Isolation: nonisolated
        normalAcceptsSendableClosure { print(self) }
    }

    func test_CallerSyncInheritsActorContext_CalleeSyncNonisolated() {
        // CHECK: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference7MyActorC023test_CallerSyncInheritse14Context_CalleeH11NonisolatedyyF'

        // CHECK-LABEL: // closure #1 in MyActor.test_CallerSyncInheritsActorContext_CalleeSyncNonisolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        inheritActorContextAcceptsClosure { print(self) }

        // This is a synchronous closure, so we error here.
        //
        // CHECK-LABEL: // closure #2 in MyActor.test_CallerSyncInheritsActorContext_CalleeSyncNonisolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        inheritActorContextAcceptsSendingClosure { print(self) } // expected-error {{'self'-isolated value of type '() -> ()' passed as a strongly transferred parameter}}

        // CHECK-LABEL: // closure #3 in MyActor.test_CallerSyncInheritsActorContext_CalleeSyncNonisolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        inheritActorContextAcceptsSendableClosure { print(self) }
    }

    func test_CallerSyncNormal_CalleeSyncMainActorIsolated() async {
        // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference7MyActorC028test_CallerSyncNormal_Calleeh4MainE8IsolatedyyYaF'

        // CHECK-LABEL: // closure #1 in MyActor.test_CallerSyncNormal_CalleeSyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        await normalGlobalActorAcceptsClosure { print(self) } // expected-error {{sending 'self'-isolated value of type '() -> ()' with later accesses to main actor-isolated context risks causing data races}}

        // CHECK-LABEL: // closure #2 in MyActor.test_CallerSyncNormal_CalleeSyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: nonisolated
        await normalGlobalActorAcceptsSendingClosure { print(self) }

        // CHECK-LABEL: // closure #3 in MyActor.test_CallerSyncNormal_CalleeSyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: nonisolated
        await normalGlobalActorAcceptsSendableClosure { print(self) }
    }

    func test_CallerSyncInheritsActorContext_CalleeSyncMainActorIsolated() async {
        // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference7MyActorC023test_CallerSyncInheritse14Context_Calleeh4MainE8IsolatedyyYaF'

        // CHECK-LABEL: // closure #1 in MyActor.test_CallerSyncInheritsActorContext_CalleeSyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        await inheritActorContextGlobalActorAcceptsClosure { print(self) } // expected-error {{sending 'self'-isolated value of type '() -> ()' with later accesses to main actor-isolated context risks causing data races}}

        // This is a synchronous closure, so we error here.
        //
        // CHECK-LABEL: // closure #2 in MyActor.test_CallerSyncInheritsActorContext_CalleeSyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        await inheritActorContextGlobalActorAcceptsSendingClosure { print(self) } // expected-error {{'self'-isolated value of type '() -> ()' passed as a strongly transferred parameter}}

        // CHECK-LABEL: // closure #3 in MyActor.test_CallerSyncInheritsActorContext_CalleeSyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        await inheritActorContextGlobalActorAcceptsSendableClosure { print(self) }
    }
}

//////////////////////////////////////////////////
// MARK: Actor Instance Sync User Async Closure //
//////////////////////////////////////////////////

extension MyActor {

    func test_CallerSyncNormal_CalleeAsyncNonIsolated() async {
        // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference7MyActorC44test_CallerSyncNormal_CalleeAsyncNonIsolatedyyYaF'

        // CHECK-LABEL: closure #1 in MyActor.test_CallerSyncNormal_CalleeAsyncNonIsolated()
        // CHECK-NEXT: Isolation: actor_instance. name: 'self'
        normalAcceptsAsyncClosure { print(self) }

        // CHECK-LABEL: closure #2 in MyActor.test_CallerSyncNormal_CalleeAsyncNonIsolated()
        // CHECK-NEXT: Isolation: nonisolated
        normalAcceptsSendingAsyncClosure { print(self) }

        // CHECK-LABEL: // closure #3 in MyActor.test_CallerSyncNormal_CalleeAsyncNonIsolated()
        // CHECK-NEXT: // Isolation: nonisolated
        normalAcceptsSendableAsyncClosure { print(self) }
    }

    func test_CallerSyncInheritsActorContext_CalleeAsyncNonisolated() {
        // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference7MyActorC023test_CallerSyncInheritsE30Context_CalleeAsyncNonisolatedyyF'

        // CHECK-LABEL: // closure #1 in MyActor.test_CallerSyncInheritsActorContext_CalleeAsyncNonisolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        inheritActorContextAcceptsAsyncClosure { print(self) }

        // CHECK-LABEL: // closure #2 in MyActor.test_CallerSyncInheritsActorContext_CalleeAsyncNonisolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        inheritActorContextAcceptsSendingAsyncClosure { print(self) }

        // CHECK-LABEL: // closure #3 in MyActor.test_CallerSyncInheritsActorContext_CalleeAsyncNonisolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        inheritActorContextAcceptsSendableAsyncClosure { print(self) }
    }

    func test_CallerSyncNormal_CalleeAsyncMainActorIsolated() async {
        // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference7MyActorC037test_CallerSyncNormal_CalleeAsyncMainE8IsolatedyyYaF'

        // CHECK-LABEL: // closure #1 in MyActor.test_CallerSyncNormal_CalleeAsyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        await normalGlobalActorAcceptsAsyncClosure { print(self) } // expected-error {{sending 'self'-isolated value of type '() async -> ()' with later accesses to main actor-isolated context risks causing data races}}

        // CHECK-LABEL: // closure #2 in MyActor.test_CallerSyncNormal_CalleeAsyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: nonisolated
        await normalGlobalActorAcceptsSendingAsyncClosure { print(self) }

        // CHECK-LABEL: // closure #3 in MyActor.test_CallerSyncNormal_CalleeAsyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: nonisolated
        await normalGlobalActorAcceptsSendableAsyncClosure { print(self) }
    }

    func test_CallerSyncInheritsActorContext_CalleeAsyncMainActorIsolated() async {
        // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference7MyActorC023test_CallerSyncInheritse23Context_CalleeAsyncMainE8IsolatedyyYaF'

        // CHECK-LABEL: // closure #1 in MyActor.test_CallerSyncInheritsActorContext_CalleeAsyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        await inheritActorContextGlobalActorAcceptsAsyncClosure { print(self) }

        // CHECK-LABEL: // closure #2 in MyActor.test_CallerSyncInheritsActorContext_CalleeAsyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        await inheritActorContextGlobalActorAcceptsSendingAsyncClosure { print(self) }

        // CHECK-LABEL: // closure #3 in MyActor.test_CallerSyncInheritsActorContext_CalleeAsyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        await inheritActorContextGlobalActorAcceptsSendableAsyncClosure { print(self) }
    }
}

////////////////////////////////////////////////////////
// MARK: Actor Instance Async User Sync Closure Tests //
////////////////////////////////////////////////////////

extension MyActor {

    func test_CallerAsyncNormal_CalleeSyncNonIsolated() async {
        // Just to help start our pattern matchin since the closure #$NUM line
        // appears in other parts of the file.
        // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference7MyActorC44test_CallerAsyncNormal_CalleeSyncNonIsolatedyyYaF'

        // CHECK-LABEL: closure #1 in MyActor.test_CallerAsyncNormal_CalleeSyncNonIsolated()
        // CHECK-NEXT: Isolation: actor_instance. name: 'self'
        await asyncNormalAcceptsClosure { print(self) } // expected-error {{sending 'self'-isolated value of type '() -> ()' with later accesses to nonisolated context risks causing data races}}

        // CHECK-LABEL: closure #2 in MyActor.test_CallerAsyncNormal_CalleeSyncNonIsolated()
        // CHECK-NEXT: Isolation: nonisolated
        await asyncNormalAcceptsSendingClosure { print(self) }

        // CHECK-LABEL: // closure #3 in MyActor.test_CallerAsyncNormal_CalleeSyncNonIsolated()
        // CHECK-NEXT: // Isolation: nonisolated
        await asyncNormalAcceptsSendableClosure { print(self) }
    }

    func test_CallerAsyncInheritsActorContext_CalleeSyncNonisolated() async {
        // CHECK: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference7MyActorC024test_CallerAsyncInheritsE29Context_CalleeSyncNonisolatedyyYaF'

        // CHECK-LABEL: // closure #1 in MyActor.test_CallerAsyncInheritsActorContext_CalleeSyncNonisolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        await asyncInheritActorContextAcceptsClosure { print(self) } // expected-error {{sending 'self'-isolated value of type '() -> ()' with later accesses to nonisolated context risks causing data races}}

        // This is a synchronous closure, so we error here.
        //
        // CHECK-LABEL: // closure #2 in MyActor.test_CallerAsyncInheritsActorContext_CalleeSyncNonisolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        await asyncInheritActorContextAcceptsSendingClosure { print(self) } // expected-error {{'self'-isolated value of type '() -> ()' passed as a strongly transferred parameter}}

        // CHECK-LABEL: // closure #3 in MyActor.test_CallerAsyncInheritsActorContext_CalleeSyncNonisolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        await asyncInheritActorContextAcceptsSendableClosure { print(self) }
    }

    func test_CallerAsyncNormal_CalleeSyncMainActorIsolated() async {
        // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference7MyActorC037test_CallerAsyncNormal_CalleeSyncMainE8IsolatedyyYaF'

        // CHECK-LABEL: // closure #1 in MyActor.test_CallerAsyncNormal_CalleeSyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        await asyncNormalGlobalActorAcceptsClosure { print(self) } // expected-error {{sending 'self'-isolated value of type '() -> ()' with later accesses to main actor-isolated context risks causing data races}}

        // CHECK-LABEL: // closure #2 in MyActor.test_CallerAsyncNormal_CalleeSyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: nonisolated
        await asyncNormalGlobalActorAcceptsSendingClosure { print(self) }

        // CHECK-LABEL: // closure #3 in MyActor.test_CallerAsyncNormal_CalleeSyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: nonisolated
        await asyncNormalGlobalActorAcceptsSendableClosure { print(self) }
    }

    func test_CallerAsyncInheritsActorContext_CalleeSyncMainActorIsolated() async {
        // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference7MyActorC024test_CallerAsyncInheritse22Context_CalleeSyncMainE8IsolatedyyYaF'

        // CHECK-LABEL: // closure #1 in MyActor.test_CallerAsyncInheritsActorContext_CalleeSyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        await asyncInheritActorContextGlobalActorAcceptsClosure { print(self) } // expected-error {{sending 'self'-isolated value of type '() -> ()' with later accesses to main actor-isolated context risks causing data races}}

        // This is a synchronous function, so we error.
        //
        // CHECK-LABEL: // closure #2 in MyActor.test_CallerAsyncInheritsActorContext_CalleeSyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        await asyncInheritActorContextGlobalActorAcceptsSendingClosure { print(self) } // expected-error {{'self'-isolated value of type '() -> ()' passed as a strongly transferred parameter}}

        // CHECK-LABEL: // closure #3 in MyActor.test_CallerAsyncInheritsActorContext_CalleeSyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        await asyncInheritActorContextGlobalActorAcceptsSendableClosure { print(self) }
    }
}

///////////////////////////////////////////////////
// MARK: Actor Instance Async User Async Closure //
///////////////////////////////////////////////////

extension MyActor {

    func test_CallerAsyncNormal_CalleeAsyncNonIsolated() async {
        // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference7MyActorC029test_CallerAsyncNormal_CalleeH11NonIsolatedyyYaF'

        // CHECK-LABEL: closure #1 in MyActor.test_CallerAsyncNormal_CalleeAsyncNonIsolated()
        // CHECK-NEXT: Isolation: actor_instance. name: 'self'
        await asyncNormalAcceptsAsyncClosure { print(self) } // expected-error {{sending 'self'-isolated value of type '() async -> ()' with later accesses to nonisolated context risks causing data races}}

        // CHECK-LABEL: closure #2 in MyActor.test_CallerAsyncNormal_CalleeAsyncNonIsolated()
        // CHECK-NEXT: Isolation: nonisolated
        await asyncNormalAcceptsSendingAsyncClosure { print(self) }

        // CHECK-LABEL: // closure #3 in MyActor.test_CallerAsyncNormal_CalleeAsyncNonIsolated()
        // CHECK-NEXT: // Isolation: nonisolated
        await asyncNormalAcceptsSendableAsyncClosure { print(self) }
    }

    func test_CallerAsyncInheritsActorContext_CalleeAsyncNonisolated() async {
        // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference7MyActorC024test_CallerAsyncInheritse14Context_CalleeH11NonisolatedyyYaF'

        // CHECK-LABEL: // closure #1 in MyActor.test_CallerAsyncInheritsActorContext_CalleeAsyncNonisolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        await asyncInheritActorContextAcceptsAsyncClosure { print(self) }

        // CHECK-LABEL: // closure #2 in MyActor.test_CallerAsyncInheritsActorContext_CalleeAsyncNonisolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        await asyncInheritActorContextAcceptsSendingAsyncClosure { print(self) }

        // CHECK-LABEL: // closure #3 in MyActor.test_CallerAsyncInheritsActorContext_CalleeAsyncNonisolated()
        // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
        await asyncInheritActorContextAcceptsSendingAsyncClosure { @CustomActor in print(self) }

        // CHECK-LABEL: // closure #4 in MyActor.test_CallerAsyncInheritsActorContext_CalleeAsyncNonisolated()
        // CHECK-NEXT: // Isolation: global_actor. type: MainActor
        await asyncInheritActorContextAcceptsSendingAsyncClosure { @MainActor in print(self) }

        // CHECK-LABEL: // closure #5 in MyActor.test_CallerAsyncInheritsActorContext_CalleeAsyncNonisolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        await asyncInheritActorContextAcceptsSendableAsyncClosure { print(self) }
    }

    func test_CallerAsyncNormal_CalleeAsyncMainActorIsolated() async {
        // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference7MyActorC029test_CallerAsyncNormal_Calleeh4MainE8IsolatedyyYaF'

        // CHECK-LABEL: // closure #1 in MyActor.test_CallerAsyncNormal_CalleeAsyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        await asyncNormalGlobalActorAcceptsAsyncClosure { print(self) } // expected-error {{sending 'self'-isolated value of type '() async -> ()' with later accesses to main actor-isolated context risks causing data races}}

        // CHECK-LABEL: // closure #2 in MyActor.test_CallerAsyncNormal_CalleeAsyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: nonisolated
        await asyncNormalGlobalActorAcceptsSendingAsyncClosure { print(self) }

        // CHECK-LABEL: // closure #3 in MyActor.test_CallerAsyncNormal_CalleeAsyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: nonisolated
        await asyncNormalGlobalActorAcceptsSendableAsyncClosure { print(self) }
    }

    func test_CallerAsyncInheritsActorContext_CalleeAsyncMainActorIsolated() async {
        // CHECK-LABEL: } // end sil function '$s54transfernonsendable_closureliterals_isolationinference7MyActorC024test_CallerAsyncInheritse14Context_Calleeh4MainE8IsolatedyyYaF'

        // CHECK-LABEL: // closure #1 in MyActor.test_CallerAsyncInheritsActorContext_CalleeAsyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        await asyncInheritActorContextGlobalActorAcceptsAsyncClosure { print(self) }

        // CHECK-LABEL: // closure #2 in MyActor.test_CallerAsyncInheritsActorContext_CalleeAsyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        await asyncInheritActorContextGlobalActorAcceptsSendingAsyncClosure { print(self) }

        // CHECK-LABEL: // closure #3 in MyActor.test_CallerAsyncInheritsActorContext_CalleeAsyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: global_actor. type: CustomActor
        await asyncInheritActorContextGlobalActorAcceptsSendingAsyncClosure { @CustomActor in print(self) }

        // CHECK-LABEL: // closure #4 in MyActor.test_CallerAsyncInheritsActorContext_CalleeAsyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: global_actor. type: MainActor
        await asyncInheritActorContextGlobalActorAcceptsSendingAsyncClosure { @MainActor in print(self) }

        // CHECK-LABEL: // closure #5 in MyActor.test_CallerAsyncInheritsActorContext_CalleeAsyncMainActorIsolated()
        // CHECK-NEXT: // Isolation: actor_instance. name: 'self'
        await asyncInheritActorContextGlobalActorAcceptsSendableAsyncClosure { print(self) }
    }
}