Files
swift-mirror/test/SILGen/partial_apply_protocol_class_refinement_method.swift
Joe Groff 2eed756dbd SILGen: Track assumed-+0-self state of protocol method invocations.
Fixes SR-613, a miscompile that caused an overrelease of "self" when partially applying a protocol method to a generic or existential of a refined class-constrained protocol.
2016-04-26 11:01:59 -07:00

14 lines
506 B
Swift

// RUN: %target-swift-frontend -emit-silgen %s | FileCheck %s
protocol P { func foo() }
protocol Q: class, P {}
// CHECK-LABEL: sil hidden @_TF46partial_apply_protocol_class_refinement_method12partialApplyFPS_1Q_FT_T_
func partialApply(_ q: Q) -> () -> () {
// CHECK: [[OPENED:%.*]] = open_existential_ref
// CHECK: store [[OPENED]] to [[TMP:%.*]] :
// CHECK: copy_addr [[TMP:%.*]] to [initialization] [[CONSUMABLE_TMP:%.*]] :
// CHECK: apply {{%.*}}<{{.*}}>([[CONSUMABLE_TMP]])
return q.foo
}