Enable SubobjectDestroy.Op to destroy a struct's fields (#7829)

This is a partial implementation of #7362.
This commit is contained in:
Christopher Di Bella
2026-09-29 00:13:37 +00:00
committed by GitHub
parent 6abcfa24b2
commit b0bc5ed338
67 changed files with 671 additions and 3 deletions
@@ -107,6 +107,8 @@ fn G() {
// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc24_3.2 [concrete]
// CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete]
// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc24_3.2 [concrete]
// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.2: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2 = struct_value () [concrete]
// CHECK:STDOUT: %pattern_type.38e: type = pattern_type %struct_type.arr.fdc [concrete]
// CHECK:STDOUT: %self.param_patt.96e: %pattern_type.38e = ref_param_pattern [concrete]
// CHECK:STDOUT: %self.patt.401: %pattern_type.38e = wrapper_binding_pattern self, %self.param_patt.96e [concrete]
@@ -392,6 +394,9 @@ fn G() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc24_3.3(%self.param: ref %struct_type.arr.fdc) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc24: ref %array_type = struct_access %self.param, element0
// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: <bound method> = bound_method %.loc24, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2
// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc24)
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT: