// RUN: %target-swift-frontend -enable-sil-ownership -emit-silgen %s | %FileCheck %s infix operator ~> { precedence 255 associativity left } protocol P { } func bar(_: inout T) -> () -> () { return {_ in ()} } func baz(_: inout T) -> (Int) -> () { return {_ in ()} } func ~> ( x: inout T, m: (_ x: inout T) -> ((Args) -> Result) ) -> ((Args) -> Result) { return m(&x) } struct X : P {} var a = X() (a~>bar)() // CHECK: [[CHAINED_FUNC:%.*]] = apply {{%.*}}({{%.*}}, {{%.*}}) : $@convention(thin) <τ_0_0, τ_0_1, τ_0_2 where τ_0_0 : P> (@inout τ_0_0, @owned @noescape @callee_guaranteed (@inout τ_0_0) -> @owned @callee_guaranteed (@in τ_0_1) -> @out τ_0_2) -> @owned @callee_guaranteed (@in τ_0_1) -> @out τ_0_2 // CHECK: [[REABSTRACT:%.*]] = function_ref @_T0ytytIegir_Ieg_TR // CHECK: [[CHAINED_FUNC_REABSTRACTED:%.*]] = partial_apply [callee_guaranteed] [[REABSTRACT]]([[CHAINED_FUNC]]) // CHECK: [[BORROW:%.*]] = begin_borrow [[CHAINED_FUNC_REABSTRACTED]] // CHECK: apply [[BORROW]]() : $@callee_guaranteed () -> ()