@@ -39,6 +39,24 @@ bb0(%0 : $Buffer):
3939 return %t : $(Int, Builtin.Int1, Buffer)
4040}
4141
42+ // CHECK-LABEL: sil @test_cast
43+ // CHECK: [[I:%[0-9]+]] = integer_literal $Builtin.Int1, -1
44+ // CHECK: ({{.*}}, [[B:%[0-9]+]]) = begin_cow_mutation
45+ // CHECK: [[T:%[0-9]+]] = tuple ({{.*}}, [[I]] : $Builtin.Int1, [[B]] : $Buffer)
46+ // CHECK: return [[T]]
47+ // CHECK: } // end sil function 'test_cast'
48+ sil @test_cast : $@convention(thin) (@owned Builtin.BridgeObject) -> (Int, Builtin.Int1, @owned Buffer) {
49+ bb0(%0 : $Builtin.BridgeObject):
50+ %1 = end_cow_mutation %0
51+ %e = unchecked_ref_cast %1 to $Buffer
52+ %addr = ref_element_addr [immutable] %e : $Buffer, #Buffer.i
53+ debug_value %e : $Buffer, var, name "x"
54+ %i = load %addr : $*Int
55+ (%u, %b) = begin_cow_mutation %e : $Buffer
56+ %t = tuple (%i : $Int, %u : $Builtin.Int1, %b : $Buffer)
57+ return %t : $(Int, Builtin.Int1, Buffer)
58+ }
59+
4260// CHECK-LABEL: sil @test_store
4361// CHECK: end_cow_mutation
4462// CHECK: [[I:%[0-9]+]] = integer_literal $Builtin.Int1, -1
0 commit comments