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
+5
View File
@@ -137,6 +137,8 @@ fn CallGOnInitializingExpr() -> 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.loc39_20.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.loc39_20.1 [concrete]
// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.1: %Destroy.WithSelf.SelfDestruct.type.fbceb5.1 = struct_value () [concrete]
// CHECK:STDOUT: %pattern_type.cec: type = pattern_type %struct_type.k.e7c [concrete]
// CHECK:STDOUT: %self.param_patt.c92: %pattern_type.cec = ref_param_pattern [concrete]
// CHECK:STDOUT: %self.patt.1bc: %pattern_type.cec = wrapper_binding_pattern self, %self.param_patt.c92 [concrete]
@@ -506,6 +508,9 @@ fn CallGOnInitializingExpr() -> i32 {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc39_20.2(%self.param: ref %struct_type.k.e7c) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc39: ref %i32 = struct_access %self.param, element0
// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: <bound method> = bound_method %.loc39, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1
// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc39)
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT: