@@ -77,6 +77,23 @@ nonisolated public class NoinsolatedClassTest {
7777 public func test( ) async { }
7878}
7979
80+ // CHECK: public typealias F = nonisolated(nonsending) () async -> Swift.Void
81+ public typealias F = ( ) async -> Void
82+ // CHECK: public typealias G<T> = nonisolated(nonsending) () async -> T
83+ public typealias G < T> = ( ) async -> T
84+
85+ // CHECK: public func testTypeAlias(_: @escaping A.F)
86+ public func testTypeAlias( _: @escaping F ) { }
87+
88+ // CHECK: public struct TestGenericTypeAlias {
89+ // CHECK: public subscript<U>(_: nonisolated(nonsending) () async -> U) -> Swift.Bool {
90+ // CHECK: get
91+ // CHECK: }
92+ // CHECK: }
93+ public struct TestGenericTypeAlias {
94+ public subscript< U> ( _: G < U > ) -> Bool { false }
95+ }
96+
8097//--- Client.swift
8198import A
8299
@@ -141,3 +158,26 @@ func testWitnessWithNonisolated(t: WitnessTest) async {
141158func testNonisolatedClass( t: NoinsolatedClassTest ) async {
142159 await t. test ( )
143160}
161+
162+ // CHECK-LABEL: sil hidden @$s6Client18testTypeAliasParam1ty1A011TestGenericcD0V_tF : $@convention(thin) (@in_guaranteed TestGenericTypeAlias) -> ()
163+ // CHECK: [[CLOSURE:%.*]] = function_ref @$s6Client18testTypeAliasParam1ty1A011TestGenericcD0V_tFyyYaYCcfU_ : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitActor) -> ()
164+ // CHECK: [[THICK_CLOSURE:%.*]] = thin_to_thick_function [[CLOSURE]] to $@async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitActor) -> ()
165+ // CHECK: [[TEST_TYPEALIAS:%.*]] = function_ref @$s1A13testTypeAliasyyyyYaYCcF : $@convention(thin) (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitActor) -> ()) -> ()
166+ // CHECK: apply [[TEST_TYPEALIAS]]([[THICK_CLOSURE]]) : $@convention(thin) (@guaranteed @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitActor) -> ()) -> ()
167+ // CHECK: [[CLOSURE_2:%.*]] = convert_function {{.*}} to $@noescape @async @callee_guaranteed @substituted <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitActor) -> @out τ_0_0 for <Int>
168+ // CHECK: [[SUBSCRIPT:%.*]] = function_ref @$s1A20TestGenericTypeAliasVySbxyYaYCXEcluig : $@convention(method) <τ_0_0> (@guaranteed @noescape @async @callee_guaranteed @substituted <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitActor) -> @out τ_0_0 for <τ_0_0>, @in_guaranteed TestGenericTypeAlias) -> Bool
169+ // CHECK: apply [[SUBSCRIPT]]<Int>([[CLOSURE_2]], {{.*}}) : $@convention(method) <τ_0_0> (@guaranteed @noescape @async @callee_guaranteed @substituted <τ_0_0> (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitActor) -> @out τ_0_0 for <τ_0_0>, @in_guaranteed TestGenericTypeAlias) -> Bool
170+ // CHECK: } // end sil function '$s6Client18testTypeAliasParam1ty1A011TestGenericcD0V_tF'
171+ func testTypeAliasParam( t: TestGenericTypeAlias ) {
172+ // CHECK: closure #1 in testTypeAliasParam(t:)
173+ // CHECK: Isolation: caller_isolation_inheriting
174+ // CHECK-LABEL: sil private @$s6Client18testTypeAliasParam1ty1A011TestGenericcD0V_tFyyYaYCcfU_ : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitActor) -> ()
175+ // CHECK: } // end sil function '$s6Client18testTypeAliasParam1ty1A011TestGenericcD0V_tFyyYaYCcfU_'
176+ testTypeAlias { }
177+
178+ // CHECK: // closure #2 in testTypeAliasParam(t:)
179+ // CHECK: // Isolation: caller_isolation_inheriting
180+ // CHECK-LABEL: sil private @$s6Client18testTypeAliasParam1ty1A011TestGenericcD0V_tFSiyYaYCXEfU0_ : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Builtin.ImplicitActor) -> Int
181+ // CHECK: } // end sil function '$s6Client18testTypeAliasParam1ty1A011TestGenericcD0V_tFSiyYaYCXEfU0_'
182+ _ = t [ { 42 } ]
183+ }
0 commit comments