Enable SubobjectDestroy.Op to destroy array elements (#7844)

This is a partial implementation of #7362.
This commit is contained in:
Christopher Di Bella
2026-09-30 14:01:43 +00:00
committed by GitHub
parent 12e1afeb15
commit c1492aab75
29 changed files with 1554 additions and 3 deletions
+6
View File
@@ -82,6 +82,8 @@ fn F(b: bool, n: i32, m: i32) -> i32 {
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc16_3.1 [concrete]
// CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1: type = fn_type @Destroy.WithSelf.SelfDestruct.loc16_3.1 [concrete]
// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.1: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1 = struct_value () [concrete]
// CHECK:STDOUT: %self.param_patt.dc5: %pattern_type.97e = ref_param_pattern [concrete]
// CHECK:STDOUT: %self.patt.7f9: %pattern_type.97e = wrapper_binding_pattern self, %self.param_patt.dc5 [concrete]
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc16_3.2 [concrete]
@@ -245,6 +247,10 @@ fn F(b: bool, n: i32, m: i32) -> i32 {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc16_3.2(%self.param: ref %array_type) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
// CHECK:STDOUT: %.loc16: ref %i32 = array_index %self.param, %int_0
// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: <bound method> = bound_method %.loc16, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1
// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc16)
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT: