Files
swift-mirror/test/SILGen/partial_apply_protocol_class_refinement_method.swift
Meghana Gupta 196994fc11 Fix store_borrow generation in SILGen
This change ensures all store_borrows are ended with an end_borrow, and uses of the store_borrow
destination are all in the enclosing store_borrow scope and via the store_borrow return address.

Fix tests to reflect new store_borrow pattern
2022-08-16 15:08:22 -07:00

18 lines
655 B
Swift

// RUN: %target-swift-emit-silgen -module-name partial_apply_protocol_class_refinement_method %s | %FileCheck %s
protocol P { func foo() }
protocol Q: class, P {}
// CHECK-LABEL: sil hidden [ossa] @$s46partial_apply_protocol_class_refinement_method0A5ApplyyyycAA1Q_pF : $@convention
// CHECK: bb0([[ARG:%.*]] : @guaranteed $Q):
func partialApply(_ q: Q) -> () -> () {
// CHECK: [[OPENED:%.*]] = open_existential_ref [[ARG]]
// CHECK: [[TMP:%.*]] = alloc_stack
// CHECK: [[SB:%.*]] = store_borrow [[OPENED]] to [[TMP:%.*]] :
// CHECK: apply {{%.*}}<{{.*}}>([[SB]])
// CHECK: end_borrow
// CHECK-NEXT: dealloc_stack [[TMP]]
return q.foo
}