Files
swift-mirror/test/SILGen/apply_abstraction_nested.swift
Joe Groff c0a2994564 AST: Start printing function types with @convention instead of old attributes.
And update tests to match.

Swift SVN r27262
2015-04-13 22:51:34 +00:00

26 lines
915 B
Swift

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