@@ -47,6 +47,36 @@ public struct InferenceTest {
4747 public func testAutoclosure( value2 fn: nonisolated( nonsending ) @autoclosure ( ) async -> Int ) async { await fn ( ) }
4848}
4949
50+ // CHECK: nonisolated extension A.InferenceTest {
51+ // CHECK: nonisolated(nonsending) public func testInExtension() async
52+ // CHECK: @concurrent public func testConcurrentInExtension() async
53+ // CHECK: }
54+ nonisolated public extension InferenceTest {
55+ func testInExtension( ) async { }
56+ @concurrent func testConcurrentInExtension( ) async { }
57+ }
58+
59+ // CHECK: public protocol P {
60+ // CHECK: nonisolated(nonsending) func testWitness() async
61+ // CHECK: }
62+ public protocol P {
63+ func testWitness( ) async
64+ }
65+
66+ // CHECK: public struct WitnessTest : nonisolated A.P {
67+ // CHECK: nonisolated(nonsending) public func testWitness() async
68+ // CHECK: }
69+ public struct WitnessTest : nonisolated P {
70+ public func testWitness( ) async { }
71+ }
72+
73+ // CHECK: nonisolated public class NoinsolatedClassTest {
74+ // CHECK: nonisolated(nonsending) public func test() async
75+ // CHECK: }
76+ nonisolated public class NoinsolatedClassTest {
77+ public func test( ) async { }
78+ }
79+
5080//--- Client.swift
5181import A
5282
@@ -75,13 +105,18 @@ func testWithCallback(t: Test) async {
75105// CHECK: function_ref @$s1A13InferenceTestV10infersAttryyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitActor, @in_guaranteed InferenceTest) -> ()
76106// CHECK: function_ref @$s1A13InferenceTestV10testNested8callbackyyyyYaYbYCXEc_tF : $@convention(method) (@guaranteed @callee_guaranteed (@guaranteed @noescape @Sendable @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitActor) -> ()) -> (), @in_guaranteed InferenceTest) -> ()
77107// CHECK: function_ref @$s1A13InferenceTestV10testNested4dictySDySSyyYaYCcSgG_tF : $@convention(method) (@guaranteed Dictionary<String, Optional<nonisolated(nonsending) () async -> ()>>, @in_guaranteed InferenceTest) -> ()
108+ // CHECK: function_ref @$s1A13InferenceTestV15testInExtensionyyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitActor, @in_guaranteed InferenceTest) -> ()
109+ // CHECK: function_ref @$s1A13InferenceTestV25testConcurrentInExtensionyyYaF : $@convention(method) @async (@in_guaranteed InferenceTest) -> ()
78110// CHECK: } // end sil function '$s6Client13testInference1ty1A0C4TestV_tYaF'
79111@MainActor
80112func testInference( t: InferenceTest ) async {
81113 await t. infersAttr ( )
82114
83115 t. testNested { _ in }
84116 t. testNested ( dict: [ : ] )
117+
118+ await t. testInExtension ( )
119+ await t. testConcurrentInExtension ( )
85120}
86121
87122// CHECK-LABEL: sil hidden @$s6Client15testAutoclosure1ty1A13InferenceTestV_tYaF : $@convention(thin) @async (@in_guaranteed InferenceTest) -> ()
@@ -92,3 +127,17 @@ func testAutoclosure(t: InferenceTest) async {
92127 await t. testAutoclosure ( value1: 42 )
93128 await t. testAutoclosure ( value2: 42 )
94129}
130+
131+ // CHECK-LABEL: sil hidden @$s6Client26testWitnessWithNonisolated1ty1A0C4TestV_tYaF : $@convention(thin) @async (@in_guaranteed WitnessTest) -> ()
132+ // CHECK: function_ref @$s1A11WitnessTestV04testA0yyYaF : $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitActor, @in_guaranteed WitnessTest) -> ()
133+ // CHECK: } // end sil function '$s6Client26testWitnessWithNonisolated1ty1A0C4TestV_tYaF'
134+ func testWitnessWithNonisolated( t: WitnessTest ) async {
135+ await t. testWitness ( )
136+ }
137+
138+ // CHECK-LABEL: sil hidden @$s6Client20testNonisolatedClass1ty1A011NoinsolatedD4TestC_tYaF : $@convention(thin) @async (@guaranteed NoinsolatedClassTest) -> ()
139+ // CHECK: class_method {{.*}}, #NoinsolatedClassTest.test : (NoinsolatedClassTest) -> () async -> (), $@convention(method) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitActor, @guaranteed NoinsolatedClassTest) -> ()
140+ // CHECK: } // end sil function '$s6Client20testNonisolatedClass1ty1A011NoinsolatedD4TestC_tYaF'
141+ func testNonisolatedClass( t: NoinsolatedClassTest ) async {
142+ await t. test ( )
143+ }
0 commit comments