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
+8
View File
@@ -117,6 +117,8 @@ fn Run() {
// 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.loc18_35.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.loc18_35.2 [concrete]
// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.2: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2 = struct_value () [concrete]
// CHECK:STDOUT: %pattern_type.5ad: type = pattern_type %struct_type.has_value.value.da2 [concrete]
// CHECK:STDOUT: %self.param_patt.69f: %pattern_type.5ad = ref_param_pattern [concrete]
// CHECK:STDOUT: %self.patt.a66: %pattern_type.5ad = wrapper_binding_pattern self, %self.param_patt.69f [concrete]
@@ -346,6 +348,12 @@ fn Run() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc18_35.3(%self.param: ref %struct_type.has_value.value.da2) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc18_35.1: ref %empty_tuple.type = struct_access %self.param, element1
// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc18_35.1: <bound method> = bound_method %.loc18_35.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1
// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc18_35.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc18_35.1(%.loc18_35.1)
// CHECK:STDOUT: %.loc18_35.2: ref bool = struct_access %self.param, element0
// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc18_35.2: <bound method> = bound_method %.loc18_35.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2
// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc18_35.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc18_35.2(%.loc18_35.2)
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT: