1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
// RUN: %target-sil-opt -verify %s
sil_stage raw
import Builtin
class Klass {}
struct S {
var k: Klass
}
sil [ossa] @moveonlywrapper_to_copyable_addr_test_1 : $@convention(thin) (@in Klass) -> () {
bb0(%0 : $*Klass):
%0a = moveonlywrapper_to_copyable_addr %0 : $*Klass
// expected-error @-1 {{operand of 'moveonlywrapper_to_copyable_addr' must be of moveonlywrapped type}}
destroy_addr %0a : $*Klass
%9999 = tuple()
}
sil [ossa] @moveonlywrapper_to_copyable_addr_test_2 : $@convention(thin) (@owned Klass) -> () {
bb0(%1 : @owned $Klass):
%2 = moveonlywrapper_to_copyable_addr %1 : $Klass
// expected-error @-1 {{operand of 'moveonlywrapper_to_copyable_addr' must have address type}}
destroy_value %2 : $Klass
%9999 = tuple()
}
sil [ossa] @moveonlywrapper_to_copyable_value_test_1 : $@convention(thin) (@in Klass, @owned Klass) -> () {
bb0(%0 : $*Klass, %1 : @owned $Klass):
%2 = moveonlywrapper_to_copyable [guaranteed] %0 : $*Klass
// expected-error @-1 {{operand of 'moveonlywrapper_to_copyable' must have object type}}
destroy_addr %2 : $*Klass
%3 = moveonlywrapper_to_copyable [guaranteed] %1 : $Klass
destroy_value %3 : $Klass
%9999 = tuple()
}
sil [ossa] @moveonlywrapper_to_copyable_value_test_2 : $@convention(thin) (@in Klass, @owned Klass) -> () {
bb0(%0 : $*Klass, %1 : @owned $Klass):
%3 = moveonlywrapper_to_copyable [guaranteed] %1 : $Klass
// expected-error @-1 {{operand of 'moveonlywrapper_to_copyable' must be of moveonlywrapped type}}
destroy_value %3 : $Klass
%9999 = tuple()
}
sil [ossa] @copyable_to_moveonlywrapper_value_test : $@convention(thin) (@in Klass, @owned @moveOnly Klass) -> () {
bb0(%0 : $*Klass, %1 : @owned $@moveOnly Klass):
%2 = copyable_to_moveonlywrapper [owned] %0 : $*Klass
// expected-error @-1 {{operand of 'copyable_to_moveonlywrapper' must have object type}}
destroy_addr %2 : $*Klass
%3 = copyable_to_moveonlywrapper [owned] %1 : $Klass
destroy_value %3 : $Klass
%9999 = tuple()
}
sil [ossa] @copyable_to_moveonlywrapper_value_test_2 : $@convention(thin) (@in Klass, @owned @moveOnly Klass) -> () {
bb0(%0 : $*Klass, %1 : @owned $@moveOnly Klass):
%3 = copyable_to_moveonlywrapper [owned] %1 : $@moveOnly Klass
// expected-error @-1 {{operand of 'copyable_to_moveonlywrapper' must not be of moveonlywrapped type}}
destroy_value %3 : $Klass
%9999 = tuple()
}
sil [ossa] @copyable_to_moveonlywrapper_addr_test_1 : $@convention(thin) (@in @moveOnly Klass) -> () {
bb0(%0 : $*@moveOnly Klass):
%0a = copyable_to_moveonlywrapper_addr %0 : $*@moveOnly Klass
// expected-error @-1 {{operand of 'copyable_to_moveonlywrapper_addr' must not be of moveonlywrapped type}}
destroy_addr %0a : $*@moveOnly Klass
%9999 = tuple()
}
sil [ossa] @copyable_to_moveonlywrapper_addr_test_2 : $@convention(thin) (@owned @moveOnly Klass) -> () {
bb0(%1 : @owned $@moveOnly Klass):
%2 = copyable_to_moveonlywrapper_addr %1 : $@moveOnly Klass
// expected-error @-1 {{operand of 'copyable_to_moveonlywrapper_addr' must have address type}}
destroy_value %2 : $@moveOnly Klass
%9999 = tuple()
}
|