Files
swift-mirror/test/SIL/restricted-partial-apply.sil
Michael Gottesman dfe65c20f1 [lit] Change all %target-swift-frontend invocations to verify ownership.
We are already doing this for most of the target-swift-frontend ones. In a
subsequent commit, I am going to remove the redundant ones.

NOTE: On Darwin, I have not enabled it on the %target-swift-frontend mock SDK
commands. I ran into an issue with one of the PrintAsObjC tests that I am still
tracking down. I would rather just get this turned on to prevent further
regressions.

I also updated a few tests that needed some small tweaks to pass
this. Specifically:

1. Some parser tests needed some extra ossa insts to pass the verifier. This
doesn't effect what they actually test.

2. IRGen tests that should never have processed ossa directly. Today, we are
working towards a world where IRGen never processes [ossa] directly. Instead we
lower first. If/when that changes, we should add back in specific [ossa] tests.

3. A singular SILOptimizer definite init test case where the ownership verifier
fails due to a case which DI already flags as illegal (we just crash earlier). I
am going to look into fixing that by putting in errors in the typechecker or in
SILGen (not sure yet). I changed it to use target-swiftc_driver which does not
have ownership verification enabled.
2019-03-12 20:17:20 -07:00

35 lines
2.0 KiB
Plaintext

// RUN: %target-swift-frontend -module-name main -disable-sil-partial-apply -emit-sil -sil-verify-all %s
sil_stage canonical
import Builtin
class C {}
sil @native_object_context : $@convention(thin) (@owned Builtin.NativeObject) -> ()
sil @box_context : $@convention(thin) (@owned <τ_0_0> { var τ_0_0 } <Builtin.Word>) -> ()
sil @class_context : $@convention(thin) (@owned C) -> ()
sil @g_native_object_context : $@convention(thin) (@guaranteed Builtin.NativeObject) -> ()
sil @g_box_context : $@convention(thin) (@guaranteed <τ_0_0> { var τ_0_0 } <Builtin.Word>) -> ()
sil @g_class_context : $@convention(thin) (@guaranteed C) -> ()
sil @limited_partial_applies : $@convention(thin) (Builtin.NativeObject, <τ_0_0> { var τ_0_0 } <Builtin.Word>, C) -> () {
entry(%0 : $Builtin.NativeObject, %1 : $<τ_0_0> { var τ_0_0 } <Builtin.Word>, %2 : $C):
%a = function_ref @native_object_context : $@convention(thin) (@owned Builtin.NativeObject) -> ()
%b = function_ref @box_context : $@convention(thin) (@owned <τ_0_0> { var τ_0_0 } <Builtin.Word>) -> ()
%c = function_ref @class_context : $@convention(thin) (@owned C) -> ()
%d = function_ref @g_native_object_context : $@convention(thin) (@guaranteed Builtin.NativeObject) -> ()
%e = function_ref @g_box_context : $@convention(thin) (@guaranteed <τ_0_0> { var τ_0_0 } <Builtin.Word>) -> ()
%f = function_ref @g_class_context : $@convention(thin) (@guaranteed C) -> ()
%g = partial_apply %a(%0) : $@convention(thin) (@owned Builtin.NativeObject) -> ()
%h = partial_apply %b(%1) : $@convention(thin) (@owned <τ_0_0> { var τ_0_0 } <Builtin.Word>) -> ()
%i = partial_apply %c(%2) : $@convention(thin) (@owned C) -> ()
%j = partial_apply [callee_guaranteed] %d(%0) : $@convention(thin) (@guaranteed Builtin.NativeObject) -> ()
%k = partial_apply [callee_guaranteed] %e(%1) : $@convention(thin) (@guaranteed <τ_0_0> { var τ_0_0 } <Builtin.Word>) -> ()
%l = partial_apply [callee_guaranteed] %f(%2) : $@convention(thin) (@guaranteed C) -> ()
return undef : $()
}