Files
swift-mirror/test/SILGen/upcast_existential.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

24 lines
814 B
Swift

// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
protocol P {}
protocol Q {}
struct X: P, Q {}
func makePQ() -> protocol<P,Q> { return X() }
func useP(x: P) { }
// CHECK-LABEL: sil hidden @_TF18upcast_existential5PQtoPFT_T_ : $@convention(thin) () -> () {
func PQtoP() {
// CHECK: [[PQ_PAYLOAD:%.*]] = open_existential_addr [[PQ:%.*]]#1 : $*protocol<P, Q> to $*[[OPENED_TYPE:@opened(.*) protocol<P, Q>]]
// CHECK: [[P_PAYLOAD:%.*]] = init_existential_addr [[P:%.*]]#1 : $*P, $[[OPENED_TYPE]]
// CHECK: copy_addr [take] [[PQ_PAYLOAD]] to [initialization] [[P_PAYLOAD]]
// CHECK: deinit_existential_addr [[PQ]]#1
// CHECK-NOT: destroy_addr [[P]]
// CHECK-NOT: destroy_addr [[P_PAYLOAD]]
// CHECK-NOT: destroy_addr [[PQ]]
// CHECK-NOT: destroy_addr [[PQ_PAYLOAD]]
useP(makePQ())
}