Files
swift-mirror/test/SILOptimizer/sil_combine_concrete_existential_noncopyable.swift
Kavon Farvardin 0420310623 NCGenerics: it's no longer "experimental"
resolves rdar://127701059
2024-05-08 10:49:12 -07:00

26 lines
900 B
Swift

// RUN: %target-swift-frontend -emit-sil -O %s | %FileCheck %s
protocol P: ~Copyable {}
@_optimize(none)
func f<T: P>(_: T) {}
public struct S: P {
@_optimize(none)
init() {}
}
// CHECK-LABEL: sil @$s44sil_combine_concrete_existential_noncopyable1gyyF : $@convention(thin) () -> () {
// CHECK: [[S_ADDR:%.*]] = alloc_stack $S
// CHECK: [[INIT_FN:%.*]] = function_ref @$s44sil_combine_concrete_existential_noncopyable1SVACycfC : $@convention(method) (@thin S.Type) -> S
// CHECK: [[S:%.*]] = apply [[INIT_FN]]({{%.*}}) : $@convention(method) (@thin S.Type) -> S
// CHECK: store [[S]] to [[S_ADDR]]
// CHECK: [[CALLEE_FN:%.*]] = function_ref @$s44sil_combine_concrete_existential_noncopyable1fyyxAA1PRzlF : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@in_guaranteed τ_0_0) -> ()
// CHECK: apply [[CALLEE_FN]]<S>([[S_ADDR]])
// CHECK: return
public func g() {
let e: any P = S()
f(e)
}