From b2d339b58186dcc78e937aaeef1cc707c1057601 Mon Sep 17 00:00:00 2001 From: Christopher Di Bella Date: Thu, 1 Oct 2026 21:37:17 +0000 Subject: [PATCH] Enable `SubobjectDestroy.Op` to destroy fields defined in a `ClassType` (#7840) Base classes will be destroyed in a dedicated change, so we can trivially confirm that the base is being destroyed. This is a partial implementation of #7362. --------- Co-authored-by: Richard Smith --- toolchain/check/custom_witness.cpp | 43 +++-- toolchain/check/member_access.cpp | 4 +- .../class/access/access_modifiers.carbon | 5 + .../testdata/class/field/field_access.carbon | 8 + .../class/field/field_access_in_value.carbon | 8 + .../testdata/class/generic/import.carbon | 14 +- .../check/testdata/class/generic/init.carbon | 4 + .../testdata/class/generic/member_type.carbon | 4 + toolchain/check/testdata/class/import.carbon | 4 + .../class/inheritance/derived_to_base.carbon | 25 +++ .../class/inheritance/import_base.carbon | 33 +++- toolchain/check/testdata/class/init_as.carbon | 8 + toolchain/check/testdata/class/local.carbon | 4 + .../check/testdata/class/method/method.carbon | 4 + .../testdata/class/method/virtual.carbon | 13 ++ toolchain/check/testdata/class/nested.carbon | 24 +++ .../check/testdata/class/nested_name.carbon | 4 + .../testdata/class/reorder_qualified.carbon | 16 ++ .../value_with_type_through_access.carbon | 4 + toolchain/check/testdata/for/actual.carbon | 20 +- toolchain/check/testdata/for/basic.carbon | 20 ++ toolchain/check/testdata/for/pattern.carbon | 80 ++++++++ .../function/generic/return_slot.carbon | 4 + toolchain/check/testdata/generic/local.carbon | 4 + .../testdata/generic/template/convert.carbon | 14 ++ .../testdata/impl/extend_impl_generic.carbon | 4 + .../check/testdata/impl/impl_thunk.carbon | 5 + .../testdata/interop/cpp/impls/destroy.carbon | 10 + .../testdata/interop/cpp/range_for.carbon | 176 ++++++++++++++++++ .../operators/overloaded/implicit_as.carbon | 4 + toolchain/lower/testdata/array/iterate.carbon | 4 + toolchain/lower/testdata/class/adapt.carbon | 4 + toolchain/lower/testdata/class/basic.carbon | 4 + toolchain/lower/testdata/class/convert.carbon | 2 + toolchain/lower/testdata/class/field.carbon | 14 ++ toolchain/lower/testdata/class/generic.carbon | 12 ++ toolchain/lower/testdata/class/virtual.carbon | 16 ++ toolchain/lower/testdata/for/bindings.carbon | 4 + .../lower/testdata/for/break_continue.carbon | 8 + toolchain/lower/testdata/for/for.carbon | 8 + .../generic/type_representation.carbon | 4 + .../lower/testdata/impl/import_thunk.carbon | 8 + toolchain/lower/testdata/impl/thunk.carbon | 2 + .../interop/cpp/class/export/class.carbon | 16 ++ .../interop/cpp/class/import/dynamic.carbon | 2 + .../interop/cpp/class/virtual_fn.carbon | 4 + .../cpp/class/virtual_fn_carbon_only.carbon | 2 + .../testdata/interop/cpp/issue7142.carbon | 2 + .../lower/testdata/let/copy_value_rep.carbon | 2 + .../testdata/operators/overloaded.carbon | 2 + .../separate_compilation_witness.carbon | 16 ++ .../lower/testdata/primitives/optional.carbon | 8 + .../lower/testdata/template/class.carbon | 2 + .../lower/testdata/template/convert.carbon | 4 + toolchain/sem_ir/ids.h | 34 ++++ 55 files changed, 723 insertions(+), 31 deletions(-) diff --git a/toolchain/check/custom_witness.cpp b/toolchain/check/custom_witness.cpp index ee7487116354..adbe411a4a52 100644 --- a/toolchain/check/custom_witness.cpp +++ b/toolchain/check/custom_witness.cpp @@ -5,8 +5,10 @@ #include "toolchain/check/custom_witness.h" #include "llvm/ADT/APFloat.h" +#include "llvm/Support/SaveAndRestore.h" #include "toolchain/base/kind_switch.h" #include "toolchain/check/call.h" +#include "toolchain/check/class.h" #include "toolchain/check/convert.h" #include "toolchain/check/eval.h" #include "toolchain/check/facet_type.h" @@ -388,13 +390,16 @@ static auto CanDestroyType(Context& context, SemIR::LocId loc_id, } // Calls `self..(Destroy.SelfDestruct)` for a field in a `StructType`. -static auto DestroyStructField(Context& context, SemIR::LocId loc_id, - SemIR::InstId callee_self_param_id, - SemIR::StructTypeField struct_field) -> void { - auto member_id = PerformMemberAccess(context, loc_id, callee_self_param_id, - struct_field.name_id); - auto self_destruct_call = BuildSelfDestructCall(context, member_id); - DiscardExpr(context, self_destruct_call); +static auto DestroyStructFields( + Context& context, SemIR::LocId loc_id, SemIR::InstId callee_self_param_id, + llvm::ArrayRef struct_fields) -> void { + for (auto i = static_cast(struct_fields.size()) - 1; i >= 0; + --i) { + auto member_id = PerformMemberAccess(context, loc_id, callee_self_param_id, + struct_fields[i].name_id); + auto self_destruct_call = BuildSelfDestructCall(context, member_id); + DiscardExpr(context, self_destruct_call); + } } // Returns the body for `SubobjectDestroy.Op`. @@ -440,8 +445,18 @@ static auto MakeSubobjectDestroyOpBody(Context& context, SemIR::LocId loc_id, return; } case CARBON_KIND(SemIR::ClassType class_type): { - // TODO: implement destruction for class types. - (void)class_type; + auto class_info = context.classes().Get(class_type.class_id); + auto access_context = + llvm::SaveAndRestore(context.access_context(), + SemIR::NameScopeId::AllowHighestAccessLevel); + + DestroyStructFields( + context, loc_id, callee_self_param_id, + class_info + .GetStructTypeFields(context.sem_ir(), class_type.specific_id) + .drop_while([](SemIR::StructTypeField struct_field) { + return struct_field.name_id == SemIR::NameId::Vptr; + })); return; } case CARBON_KIND(SemIR::ConstType const_type): { @@ -460,13 +475,9 @@ static auto MakeSubobjectDestroyOpBody(Context& context, SemIR::LocId loc_id, return; } case CARBON_KIND(SemIR::StructType struct_type): { - auto struct_fields = - context.struct_type_fields().Get(struct_type.fields_id); - for (auto i = static_cast(struct_fields.size()) - 1; - i >= 0; --i) { - DestroyStructField(context, loc_id, callee_self_param_id, - struct_fields[i]); - } + DestroyStructFields( + context, loc_id, callee_self_param_id, + context.struct_type_fields().Get(struct_type.fields_id)); return; } case CARBON_KIND(SemIR::TupleType tuple_type): { diff --git a/toolchain/check/member_access.cpp b/toolchain/check/member_access.cpp index cf8994c57fc3..50179673a590 100644 --- a/toolchain/check/member_access.cpp +++ b/toolchain/check/member_access.cpp @@ -120,7 +120,9 @@ auto GetHighestAllowedAccess(Context& context, // Check if private access is allowed. while (access_context_scope_id.has_value()) { - if (class_info.scope_id == access_context_scope_id) { + if (class_info.scope_id == access_context_scope_id || + access_context_scope_id == + SemIR::NameScopeId::AllowHighestAccessLevel) { return SemIR::AccessKind::Private; } diff --git a/toolchain/check/testdata/class/access/access_modifiers.carbon b/toolchain/check/testdata/class/access/access_modifiers.carbon index f46d4ff2159d..b22e38f32ebc 100644 --- a/toolchain/check/testdata/class/access/access_modifiers.carbon +++ b/toolchain/check/testdata/class/access/access_modifiers.carbon @@ -169,6 +169,7 @@ class A { // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %pattern_type.6b6: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %Circle.elem: type = unbound_element_type %Circle, %i32 [concrete] // CHECK:STDOUT: %int_5.64b: Core.IntLiteral = int_value 5 [concrete] // CHECK:STDOUT: %ImplicitAs.type.914: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete] // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic] @@ -360,6 +361,10 @@ class A { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc20_36.3(%self.param: ref %Circle) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %radius.ref: %Circle.elem = name_ref radius, @Circle.%field_decl [concrete = @Circle.%field_decl] +// CHECK:STDOUT: %.loc20: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc20, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc20) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/field/field_access.carbon b/toolchain/check/testdata/class/field/field_access.carbon index 8217286d1f41..4e1af7c872f8 100644 --- a/toolchain/check/testdata/class/field/field_access.carbon +++ b/toolchain/check/testdata/class/field/field_access.carbon @@ -325,6 +325,14 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc21_3.2(%self.param: ref %Class) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %k.ref: %Class.elem = name_ref k, @Class.%field_decl.loc17 [concrete = @Class.%field_decl.loc17] +// CHECK:STDOUT: %.loc21_3.1: ref %i32 = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc21_3.1: = bound_method %.loc21_3.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc21_3.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc21_3.1(%.loc21_3.1) +// CHECK:STDOUT: %j.ref: %Class.elem = name_ref j, @Class.%field_decl.loc16 [concrete = @Class.%field_decl.loc16] +// CHECK:STDOUT: %.loc21_3.2: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc21_3.2: = bound_method %.loc21_3.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc21_3.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc21_3.2(%.loc21_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/field/field_access_in_value.carbon b/toolchain/check/testdata/class/field/field_access_in_value.carbon index 6031ffc70eaa..86eb80bbb5f3 100644 --- a/toolchain/check/testdata/class/field/field_access_in_value.carbon +++ b/toolchain/check/testdata/class/field/field_access_in_value.carbon @@ -334,6 +334,14 @@ fn Test() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc21_3.2(%self.param: ref %Class) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %k.ref: %Class.elem = name_ref k, @Class.%field_decl.loc17 [concrete = @Class.%field_decl.loc17] +// CHECK:STDOUT: %.loc21_3.1: ref %i32 = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc21_3.1: = bound_method %.loc21_3.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc21_3.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc21_3.1(%.loc21_3.1) +// CHECK:STDOUT: %j.ref: %Class.elem = name_ref j, @Class.%field_decl.loc16 [concrete = @Class.%field_decl.loc16] +// CHECK:STDOUT: %.loc21_3.2: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc21_3.2: = bound_method %.loc21_3.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc21_3.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc21_3.2(%.loc21_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/generic/import.carbon b/toolchain/check/testdata/class/generic/import.carbon index 9ea041e6f7af..15cf02a6e643 100644 --- a/toolchain/check/testdata/class/generic/import.carbon +++ b/toolchain/check/testdata/class/generic/import.carbon @@ -744,6 +744,10 @@ class Class(U: type) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc6_3.3(%self.param: ref %CompleteClass.d55) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %n.ref: %CompleteClass.elem.2cc = name_ref n, imports.%Main.import_ref.082 [concrete = imports.%field_decl] +// CHECK:STDOUT: %.loc6: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc6, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc6) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -894,12 +898,14 @@ class Class(U: type) { // CHECK:STDOUT: %Main.import_ref.b3bc94.1: type = import_ref Main//foo, loc6_22, loaded [symbolic = @CompleteClass.%T (constants.%T)] // CHECK:STDOUT: %Main.import_ref.0aa: = import_ref Main//foo, loc9_1, loaded [concrete = constants.%complete_type.cdf] // CHECK:STDOUT: %Main.import_ref.5db = import_ref Main//foo, inst{{[0-9A-F]+}} [no loc], unloaded -// CHECK:STDOUT: %Main.import_ref.bfc = import_ref Main//foo, loc7_8, unloaded +// CHECK:STDOUT: %Main.import_ref.082: @CompleteClass.%CompleteClass.elem (%CompleteClass.elem.c1f) = import_ref Main//foo, loc7_8, loaded [concrete = %field_decl] // CHECK:STDOUT: %Main.import_ref.a02 = import_ref Main//foo, loc8_17, unloaded // CHECK:STDOUT: %Main.import_ref.b3bc94.2: type = import_ref Main//foo, loc6_22, loaded [symbolic = @CompleteClass.%T (constants.%T)] // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic] // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.0ff = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Main.import_ref.69c = import_ref Main//foo, loc7_10, unloaded +// CHECK:STDOUT: %field_decl: @CompleteClass.%CompleteClass.elem (%CompleteClass.elem.c1f) = field_decl n, element0, %Main.import_ref.69c in [concrete] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { @@ -975,7 +981,7 @@ class Class(U: type) { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%Main.import_ref.5db -// CHECK:STDOUT: .n = imports.%Main.import_ref.bfc +// CHECK:STDOUT: .n = imports.%Main.import_ref.082 // CHECK:STDOUT: .F = imports.%Main.import_ref.a02 // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -1042,6 +1048,10 @@ class Class(U: type) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc13_3.3(%self.param: ref %CompleteClass.22b) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %n.ref: %CompleteClass.elem.014 = name_ref n, imports.%Main.import_ref.082 [concrete = imports.%field_decl] +// CHECK:STDOUT: %.loc13: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc13, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc13) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/generic/init.carbon b/toolchain/check/testdata/class/generic/init.carbon index 89234a62d731..0522203ae86d 100644 --- a/toolchain/check/testdata/class/generic/init.carbon +++ b/toolchain/check/testdata/class/generic/init.carbon @@ -439,6 +439,10 @@ fn InitFromAdaptedSpecific(x: i32) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc15_3.2(%self.param: ref %Class.58f) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %k.ref: %Class.elem.33c = name_ref k, @Class.%field_decl [concrete = @Class.%field_decl] +// CHECK:STDOUT: %.loc15: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc15, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc15) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/generic/member_type.carbon b/toolchain/check/testdata/class/generic/member_type.carbon index 8c97487bc7ac..e06449654f67 100644 --- a/toolchain/check/testdata/class/generic/member_type.carbon +++ b/toolchain/check/testdata/class/generic/member_type.carbon @@ -462,6 +462,10 @@ fn Test() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc13_3.3(%self.param: ref %Inner.84a) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %n.ref: %Inner.elem.a49 = name_ref n, @Inner.%field_decl [concrete = @Inner.%field_decl] +// CHECK:STDOUT: %.loc13: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc13, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc13) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/import.carbon b/toolchain/check/testdata/class/import.carbon index eca6dc86ffa2..62655470274c 100644 --- a/toolchain/check/testdata/class/import.carbon +++ b/toolchain/check/testdata/class/import.carbon @@ -704,6 +704,10 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc9_3.3(%self.param: ref %Field) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %x.ref: %Field.elem = name_ref x, imports.%Main.import_ref.3ec [concrete = imports.%field_decl] +// CHECK:STDOUT: %.loc9: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc9, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.5 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc9) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/inheritance/derived_to_base.carbon b/toolchain/check/testdata/class/inheritance/derived_to_base.carbon index 80cc19ab7400..7ad8b8943b39 100644 --- a/toolchain/check/testdata/class/inheritance/derived_to_base.carbon +++ b/toolchain/check/testdata/class/inheritance/derived_to_base.carbon @@ -130,10 +130,15 @@ fn PassPartialB(b: partial B) { // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %pattern_type.6b6: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %A.elem: type = unbound_element_type %A, %i32 [concrete] // CHECK:STDOUT: %struct_type.a.a92: type = struct_type {.a: %i32} [concrete] // CHECK:STDOUT: %B: type = class_type @B [concrete] +// CHECK:STDOUT: %B.elem.405: type = unbound_element_type %B, %A [concrete] +// CHECK:STDOUT: %B.elem.eea: type = unbound_element_type %B, %i32 [concrete] // CHECK:STDOUT: %struct_type.base.b.6c4: type = struct_type {.base: %A, .b: %i32} [concrete] // CHECK:STDOUT: %C: type = class_type @C [concrete] +// CHECK:STDOUT: %C.elem.c7c: type = unbound_element_type %C, %B [concrete] +// CHECK:STDOUT: %C.elem.e33: type = unbound_element_type %C, %i32 [concrete] // CHECK:STDOUT: %struct_type.base.c.faf: type = struct_type {.base: %B, .c: %i32} [concrete] // CHECK:STDOUT: %ptr.6b6: type = ptr_type %C [concrete] // CHECK:STDOUT: %pattern_type.fcb: type = pattern_type %ptr.6b6 [concrete] @@ -643,6 +648,10 @@ fn PassPartialB(b: partial B) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc32_66.3(%self.param: ref %A) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %a.ref: %A.elem = name_ref a, @A.%field_decl [concrete = @A.%field_decl] +// CHECK:STDOUT: %.loc32: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc32, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc32) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -677,6 +686,14 @@ fn PassPartialB(b: partial B) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc32_66.5(%self.param: ref %B) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %b.ref: %B.elem.eea = name_ref b, @B.%field_decl [concrete = @B.%field_decl] +// CHECK:STDOUT: %.loc32_66.1: ref %i32 = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc32_66.1: = bound_method %.loc32_66.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc32_66.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc32_66.1(%.loc32_66.1) +// CHECK:STDOUT: %base.ref: %B.elem.405 = name_ref base, @B.%.loc9 [concrete = @B.%.loc9] +// CHECK:STDOUT: %.loc32_66.2: ref %A = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc32_66.2: = bound_method %.loc32_66.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc32_66.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc32_66.2(%.loc32_66.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -711,6 +728,14 @@ fn PassPartialB(b: partial B) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc32_66.7(%self.param: ref %C) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %c.ref: %C.elem.e33 = name_ref c, @C.%field_decl [concrete = @C.%field_decl] +// CHECK:STDOUT: %.loc32_66.1: ref %i32 = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc32_66.1: = bound_method %.loc32_66.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc32_66.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc32_66.1(%.loc32_66.1) +// CHECK:STDOUT: %base.ref: %C.elem.c7c = name_ref base, @C.%.loc14 [concrete = @C.%.loc14] +// CHECK:STDOUT: %.loc32_66.2: ref %B = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc32_66.2: = bound_method %.loc32_66.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.5 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc32_66.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc32_66.2(%.loc32_66.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/inheritance/import_base.carbon b/toolchain/check/testdata/class/inheritance/import_base.carbon index 397258d7eb41..41bbb8a9c14c 100644 --- a/toolchain/check/testdata/class/inheritance/import_base.carbon +++ b/toolchain/check/testdata/class/inheritance/import_base.carbon @@ -150,6 +150,7 @@ fn Run() { // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %struct_type.x.unused_y.258: type = struct_type {.x: %i32, .unused_y: %i32} [concrete] // CHECK:STDOUT: %complete_type.6c3: = complete_type_witness %struct_type.x.unused_y.258 [concrete] +// CHECK:STDOUT: %Child.elem: type = unbound_element_type %Child, %Base [concrete] // CHECK:STDOUT: %struct_type.base.cae: type = struct_type {.base: %Base} [concrete] // CHECK:STDOUT: %complete_type.c02: = complete_type_witness %struct_type.base.cae [concrete] // CHECK:STDOUT: %pattern_type.860: type = pattern_type %Child [concrete] @@ -247,18 +248,22 @@ fn Run() { // CHECK:STDOUT: %Main.import_ref.d68 = import_ref Main//a, inst{{[0-9A-F]+}} [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.bc9: %Base.F.type = import_ref Main//a, loc5_13, loaded [concrete = constants.%Base.F] // CHECK:STDOUT: %Main.import_ref.077 = import_ref Main//a, loc6_18, unloaded -// CHECK:STDOUT: %Main.import_ref.dea: %Base.elem = import_ref Main//a, loc8_8, loaded [concrete = %field_decl] -// CHECK:STDOUT: %Main.import_ref.bf9 = import_ref Main//a, loc9_15, unloaded +// CHECK:STDOUT: %Main.import_ref.dea: %Base.elem = import_ref Main//a, loc8_8, loaded [concrete = %field_decl.fa2] +// CHECK:STDOUT: %Main.import_ref.d6a: %Base.elem = import_ref Main//a, loc9_15, loaded [concrete = %field_decl.e51] +// CHECK:STDOUT: %Main.import_ref.439419.1: type = import_ref Main//a, loc13_16, loaded [concrete = constants.%Base] +// CHECK:STDOUT: %.754: %Child.elem = base_decl %Main.import_ref.439419.1, element0 [concrete] // CHECK:STDOUT: %Main.import_ref.60e: = import_ref Main//a, loc14_1, loaded [concrete = constants.%complete_type.c02] // CHECK:STDOUT: %Main.import_ref.6e8 = import_ref Main//a, inst{{[0-9A-F]+}} [no loc], unloaded -// CHECK:STDOUT: %Main.import_ref.bd6 = import_ref Main//a, loc13_20, unloaded +// CHECK:STDOUT: %Main.import_ref.d51: %Child.elem = import_ref Main//a, loc13_20, loaded [concrete = %.754] // CHECK:STDOUT: %Main.import_ref.439419.2: type = import_ref Main//a, loc13_16, loaded [concrete = constants.%Base] // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.0ff = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.edf: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e74) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.845)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.1aa = impl_witness_table (%Core.import_ref.edf), @Core.IntLiteral.as.ImplicitAs.impl [concrete] -// CHECK:STDOUT: %Main.import_ref.69c = import_ref Main//a, loc8_10, unloaded -// CHECK:STDOUT: %field_decl: %Base.elem = field_decl x, element0, %Main.import_ref.69c in [concrete] {} +// CHECK:STDOUT: %Main.import_ref.69c25e.1 = import_ref Main//a, loc8_10, unloaded +// CHECK:STDOUT: %field_decl.fa2: %Base.elem = field_decl x, element0, %Main.import_ref.69c25e.1 in [concrete] {} // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Main.import_ref.69c25e.2 = import_ref Main//a, loc9_17, unloaded +// CHECK:STDOUT: %field_decl.e51: %Base.elem = field_decl unused_y, element1, %Main.import_ref.69c25e.2 in [concrete] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { @@ -351,7 +356,7 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%Main.import_ref.6e8 -// CHECK:STDOUT: .base = imports.%Main.import_ref.bd6 +// CHECK:STDOUT: .base = imports.%Main.import_ref.d51 // CHECK:STDOUT: .x = // CHECK:STDOUT: .F = // CHECK:STDOUT: extend imports.%Main.import_ref.439419.2 @@ -365,7 +370,7 @@ fn Run() { // CHECK:STDOUT: .F = imports.%Main.import_ref.bc9 // CHECK:STDOUT: .Unused = imports.%Main.import_ref.077 // CHECK:STDOUT: .x = imports.%Main.import_ref.dea -// CHECK:STDOUT: .unused_y = imports.%Main.import_ref.bf9 +// CHECK:STDOUT: .unused_y = imports.%Main.import_ref.d6a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { @@ -405,7 +410,7 @@ fn Run() { // CHECK:STDOUT: %a.var_patt: %pattern_type.860 = var_pattern %a.patt [concrete = constants.%a.var_patt] // CHECK:STDOUT: } // CHECK:STDOUT: %a.ref.loc8: ref %Child = name_ref a, %a -// CHECK:STDOUT: %x.ref: %Base.elem = name_ref x, imports.%Main.import_ref.dea [concrete = imports.%field_decl] +// CHECK:STDOUT: %x.ref: %Base.elem = name_ref x, imports.%Main.import_ref.dea [concrete = imports.%field_decl.fa2] // CHECK:STDOUT: %.loc8_4.1: ref %Base = class_element_access %a.ref.loc8, element0 // CHECK:STDOUT: %.loc8_4.2: ref %Base = converted %a.ref.loc8, %.loc8_4.1 // CHECK:STDOUT: %.loc8_4.3: ref %i32 = class_element_access %.loc8_4.2, element0 @@ -464,6 +469,14 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc7_3.3(%self.param: ref %Base) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %unused_y.ref: %Base.elem = name_ref unused_y, imports.%Main.import_ref.d6a [concrete = imports.%field_decl.e51] +// CHECK:STDOUT: %.loc7_3.1: ref %i32 = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc7_3.1: = bound_method %.loc7_3.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc7_3.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc7_3.1(%.loc7_3.1) +// CHECK:STDOUT: %x.ref: %Base.elem = name_ref x, imports.%Main.import_ref.dea [concrete = imports.%field_decl.fa2] +// CHECK:STDOUT: %.loc7_3.2: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc7_3.2: = bound_method %.loc7_3.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc7_3.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc7_3.2(%.loc7_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -495,6 +508,10 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc7_3.5(%self.param: ref %Child) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %base.ref: %Child.elem = name_ref base, imports.%Main.import_ref.d51 [concrete = imports.%.754] +// CHECK:STDOUT: %.loc7: ref %Base = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc7, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc7) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/init_as.carbon b/toolchain/check/testdata/class/init_as.carbon index 2e4200b5f887..73c433f9a331 100644 --- a/toolchain/check/testdata/class/init_as.carbon +++ b/toolchain/check/testdata/class/init_as.carbon @@ -226,6 +226,14 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc20_28.3(%self.param: ref %Class) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %b.ref: %Class.elem = name_ref b, @Class.%field_decl.loc15 [concrete = @Class.%field_decl.loc15] +// CHECK:STDOUT: %.loc20_28.1: ref %i32 = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc20_28.1: = bound_method %.loc20_28.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc20_28.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc20_28.1(%.loc20_28.1) +// CHECK:STDOUT: %a.ref: %Class.elem = name_ref a, @Class.%field_decl.loc14 [concrete = @Class.%field_decl.loc14] +// CHECK:STDOUT: %.loc20_28.2: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc20_28.2: = bound_method %.loc20_28.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc20_28.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc20_28.2(%.loc20_28.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/local.carbon b/toolchain/check/testdata/class/local.carbon index 6c726ea4b1e3..1bfd1d6b6bb5 100644 --- a/toolchain/check/testdata/class/local.carbon +++ b/toolchain/check/testdata/class/local.carbon @@ -303,6 +303,10 @@ class A { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc26_19.3(%self.param: ref %B) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %n.ref: %B.elem = name_ref n, @B.%field_decl [concrete = @B.%field_decl] +// CHECK:STDOUT: %.loc26: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc26, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc26) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/method/method.carbon b/toolchain/check/testdata/class/method/method.carbon index a3687c6a2cb6..21c9b4186c06 100644 --- a/toolchain/check/testdata/class/method/method.carbon +++ b/toolchain/check/testdata/class/method/method.carbon @@ -525,6 +525,10 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc39_20.3(%self.param: ref %Class) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %k.ref: %Class.elem = name_ref k, @Class.%field_decl [concrete = @Class.%field_decl] +// CHECK:STDOUT: %.loc39: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = 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: diff --git a/toolchain/check/testdata/class/method/virtual.carbon b/toolchain/check/testdata/class/method/virtual.carbon index e768b8112afc..80646dc463d8 100644 --- a/toolchain/check/testdata/class/method/virtual.carbon +++ b/toolchain/check/testdata/class/method/virtual.carbon @@ -939,6 +939,10 @@ class T2(G2: type) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc15_3.5(%self.param: ref %Derived) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %base.ref: %Derived.elem = name_ref base, @Derived.%.loc8 [concrete = @Derived.%.loc8] +// CHECK:STDOUT: %.loc15: ref %Base = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc15, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc15) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1127,6 +1131,7 @@ class T2(G2: type) { // CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete] // CHECK:STDOUT: %pattern_type.6b6: type = pattern_type %i32 [concrete] +// CHECK:STDOUT: %Base.elem: type = unbound_element_type %Base, %i32 [concrete] // CHECK:STDOUT: %pattern_type.912: type = pattern_type %Base [concrete] // CHECK:STDOUT: %ptr.454: type = ptr_type [concrete] // CHECK:STDOUT: %struct_type.vptr.m1.m2: type = struct_type {.: %ptr.454, .m1: %i32, .m2: %i32} [concrete] @@ -1394,6 +1399,14 @@ class T2(G2: type) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc15_3.4(%self.param: ref %Base) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %m2.ref: %Base.elem = name_ref m2, @Base.%field_decl.loc6 [concrete = @Base.%field_decl.loc6] +// CHECK:STDOUT: %.loc15_3.1: ref %i32 = class_element_access %self.param, element2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc15_3.1: = bound_method %.loc15_3.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc15_3.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc15_3.1(%.loc15_3.1) +// CHECK:STDOUT: %m1.ref: %Base.elem = name_ref m1, @Base.%field_decl.loc5 [concrete = @Base.%field_decl.loc5] +// CHECK:STDOUT: %.loc15_3.2: ref %i32 = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc15_3.2: = bound_method %.loc15_3.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc15_3.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc15_3.2(%.loc15_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/nested.carbon b/toolchain/check/testdata/class/nested.carbon index 3bd700116a9d..6a8f8ceca511 100644 --- a/toolchain/check/testdata/class/nested.carbon +++ b/toolchain/check/testdata/class/nested.carbon @@ -523,6 +523,18 @@ fn F(a: Outer*) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc19_5.4(%self.param: ref %Inner) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %qi.ref: %Inner.elem.df9 = name_ref qi, @Inner.%field_decl.loc25 [concrete = @Inner.%field_decl.loc25] +// CHECK:STDOUT: %.loc19_5.1: ref %ptr.001 = class_element_access %self.param, element2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc19_5.1: = bound_method %.loc19_5.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc19_5.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc19_5.1(%.loc19_5.1) +// CHECK:STDOUT: %po.ref: %Inner.elem.2a2 = name_ref po, @Inner.%field_decl.loc24 [concrete = @Inner.%field_decl.loc24] +// CHECK:STDOUT: %.loc19_5.2: ref %ptr.286 = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc19_5.2: = bound_method %.loc19_5.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc19_5.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc19_5.2(%.loc19_5.2) +// CHECK:STDOUT: %pi.ref: %Inner.elem.df9 = name_ref pi, @Inner.%field_decl.loc23 [concrete = @Inner.%field_decl.loc23] +// CHECK:STDOUT: %.loc19_5.3: ref %ptr.001 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc19_5.3: = bound_method %.loc19_5.3, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc19_5.3: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc19_5.3(%.loc19_5.3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -560,6 +572,18 @@ fn F(a: Outer*) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc18_5.2(%self.param: ref %Outer) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %pi.ref: %Outer.elem.fe3 = name_ref pi, @Outer.%field_decl.loc42 [concrete = @Outer.%field_decl.loc42] +// CHECK:STDOUT: %.loc18_5.1: ref %ptr.001 = class_element_access %self.param, element2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc18_5.1: = bound_method %.loc18_5.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc18_5.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc18_5.1(%.loc18_5.1) +// CHECK:STDOUT: %qo.ref: %Outer.elem.3ef = name_ref qo, @Outer.%field_decl.loc41 [concrete = @Outer.%field_decl.loc41] +// CHECK:STDOUT: %.loc18_5.2: ref %ptr.286 = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc18_5.2: = bound_method %.loc18_5.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc18_5.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc18_5.2(%.loc18_5.2) +// CHECK:STDOUT: %po.ref: %Outer.elem.3ef = name_ref po, @Outer.%field_decl.loc40 [concrete = @Outer.%field_decl.loc40] +// CHECK:STDOUT: %.loc18_5.3: ref %ptr.286 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc18_5.3: = bound_method %.loc18_5.3, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc18_5.3: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc18_5.3(%.loc18_5.3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/nested_name.carbon b/toolchain/check/testdata/class/nested_name.carbon index c15186d733a8..d599839d6297 100644 --- a/toolchain/check/testdata/class/nested_name.carbon +++ b/toolchain/check/testdata/class/nested_name.carbon @@ -295,6 +295,10 @@ fn G(o: Outer) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc26_3.3(%self.param: ref %Inner) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %n.ref: %Inner.elem = name_ref n, @Inner.%field_decl [concrete = @Inner.%field_decl] +// CHECK:STDOUT: %.loc26: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc26, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc26) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/reorder_qualified.carbon b/toolchain/check/testdata/class/reorder_qualified.carbon index cea469bea614..ffe676a28cb6 100644 --- a/toolchain/check/testdata/class/reorder_qualified.carbon +++ b/toolchain/check/testdata/class/reorder_qualified.carbon @@ -584,6 +584,10 @@ class A { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc36_7.3(%self.param: ref %D) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %d.ref: %D.elem = name_ref d, @D.%field_decl [concrete = @D.%field_decl] +// CHECK:STDOUT: %.loc36: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc36, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc36) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -615,6 +619,10 @@ class A { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc35_7.2(%self.param: ref %C) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %c.ref: %C.elem = name_ref c, @C.%field_decl [concrete = @C.%field_decl] +// CHECK:STDOUT: %.loc35: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc35, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc35) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -646,6 +654,10 @@ class A { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc34_7.2(%self.param: ref %B) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %b.ref: %B.elem = name_ref b, @B.%field_decl [concrete = @B.%field_decl] +// CHECK:STDOUT: %.loc34: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc34, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc34) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -677,6 +689,10 @@ class A { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc33_7.2(%self.param: ref %A) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %a.ref: %A.elem = name_ref a, @A.%field_decl [concrete = @A.%field_decl] +// CHECK:STDOUT: %.loc33: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc33, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc33) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/deduce/value_with_type_through_access.carbon b/toolchain/check/testdata/deduce/value_with_type_through_access.carbon index cf54336caed8..e6fbec47467c 100644 --- a/toolchain/check/testdata/deduce/value_with_type_through_access.carbon +++ b/toolchain/check/testdata/deduce/value_with_type_through_access.carbon @@ -1080,6 +1080,10 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc30_13.3(%self.param: ref %Class) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %t.ref: %Class.elem = name_ref t, @Class.%field_decl [concrete = @Class.%field_decl] +// CHECK:STDOUT: %.loc30: ref type = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc30, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc30) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/for/actual.carbon b/toolchain/check/testdata/for/actual.carbon index ad46e4ad30a1..918be89ef0be 100644 --- a/toolchain/check/testdata/for/actual.carbon +++ b/toolchain/check/testdata/for/actual.carbon @@ -1068,13 +1068,17 @@ fn Read(generic y: Core.IntLiteral) { // CHECK:STDOUT: %Main.import_ref.e06: = import_ref Main//lib, loc24_1, loaded [symbolic = @IntRange.%complete_type (constants.%complete_type.aa1)] // CHECK:STDOUT: %Main.import_ref.663 = import_ref Main//lib, inst{{[0-9A-F]+}} [no loc], unloaded // CHECK:STDOUT: %Main.import_ref.ac1 = import_ref Main//lib, loc5_57, unloaded -// CHECK:STDOUT: %Main.import_ref.a12 = import_ref Main//lib, loc22_20, unloaded -// CHECK:STDOUT: %Main.import_ref.b83 = import_ref Main//lib, loc23_18, unloaded +// CHECK:STDOUT: %Main.import_ref.c92: @IntRange.%IntRange.elem (%IntRange.elem.bed) = import_ref Main//lib, loc22_20, loaded [concrete = %field_decl.eec] +// CHECK:STDOUT: %Main.import_ref.dc8: @IntRange.%IntRange.elem (%IntRange.elem.bed) = import_ref Main//lib, loc23_18, loaded [concrete = %field_decl.e2e] // CHECK:STDOUT: %Main.import_ref.6b552a.2: Core.IntLiteral = import_ref Main//lib, loc4_17, loaded [symbolic = @IntRange.%N (constants.%N)] // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.0ff = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic] // CHECK:STDOUT: %Core.import_ref.edf: @Core.IntLiteral.as.ImplicitAs.impl.0e9.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e74) = import_ref Core//prelude/types/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.0e9.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.845)] // CHECK:STDOUT: %ImplicitAs.impl_witness_table.1aa = impl_witness_table (%Core.import_ref.edf), @Core.IntLiteral.as.ImplicitAs.impl.0e9 [concrete] // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/destroy, Destroy, loaded [concrete = constants.%Destroy.type] +// CHECK:STDOUT: %Main.import_ref.18da56.1 = import_ref Main//lib, loc23_30, unloaded +// CHECK:STDOUT: %field_decl.e2e: @IntRange.%IntRange.elem (%IntRange.elem.bed) = field_decl end, element1, %Main.import_ref.18da56.1 in [concrete] {} +// CHECK:STDOUT: %Main.import_ref.18da56.2 = import_ref Main//lib, loc22_32, unloaded +// CHECK:STDOUT: %field_decl.eec: @IntRange.%IntRange.elem (%IntRange.elem.bed) = field_decl start, element0, %Main.import_ref.18da56.2 in [concrete] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { @@ -1163,8 +1167,8 @@ fn Read(generic y: Core.IntLiteral) { // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = imports.%Main.import_ref.663 // CHECK:STDOUT: .Make = imports.%Main.import_ref.ac1 -// CHECK:STDOUT: .start [private] = imports.%Main.import_ref.a12 -// CHECK:STDOUT: .end [private] = imports.%Main.import_ref.b83 +// CHECK:STDOUT: .start [private] = imports.%Main.import_ref.c92 +// CHECK:STDOUT: .end [private] = imports.%Main.import_ref.dc8 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1272,6 +1276,14 @@ fn Read(generic y: Core.IntLiteral) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc5_3.3(%self.param: ref %IntRange.bbd) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %end.ref: %IntRange.elem.6b1 = name_ref end, imports.%Main.import_ref.dc8 [concrete = imports.%field_decl.e2e] +// CHECK:STDOUT: %.loc5_3.1: ref %i32 = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc5_3.1: = bound_method %.loc5_3.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc5_3.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc5_3.1(%.loc5_3.1) +// CHECK:STDOUT: %start.ref: %IntRange.elem.6b1 = name_ref start, imports.%Main.import_ref.c92 [concrete = imports.%field_decl.eec] +// CHECK:STDOUT: %.loc5_3.2: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc5_3.2: = bound_method %.loc5_3.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc5_3.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc5_3.2(%.loc5_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/for/basic.carbon b/toolchain/check/testdata/for/basic.carbon index d54d651744ba..40243c22d970 100644 --- a/toolchain/check/testdata/for/basic.carbon +++ b/toolchain/check/testdata/for/basic.carbon @@ -59,6 +59,10 @@ fn Run() { // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] // CHECK:STDOUT: %T.f84: %Copy.type = symbolic_binding T, 0 [symbolic] +// CHECK:STDOUT: %T.as_type.c1c: type = facet_access_type %T.f84 [symbolic] +// CHECK:STDOUT: %Optional.e88: type = class_type @Optional, @Optional(%T.f84) [symbolic] +// CHECK:STDOUT: %Optional.elem.2ae: type = unbound_element_type %Optional.e88, %T.as_type.c1c [symbolic] +// CHECK:STDOUT: %Optional.elem.2fa: type = unbound_element_type %Optional.e88, bool [symbolic] // CHECK:STDOUT: %Optional.Get.type.e1b: type = fn_type @Optional.Get, @Optional(%T.f84) [symbolic] // CHECK:STDOUT: %Optional.Get.20c: %Optional.Get.type.e1b = struct_value () [symbolic] // CHECK:STDOUT: %Optional.HasValue.type.224: type = fn_type @Optional.HasValue, @Optional(%T.f84) [symbolic] @@ -87,6 +91,8 @@ fn Run() { // CHECK:STDOUT: %Optional.HasValue.3ad: %Optional.HasValue.type.a09 = struct_value () [concrete] // CHECK:STDOUT: %Optional.Get.type.9ee: type = fn_type @Optional.Get, @Optional(%Copy.facet) [concrete] // CHECK:STDOUT: %Optional.Get.20b: %Optional.Get.type.9ee = struct_value () [concrete] +// CHECK:STDOUT: %Optional.elem.c90: type = unbound_element_type %Optional.0cb, bool [concrete] +// CHECK:STDOUT: %Optional.elem.889: type = unbound_element_type %Optional.0cb, %empty_tuple.type [concrete] // CHECK:STDOUT: %struct_type.has_value.value.da2: type = struct_type {.has_value: bool, .value: %empty_tuple.type} [concrete] // CHECK:STDOUT: %Body.type: type = fn_type @Body [concrete] // CHECK:STDOUT: %Body: %Body.type = struct_value () [concrete] @@ -157,8 +163,14 @@ fn Run() { // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core.import_ref.1db: @Optional.%Optional.HasValue.type (%Optional.HasValue.type.224) = import_ref Core//prelude/parts/iterate, inst{{[0-9A-F]+}} [indirect], loaded [symbolic = @Optional.%Optional.HasValue (constants.%Optional.HasValue.c4f)] // CHECK:STDOUT: %Core.import_ref.73b: @Optional.%Optional.Get.type (%Optional.Get.type.e1b) = import_ref Core//prelude/parts/iterate, inst{{[0-9A-F]+}} [indirect], loaded [symbolic = @Optional.%Optional.Get (constants.%Optional.Get.20c)] +// CHECK:STDOUT: %Core.import_ref.613: @Optional.%Optional.elem.1 (%Optional.elem.2fa) = import_ref Core//prelude/parts/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.4a0] +// CHECK:STDOUT: %Core.import_ref.7e3: @Optional.%Optional.elem.2 (%Optional.elem.2ae) = import_ref Core//prelude/parts/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.c67] // CHECK:STDOUT: %Core.import_ref.9c3: %empty_tuple.type.as.Copy.impl.Op.type = import_ref Core//prelude/parts/copy, loc{{\d+_\d+}}, loaded [concrete = constants.%empty_tuple.type.as.Copy.impl.Op] // CHECK:STDOUT: %Copy.impl_witness_table.229 = impl_witness_table (%Core.import_ref.9c3), @empty_tuple.type.as.Copy.impl [concrete] +// CHECK:STDOUT: %Core.import_ref.127 = import_ref Core//prelude/parts/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.c67: @Optional.%Optional.elem.2 (%Optional.elem.2ae) = field_decl value, element1, %Core.import_ref.127 in [concrete] {} +// CHECK:STDOUT: %Core.import_ref.b0d0 = import_ref Core//prelude/parts/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.4a0: @Optional.%Optional.elem.1 (%Optional.elem.2fa) = field_decl has_value, element0, %Core.import_ref.b0d0 in [concrete] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { @@ -368,6 +380,14 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc18_35.4(%self.param: ref %Optional.0cb) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %value.ref: %Optional.elem.889 = name_ref value, imports.%Core.import_ref.7e3 [concrete = imports.%field_decl.c67] +// CHECK:STDOUT: %.loc18_35.1: ref %empty_tuple.type = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc18_35.1: = 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: %has_value.ref: %Optional.elem.c90 = name_ref has_value, imports.%Core.import_ref.613 [concrete = imports.%field_decl.4a0] +// CHECK:STDOUT: %.loc18_35.2: ref bool = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc18_35.2: = 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: diff --git a/toolchain/check/testdata/for/pattern.carbon b/toolchain/check/testdata/for/pattern.carbon index 6a0ccbefc7a7..c89f5338a127 100644 --- a/toolchain/check/testdata/for/pattern.carbon +++ b/toolchain/check/testdata/for/pattern.carbon @@ -136,6 +136,7 @@ fn Run() { // CHECK:STDOUT: %T.f84: %Copy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %EmptyRange.Make.type.140: type = fn_type @EmptyRange.Make, @EmptyRange(%T.f84) [symbolic] // CHECK:STDOUT: %EmptyRange.Make.0de: %EmptyRange.Make.type.140 = struct_value () [symbolic] +// CHECK:STDOUT: %T.as_type.c1c: type = facet_access_type %T.f84 [symbolic] // CHECK:STDOUT: %Copy.impl_witness.518: = impl_witness imports.%Copy.impl_witness_table.b4f [concrete] // CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %C, (%Copy.impl_witness.518) [concrete] // CHECK:STDOUT: %EmptyRange.b10: type = class_type @EmptyRange, @EmptyRange(%Copy.facet) [concrete] @@ -144,6 +145,9 @@ fn Run() { // CHECK:STDOUT: %pattern_type.74f: type = pattern_type %EmptyRange.b10 [concrete] // CHECK:STDOUT: %EmptyRange.Make.specific_fn: = specific_function %EmptyRange.Make.72e, @EmptyRange.Make(%Copy.facet) [concrete] // CHECK:STDOUT: %Iterate.type: type = facet_type <@Iterate> [concrete] +// CHECK:STDOUT: %Optional.e88: type = class_type @Optional, @Optional(%T.f84) [symbolic] +// CHECK:STDOUT: %Optional.elem.2ae: type = unbound_element_type %Optional.e88, %T.as_type.c1c [symbolic] +// CHECK:STDOUT: %Optional.elem.2fa: type = unbound_element_type %Optional.e88, bool [symbolic] // CHECK:STDOUT: %Optional.Get.type.e1b: type = fn_type @Optional.Get, @Optional(%T.f84) [symbolic] // CHECK:STDOUT: %Optional.Get.20c: %Optional.Get.type.e1b = struct_value () [symbolic] // CHECK:STDOUT: %Optional.HasValue.type.224: type = fn_type @Optional.HasValue, @Optional(%T.f84) [symbolic] @@ -172,6 +176,8 @@ fn Run() { // CHECK:STDOUT: %Optional.HasValue.45e: %Optional.HasValue.type.383 = struct_value () [concrete] // CHECK:STDOUT: %Optional.Get.type.599: type = fn_type @Optional.Get, @Optional(%Copy.facet) [concrete] // CHECK:STDOUT: %Optional.Get.dc7: %Optional.Get.type.599 = struct_value () [concrete] +// CHECK:STDOUT: %Optional.elem.0af: type = unbound_element_type %Optional.0e3, bool [concrete] +// CHECK:STDOUT: %Optional.elem.5ba: type = unbound_element_type %Optional.0e3, %C [concrete] // CHECK:STDOUT: %struct_type.has_value.value.9e7: type = struct_type {.has_value: bool, .value: %C} [concrete] // CHECK:STDOUT: %Optional.HasValue.specific_fn: = specific_function %Optional.HasValue.45e, @Optional.HasValue(%Copy.facet) [concrete] // CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Optional.Get.dc7, @Optional.Get(%Copy.facet) [concrete] @@ -234,11 +240,17 @@ fn Run() { // CHECK:STDOUT: %Copy.impl_witness_table.b4f = impl_witness_table (%Main.import_ref.341), @C.as.Copy.impl [concrete] // CHECK:STDOUT: %Core.import_ref.1db: @Optional.%Optional.HasValue.type (%Optional.HasValue.type.224) = import_ref Core//prelude/parts/iterate, inst{{[0-9A-F]+}} [indirect], loaded [symbolic = @Optional.%Optional.HasValue (constants.%Optional.HasValue.c4f)] // CHECK:STDOUT: %Core.import_ref.73b: @Optional.%Optional.Get.type (%Optional.Get.type.e1b) = import_ref Core//prelude/parts/iterate, inst{{[0-9A-F]+}} [indirect], loaded [symbolic = @Optional.%Optional.Get (constants.%Optional.Get.20c)] +// CHECK:STDOUT: %Core.import_ref.613: @Optional.%Optional.elem.1 (%Optional.elem.2fa) = import_ref Core//prelude/parts/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.4a0] +// CHECK:STDOUT: %Core.import_ref.7e3: @Optional.%Optional.elem.2 (%Optional.elem.2ae) = import_ref Core//prelude/parts/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.c67] // CHECK:STDOUT: %Main.import_ref.71a = import_ref Main//empty_range, loc7_68, unloaded // CHECK:STDOUT: %Main.import_ref.999 = import_ref Main//empty_range, loc7_68, unloaded // CHECK:STDOUT: %Main.import_ref.b6b: @EmptyRange.as.Iterate.impl.%EmptyRange.as.Iterate.impl.NewCursor.type (%EmptyRange.as.Iterate.impl.NewCursor.type.561) = import_ref Main//empty_range, loc8_37, loaded [symbolic = @EmptyRange.as.Iterate.impl.%EmptyRange.as.Iterate.impl.NewCursor (constants.%EmptyRange.as.Iterate.impl.NewCursor.31b)] // CHECK:STDOUT: %Main.import_ref.b499: @EmptyRange.as.Iterate.impl.%EmptyRange.as.Iterate.impl.Next.type (%EmptyRange.as.Iterate.impl.Next.type.c04) = import_ref Main//empty_range, loc11_66, loaded [symbolic = @EmptyRange.as.Iterate.impl.%EmptyRange.as.Iterate.impl.Next (constants.%EmptyRange.as.Iterate.impl.Next.cdc)] // CHECK:STDOUT: %Iterate.impl_witness_table = impl_witness_table (%Main.import_ref.71a, %Main.import_ref.999, %Main.import_ref.b6b, %Main.import_ref.b499), @EmptyRange.as.Iterate.impl [concrete] +// CHECK:STDOUT: %Core.import_ref.127 = import_ref Core//prelude/parts/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.c67: @Optional.%Optional.elem.2 (%Optional.elem.2ae) = field_decl value, element1, %Core.import_ref.127 in [concrete] {} +// CHECK:STDOUT: %Core.import_ref.b0d = import_ref Core//prelude/parts/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.4a0: @Optional.%Optional.elem.1 (%Optional.elem.2fa) = field_decl has_value, element0, %Core.import_ref.b0d in [concrete] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { @@ -462,6 +474,14 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc10_36.5(%self.param: ref %Optional.0e3) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %value.ref: %Optional.elem.5ba = name_ref value, imports.%Core.import_ref.7e3 [concrete = imports.%field_decl.c67] +// CHECK:STDOUT: %.loc10_36.1: ref %C = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc10_36.1: = bound_method %.loc10_36.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc10_36.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc10_36.1(%.loc10_36.1) +// CHECK:STDOUT: %has_value.ref: %Optional.elem.0af = name_ref has_value, imports.%Core.import_ref.613 [concrete = imports.%field_decl.4a0] +// CHECK:STDOUT: %.loc10_36.2: ref bool = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc10_36.2: = bound_method %.loc10_36.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc10_36.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc10_36.2(%.loc10_36.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -505,6 +525,7 @@ fn Run() { // CHECK:STDOUT: %T.f84: %Copy.type = symbolic_binding T, 0 [symbolic] // CHECK:STDOUT: %EmptyRange.Make.type.140: type = fn_type @EmptyRange.Make, @EmptyRange(%T.f84) [symbolic] // CHECK:STDOUT: %EmptyRange.Make.0de: %EmptyRange.Make.type.140 = struct_value () [symbolic] +// CHECK:STDOUT: %T.as_type.c1c: type = facet_access_type %T.f84 [symbolic] // CHECK:STDOUT: %Copy.impl_witness.518: = impl_witness imports.%Copy.impl_witness_table.b4f [concrete] // CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %C, (%Copy.impl_witness.518) [concrete] // CHECK:STDOUT: %EmptyRange.b10: type = class_type @EmptyRange, @EmptyRange(%Copy.facet) [concrete] @@ -513,6 +534,9 @@ fn Run() { // CHECK:STDOUT: %pattern_type.74f: type = pattern_type %EmptyRange.b10 [concrete] // CHECK:STDOUT: %EmptyRange.Make.specific_fn: = specific_function %EmptyRange.Make.72e, @EmptyRange.Make(%Copy.facet) [concrete] // CHECK:STDOUT: %Iterate.type: type = facet_type <@Iterate> [concrete] +// CHECK:STDOUT: %Optional.e88: type = class_type @Optional, @Optional(%T.f84) [symbolic] +// CHECK:STDOUT: %Optional.elem.2ae: type = unbound_element_type %Optional.e88, %T.as_type.c1c [symbolic] +// CHECK:STDOUT: %Optional.elem.2fa: type = unbound_element_type %Optional.e88, bool [symbolic] // CHECK:STDOUT: %Optional.Get.type.e1b: type = fn_type @Optional.Get, @Optional(%T.f84) [symbolic] // CHECK:STDOUT: %Optional.Get.20c: %Optional.Get.type.e1b = struct_value () [symbolic] // CHECK:STDOUT: %Optional.HasValue.type.224: type = fn_type @Optional.HasValue, @Optional(%T.f84) [symbolic] @@ -541,6 +565,8 @@ fn Run() { // CHECK:STDOUT: %Optional.HasValue.45e: %Optional.HasValue.type.383 = struct_value () [concrete] // CHECK:STDOUT: %Optional.Get.type.599: type = fn_type @Optional.Get, @Optional(%Copy.facet) [concrete] // CHECK:STDOUT: %Optional.Get.dc7: %Optional.Get.type.599 = struct_value () [concrete] +// CHECK:STDOUT: %Optional.elem.0af: type = unbound_element_type %Optional.0e3, bool [concrete] +// CHECK:STDOUT: %Optional.elem.5ba: type = unbound_element_type %Optional.0e3, %C [concrete] // CHECK:STDOUT: %struct_type.has_value.value.9e7: type = struct_type {.has_value: bool, .value: %C} [concrete] // CHECK:STDOUT: %Optional.HasValue.specific_fn: = specific_function %Optional.HasValue.45e, @Optional.HasValue(%Copy.facet) [concrete] // CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Optional.Get.dc7, @Optional.Get(%Copy.facet) [concrete] @@ -603,11 +629,17 @@ fn Run() { // CHECK:STDOUT: %Copy.impl_witness_table.b4f = impl_witness_table (%Main.import_ref.341), @C.as.Copy.impl [concrete] // CHECK:STDOUT: %Core.import_ref.1db: @Optional.%Optional.HasValue.type (%Optional.HasValue.type.224) = import_ref Core//prelude/parts/iterate, inst{{[0-9A-F]+}} [indirect], loaded [symbolic = @Optional.%Optional.HasValue (constants.%Optional.HasValue.c4f)] // CHECK:STDOUT: %Core.import_ref.73b: @Optional.%Optional.Get.type (%Optional.Get.type.e1b) = import_ref Core//prelude/parts/iterate, inst{{[0-9A-F]+}} [indirect], loaded [symbolic = @Optional.%Optional.Get (constants.%Optional.Get.20c)] +// CHECK:STDOUT: %Core.import_ref.613: @Optional.%Optional.elem.1 (%Optional.elem.2fa) = import_ref Core//prelude/parts/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.4a0] +// CHECK:STDOUT: %Core.import_ref.7e3: @Optional.%Optional.elem.2 (%Optional.elem.2ae) = import_ref Core//prelude/parts/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.c67] // CHECK:STDOUT: %Main.import_ref.71a = import_ref Main//empty_range, loc7_68, unloaded // CHECK:STDOUT: %Main.import_ref.999 = import_ref Main//empty_range, loc7_68, unloaded // CHECK:STDOUT: %Main.import_ref.b6b: @EmptyRange.as.Iterate.impl.%EmptyRange.as.Iterate.impl.NewCursor.type (%EmptyRange.as.Iterate.impl.NewCursor.type.561) = import_ref Main//empty_range, loc8_37, loaded [symbolic = @EmptyRange.as.Iterate.impl.%EmptyRange.as.Iterate.impl.NewCursor (constants.%EmptyRange.as.Iterate.impl.NewCursor.31b)] // CHECK:STDOUT: %Main.import_ref.b499: @EmptyRange.as.Iterate.impl.%EmptyRange.as.Iterate.impl.Next.type (%EmptyRange.as.Iterate.impl.Next.type.c04) = import_ref Main//empty_range, loc11_66, loaded [symbolic = @EmptyRange.as.Iterate.impl.%EmptyRange.as.Iterate.impl.Next (constants.%EmptyRange.as.Iterate.impl.Next.cdc)] // CHECK:STDOUT: %Iterate.impl_witness_table = impl_witness_table (%Main.import_ref.71a, %Main.import_ref.999, %Main.import_ref.b6b, %Main.import_ref.b499), @EmptyRange.as.Iterate.impl [concrete] +// CHECK:STDOUT: %Core.import_ref.127 = import_ref Core//prelude/parts/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.c67: @Optional.%Optional.elem.2 (%Optional.elem.2ae) = field_decl value, element1, %Core.import_ref.127 in [concrete] {} +// CHECK:STDOUT: %Core.import_ref.b0d = import_ref Core//prelude/parts/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.4a0: @Optional.%Optional.elem.1 (%Optional.elem.2fa) = field_decl has_value, element0, %Core.import_ref.b0d in [concrete] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { @@ -835,6 +867,14 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc10_40.5(%self.param: ref %Optional.0e3) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %value.ref: %Optional.elem.5ba = name_ref value, imports.%Core.import_ref.7e3 [concrete = imports.%field_decl.c67] +// CHECK:STDOUT: %.loc10_40.1: ref %C = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc10_40.1: = bound_method %.loc10_40.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc10_40.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc10_40.1(%.loc10_40.1) +// CHECK:STDOUT: %has_value.ref: %Optional.elem.0af = name_ref has_value, imports.%Core.import_ref.613 [concrete = imports.%field_decl.4a0] +// CHECK:STDOUT: %.loc10_40.2: ref bool = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc10_40.2: = bound_method %.loc10_40.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc10_40.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc10_40.2(%.loc10_40.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -880,6 +920,7 @@ fn Run() { // CHECK:STDOUT: %EmptyRange.Make.0de: %EmptyRange.Make.type.140 = struct_value () [symbolic] // CHECK:STDOUT: %tuple.type.693: type = tuple_type (type, type) [concrete] // CHECK:STDOUT: %tuple.52b: %tuple.type.693 = tuple_value (bool, bool) [concrete] +// CHECK:STDOUT: %T.as_type.c1c: type = facet_access_type %T.f84 [symbolic] // CHECK:STDOUT: %U: %Copy.type = symbolic_binding U, 1 [symbolic] // CHECK:STDOUT: %tuple.type.as.Copy.impl.Op.type.3ed: type = fn_type @tuple.type.as.Copy.impl.Op.1, @tuple.type.as.Copy.impl.9bd(%T.f84, %U) [symbolic] // CHECK:STDOUT: %tuple.type.as.Copy.impl.Op.0f8: %tuple.type.as.Copy.impl.Op.type.3ed = struct_value () [symbolic] @@ -894,6 +935,9 @@ fn Run() { // CHECK:STDOUT: %pattern_type.886: type = pattern_type %EmptyRange.d81 [concrete] // CHECK:STDOUT: %EmptyRange.Make.specific_fn: = specific_function %EmptyRange.Make.787, @EmptyRange.Make(%Copy.facet.701) [concrete] // CHECK:STDOUT: %Iterate.type: type = facet_type <@Iterate> [concrete] +// CHECK:STDOUT: %Optional.e88: type = class_type @Optional, @Optional(%T.f84) [symbolic] +// CHECK:STDOUT: %Optional.elem.2ae: type = unbound_element_type %Optional.e88, %T.as_type.c1c [symbolic] +// CHECK:STDOUT: %Optional.elem.2fa: type = unbound_element_type %Optional.e88, bool [symbolic] // CHECK:STDOUT: %Optional.Get.type.e1b: type = fn_type @Optional.Get, @Optional(%T.f84) [symbolic] // CHECK:STDOUT: %Optional.Get.20c: %Optional.Get.type.e1b = struct_value () [symbolic] // CHECK:STDOUT: %Optional.HasValue.type.224: type = fn_type @Optional.HasValue, @Optional(%T.f84) [symbolic] @@ -921,6 +965,8 @@ fn Run() { // CHECK:STDOUT: %Optional.HasValue.55e: %Optional.HasValue.type.34e = struct_value () [concrete] // CHECK:STDOUT: %Optional.Get.type.b0a: type = fn_type @Optional.Get, @Optional(%Copy.facet.701) [concrete] // CHECK:STDOUT: %Optional.Get.018: %Optional.Get.type.b0a = struct_value () [concrete] +// CHECK:STDOUT: %Optional.elem.6d4: type = unbound_element_type %Optional.4d1, bool [concrete] +// CHECK:STDOUT: %Optional.elem.4bf: type = unbound_element_type %Optional.4d1, %tuple.type.784 [concrete] // CHECK:STDOUT: %struct_type.has_value.value.6f9: type = struct_type {.has_value: bool, .value: %tuple.type.784} [concrete] // CHECK:STDOUT: %Optional.HasValue.specific_fn: = specific_function %Optional.HasValue.55e, @Optional.HasValue(%Copy.facet.701) [concrete] // CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Optional.Get.018, @Optional.Get(%Copy.facet.701) [concrete] @@ -986,11 +1032,17 @@ fn Run() { // CHECK:STDOUT: %Copy.impl_witness_table.bda = impl_witness_table (%Core.import_ref.9c3), @bool.as.Copy.impl [concrete] // CHECK:STDOUT: %Core.import_ref.1db: @Optional.%Optional.HasValue.type (%Optional.HasValue.type.224) = import_ref Core//prelude/parts/iterate, inst{{[0-9A-F]+}} [indirect], loaded [symbolic = @Optional.%Optional.HasValue (constants.%Optional.HasValue.c4f)] // CHECK:STDOUT: %Core.import_ref.73b: @Optional.%Optional.Get.type (%Optional.Get.type.e1b) = import_ref Core//prelude/parts/iterate, inst{{[0-9A-F]+}} [indirect], loaded [symbolic = @Optional.%Optional.Get (constants.%Optional.Get.20c)] +// CHECK:STDOUT: %Core.import_ref.613: @Optional.%Optional.elem.1 (%Optional.elem.2fa) = import_ref Core//prelude/parts/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.4a0] +// CHECK:STDOUT: %Core.import_ref.7e3: @Optional.%Optional.elem.2 (%Optional.elem.2ae) = import_ref Core//prelude/parts/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.c67] // CHECK:STDOUT: %Main.import_ref.71a = import_ref Main//empty_range, loc7_68, unloaded // CHECK:STDOUT: %Main.import_ref.999 = import_ref Main//empty_range, loc7_68, unloaded // CHECK:STDOUT: %Main.import_ref.b6b: @EmptyRange.as.Iterate.impl.%EmptyRange.as.Iterate.impl.NewCursor.type (%EmptyRange.as.Iterate.impl.NewCursor.type.561) = import_ref Main//empty_range, loc8_37, loaded [symbolic = @EmptyRange.as.Iterate.impl.%EmptyRange.as.Iterate.impl.NewCursor (constants.%EmptyRange.as.Iterate.impl.NewCursor.31b)] // CHECK:STDOUT: %Main.import_ref.b499: @EmptyRange.as.Iterate.impl.%EmptyRange.as.Iterate.impl.Next.type (%EmptyRange.as.Iterate.impl.Next.type.c04) = import_ref Main//empty_range, loc11_66, loaded [symbolic = @EmptyRange.as.Iterate.impl.%EmptyRange.as.Iterate.impl.Next (constants.%EmptyRange.as.Iterate.impl.Next.cdc)] // CHECK:STDOUT: %Iterate.impl_witness_table = impl_witness_table (%Main.import_ref.71a, %Main.import_ref.999, %Main.import_ref.b6b, %Main.import_ref.b499), @EmptyRange.as.Iterate.impl [concrete] +// CHECK:STDOUT: %Core.import_ref.127 = import_ref Core//prelude/parts/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.c67: @Optional.%Optional.elem.2 (%Optional.elem.2ae) = field_decl value, element1, %Core.import_ref.127 in [concrete] {} +// CHECK:STDOUT: %Core.import_ref.b0d0 = import_ref Core//prelude/parts/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.4a0: @Optional.%Optional.elem.1 (%Optional.elem.2fa) = field_decl has_value, element0, %Core.import_ref.b0d0 in [concrete] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { @@ -1224,6 +1276,14 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc10_61.4(%self.param: ref %Optional.4d1) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %value.ref: %Optional.elem.4bf = name_ref value, imports.%Core.import_ref.7e3 [concrete = imports.%field_decl.c67] +// CHECK:STDOUT: %.loc10_61.1: ref %tuple.type.784 = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc10_61.1: = bound_method %.loc10_61.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc10_61.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc10_61.1(%.loc10_61.1) +// CHECK:STDOUT: %has_value.ref: %Optional.elem.6d4 = name_ref has_value, imports.%Core.import_ref.613 [concrete = imports.%field_decl.4a0] +// CHECK:STDOUT: %.loc10_61.2: ref bool = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc10_61.2: = bound_method %.loc10_61.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc10_61.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc10_61.2(%.loc10_61.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1282,6 +1342,7 @@ fn Run() { // CHECK:STDOUT: %EmptyRange.Make.0de: %EmptyRange.Make.type.140 = struct_value () [symbolic] // CHECK:STDOUT: %tuple.type.693: type = tuple_type (type, type) [concrete] // CHECK:STDOUT: %tuple.391: %tuple.type.693 = tuple_value (%C, %C) [concrete] +// CHECK:STDOUT: %T.as_type.c1c: type = facet_access_type %T.f84 [symbolic] // CHECK:STDOUT: %U: %Copy.type = symbolic_binding U, 1 [symbolic] // CHECK:STDOUT: %tuple.type.as.Copy.impl.Op.type.3ed: type = fn_type @tuple.type.as.Copy.impl.Op.1, @tuple.type.as.Copy.impl.9bd(%T.f84, %U) [symbolic] // CHECK:STDOUT: %tuple.type.as.Copy.impl.Op.0f8: %tuple.type.as.Copy.impl.Op.type.3ed = struct_value () [symbolic] @@ -1295,6 +1356,9 @@ fn Run() { // CHECK:STDOUT: %pattern_type.2a0: type = pattern_type %EmptyRange.8d3 [concrete] // CHECK:STDOUT: %EmptyRange.Make.specific_fn: = specific_function %EmptyRange.Make.24e, @EmptyRange.Make(%Copy.facet.38c) [concrete] // CHECK:STDOUT: %Iterate.type: type = facet_type <@Iterate> [concrete] +// CHECK:STDOUT: %Optional.e88: type = class_type @Optional, @Optional(%T.f84) [symbolic] +// CHECK:STDOUT: %Optional.elem.2ae: type = unbound_element_type %Optional.e88, %T.as_type.c1c [symbolic] +// CHECK:STDOUT: %Optional.elem.2fa: type = unbound_element_type %Optional.e88, bool [symbolic] // CHECK:STDOUT: %Optional.Get.type.e1b: type = fn_type @Optional.Get, @Optional(%T.f84) [symbolic] // CHECK:STDOUT: %Optional.Get.20c: %Optional.Get.type.e1b = struct_value () [symbolic] // CHECK:STDOUT: %Optional.HasValue.type.224: type = fn_type @Optional.HasValue, @Optional(%T.f84) [symbolic] @@ -1323,6 +1387,8 @@ fn Run() { // CHECK:STDOUT: %Optional.HasValue.b06: %Optional.HasValue.type.e1b = struct_value () [concrete] // CHECK:STDOUT: %Optional.Get.type.4b3: type = fn_type @Optional.Get, @Optional(%Copy.facet.38c) [concrete] // CHECK:STDOUT: %Optional.Get.091: %Optional.Get.type.4b3 = struct_value () [concrete] +// CHECK:STDOUT: %Optional.elem.684: type = unbound_element_type %Optional.992, bool [concrete] +// CHECK:STDOUT: %Optional.elem.14f: type = unbound_element_type %Optional.992, %tuple.type.748 [concrete] // CHECK:STDOUT: %struct_type.has_value.value.9b1: type = struct_type {.has_value: bool, .value: %tuple.type.748} [concrete] // CHECK:STDOUT: %Optional.HasValue.specific_fn: = specific_function %Optional.HasValue.b06, @Optional.HasValue(%Copy.facet.38c) [concrete] // CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Optional.Get.091, @Optional.Get(%Copy.facet.38c) [concrete] @@ -1397,11 +1463,17 @@ fn Run() { // CHECK:STDOUT: %Copy.impl_witness_table.b4f = impl_witness_table (%Main.import_ref.341), @C.as.Copy.impl [concrete] // CHECK:STDOUT: %Core.import_ref.1db: @Optional.%Optional.HasValue.type (%Optional.HasValue.type.224) = import_ref Core//prelude/parts/iterate, inst{{[0-9A-F]+}} [indirect], loaded [symbolic = @Optional.%Optional.HasValue (constants.%Optional.HasValue.c4f)] // CHECK:STDOUT: %Core.import_ref.73b: @Optional.%Optional.Get.type (%Optional.Get.type.e1b) = import_ref Core//prelude/parts/iterate, inst{{[0-9A-F]+}} [indirect], loaded [symbolic = @Optional.%Optional.Get (constants.%Optional.Get.20c)] +// CHECK:STDOUT: %Core.import_ref.613: @Optional.%Optional.elem.1 (%Optional.elem.2fa) = import_ref Core//prelude/parts/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.4a0] +// CHECK:STDOUT: %Core.import_ref.7e3: @Optional.%Optional.elem.2 (%Optional.elem.2ae) = import_ref Core//prelude/parts/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.c67] // CHECK:STDOUT: %Main.import_ref.71a = import_ref Main//empty_range, loc7_68, unloaded // CHECK:STDOUT: %Main.import_ref.999 = import_ref Main//empty_range, loc7_68, unloaded // CHECK:STDOUT: %Main.import_ref.b6b: @EmptyRange.as.Iterate.impl.%EmptyRange.as.Iterate.impl.NewCursor.type (%EmptyRange.as.Iterate.impl.NewCursor.type.561) = import_ref Main//empty_range, loc8_37, loaded [symbolic = @EmptyRange.as.Iterate.impl.%EmptyRange.as.Iterate.impl.NewCursor (constants.%EmptyRange.as.Iterate.impl.NewCursor.31b)] // CHECK:STDOUT: %Main.import_ref.b499: @EmptyRange.as.Iterate.impl.%EmptyRange.as.Iterate.impl.Next.type (%EmptyRange.as.Iterate.impl.Next.type.c04) = import_ref Main//empty_range, loc11_66, loaded [symbolic = @EmptyRange.as.Iterate.impl.%EmptyRange.as.Iterate.impl.Next (constants.%EmptyRange.as.Iterate.impl.Next.cdc)] // CHECK:STDOUT: %Iterate.impl_witness_table = impl_witness_table (%Main.import_ref.71a, %Main.import_ref.999, %Main.import_ref.b6b, %Main.import_ref.b499), @EmptyRange.as.Iterate.impl [concrete] +// CHECK:STDOUT: %Core.import_ref.127 = import_ref Core//prelude/parts/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.c67: @Optional.%Optional.elem.2 (%Optional.elem.2ae) = field_decl value, element1, %Core.import_ref.127 in [concrete] {} +// CHECK:STDOUT: %Core.import_ref.b0d = import_ref Core//prelude/parts/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.4a0: @Optional.%Optional.elem.1 (%Optional.elem.2fa) = field_decl has_value, element0, %Core.import_ref.b0d in [concrete] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { @@ -1671,6 +1743,14 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc10_49.6(%self.param: ref %Optional.992) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %value.ref: %Optional.elem.14f = name_ref value, imports.%Core.import_ref.7e3 [concrete = imports.%field_decl.c67] +// CHECK:STDOUT: %.loc10_49.1: ref %tuple.type.748 = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc10_49.1: = bound_method %.loc10_49.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc10_49.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc10_49.1(%.loc10_49.1) +// CHECK:STDOUT: %has_value.ref: %Optional.elem.684 = name_ref has_value, imports.%Core.import_ref.613 [concrete = imports.%field_decl.4a0] +// CHECK:STDOUT: %.loc10_49.2: ref bool = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc10_49.2: = bound_method %.loc10_49.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc10_49.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc10_49.2(%.loc10_49.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/generic/return_slot.carbon b/toolchain/check/testdata/function/generic/return_slot.carbon index d378b74ed838..5296f25b79d5 100644 --- a/toolchain/check/testdata/function/generic/return_slot.carbon +++ b/toolchain/check/testdata/function/generic/return_slot.carbon @@ -910,6 +910,10 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc24_3.4(%self.param: ref %C) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %arr.ref: %C.elem = name_ref arr, @C.%field_decl [concrete = @C.%field_decl] +// CHECK:STDOUT: %.loc24: ref %array_type = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = 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: diff --git a/toolchain/check/testdata/generic/local.carbon b/toolchain/check/testdata/generic/local.carbon index 5a3e780672cf..36705fe0afe1 100644 --- a/toolchain/check/testdata/generic/local.carbon +++ b/toolchain/check/testdata/generic/local.carbon @@ -289,6 +289,10 @@ class C(C: type) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc8_3.3(%self.param: ref %C.8eb) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %x.ref: %C.elem.14f = name_ref x, @C.%field_decl [concrete = @C.%field_decl] +// CHECK:STDOUT: %.loc8: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc8, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc8) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/generic/template/convert.carbon b/toolchain/check/testdata/generic/template/convert.carbon index 5ff8a563c078..71e9534af610 100644 --- a/toolchain/check/testdata/generic/template/convert.carbon +++ b/toolchain/check/testdata/generic/template/convert.carbon @@ -1349,6 +1349,8 @@ fn F() { // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.836 = facet_value %X, (%ImplicitAs.impl_witness) [concrete] // CHECK:STDOUT: %ImplicitAs.WithSelf.Convert.type.bb3: type = fn_type @ImplicitAs.WithSelf.Convert, @ImplicitAs.WithSelf(%Y, %ImplicitAs.facet) [concrete] // CHECK:STDOUT: %Z: type = class_type @Z [concrete] +// CHECK:STDOUT: %Z.elem.d23: type = unbound_element_type %Z, %X [concrete] +// CHECK:STDOUT: %Z.elem.5d0: type = unbound_element_type %Z, %Y [concrete] // CHECK:STDOUT: %struct_type.a.b.297: type = struct_type {.a: %X, .b: %Y} [concrete] // CHECK:STDOUT: %struct_type.a.b.095: type = struct_type {.a: %Y, .b: %Y} [concrete] // CHECK:STDOUT: %tuple.type.2f4: type = tuple_type (%struct_type.a.b.095, %Y) [concrete] @@ -1944,6 +1946,14 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc9_3.9(%self.param: ref %Z) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %b.ref: %Z.elem.5d0 = name_ref b, @Z.%field_decl.loc21 [concrete = @Z.%field_decl.loc21] +// CHECK:STDOUT: %.loc9_3.1: ref %Y = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc9_3.1: = bound_method %.loc9_3.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.5 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc9_3.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc9_3.1(%.loc9_3.1) +// CHECK:STDOUT: %a.ref: %Z.elem.d23 = name_ref a, @Z.%field_decl.loc20 [concrete = @Z.%field_decl.loc20] +// CHECK:STDOUT: %.loc9_3.2: ref %X = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc9_3.2: = bound_method %.loc9_3.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc9_3.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc9_3.2(%.loc9_3.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -2708,6 +2718,10 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc22_14.4(%self.param: ref %A.d32110.1) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %field.ref: %A.elem.483 = name_ref field, @A.%field_decl [concrete = @A.%field_decl] +// CHECK:STDOUT: %.loc22: ref %B = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc22, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc22) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/extend_impl_generic.carbon b/toolchain/check/testdata/impl/extend_impl_generic.carbon index 79e517edc052..14bf98d4ee4a 100644 --- a/toolchain/check/testdata/impl/extend_impl_generic.carbon +++ b/toolchain/check/testdata/impl/extend_impl_generic.carbon @@ -457,6 +457,10 @@ class X(U: type) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc22_27.3(%self.param: ref %Param) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %x.ref: %Param.elem = name_ref x, @Param.%field_decl [concrete = @Param.%field_decl] +// CHECK:STDOUT: %.loc22: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc22, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc22) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/impl_thunk.carbon b/toolchain/check/testdata/impl/impl_thunk.carbon index 9253de9d5e99..d9fbc8f9c1d3 100644 --- a/toolchain/check/testdata/impl/impl_thunk.carbon +++ b/toolchain/check/testdata/impl/impl_thunk.carbon @@ -1084,6 +1084,7 @@ impl () as I({}) { // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %B: type = class_type @B [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %B.elem: type = unbound_element_type %B, %A [concrete] // CHECK:STDOUT: %struct_type.base.cb7: type = struct_type {.base: %A} [concrete] // CHECK:STDOUT: %X.type: type = facet_type <@X> [concrete] // CHECK:STDOUT: %X.impl_witness: = impl_witness @A.as.X.impl.%X.impl_witness_table [concrete] @@ -1270,6 +1271,10 @@ impl () as I({}) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc23_14.4(%self.param: ref %B) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %base.ref: %B.elem = name_ref base, @B.%.loc5 [concrete = @B.%.loc5] +// CHECK:STDOUT: %.loc23: ref %A = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc23, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.2 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc23) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interop/cpp/impls/destroy.carbon b/toolchain/check/testdata/interop/cpp/impls/destroy.carbon index 5ba080dfa968..e212ef03c949 100644 --- a/toolchain/check/testdata/interop/cpp/impls/destroy.carbon +++ b/toolchain/check/testdata/interop/cpp/impls/destroy.carbon @@ -440,6 +440,7 @@ fn F() { // CHECK:STDOUT: %ProtectedDestructor: type = class_type @ProtectedDestructor [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %Derived.elem: type = unbound_element_type %Derived, %ProtectedDestructor [concrete] // CHECK:STDOUT: %struct_type.base.454: type = struct_type {.base: %ProtectedDestructor} [concrete] // CHECK:STDOUT: %pattern_type.746: type = pattern_type %Derived [concrete] // CHECK:STDOUT: %a.patt: %pattern_type.746 = ref_binding_pattern a [concrete] @@ -574,6 +575,10 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc20_3.2(%self.param: ref %Derived) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %base.ref: %Derived.elem = name_ref base, @Derived.%.loc7 [concrete = @Derived.%.loc7] +// CHECK:STDOUT: %.loc20: ref %ProtectedDestructor = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc20, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc20) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -594,6 +599,7 @@ fn F() { // CHECK:STDOUT: %PrivateDestructor: type = class_type @PrivateDestructor [concrete] // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] +// CHECK:STDOUT: %Derived.elem: type = unbound_element_type %Derived, %PrivateDestructor [concrete] // CHECK:STDOUT: %struct_type.base.9aa: type = struct_type {.base: %PrivateDestructor} [concrete] // CHECK:STDOUT: %pattern_type.746: type = pattern_type %Derived [concrete] // CHECK:STDOUT: %a.patt: %pattern_type.746 = ref_binding_pattern a [concrete] @@ -728,6 +734,10 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc21_3.2(%self.param: ref %Derived) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %base.ref: %Derived.elem = name_ref base, @Derived.%.loc7 [concrete = @Derived.%.loc7] +// CHECK:STDOUT: %.loc21: ref %PrivateDestructor = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc21, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc21) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interop/cpp/range_for.carbon b/toolchain/check/testdata/interop/cpp/range_for.carbon index 6e5e588827a3..dafa095f6df5 100644 --- a/toolchain/check/testdata/interop/cpp/range_for.carbon +++ b/toolchain/check/testdata/interop/cpp/range_for.carbon @@ -804,7 +804,13 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Optional.HasValue.type.e9e: type = fn_type @Optional.HasValue, @Optional(%T.220) [symbolic] // CHECK:STDOUT: %Optional.HasValue.6cd: %Optional.HasValue.type.e9e = struct_value () [symbolic] // CHECK:STDOUT: %T.283: %facet_type.f48 = symbolic_binding T, 0 [symbolic] +// CHECK:STDOUT: %T.as_type.74b: type = facet_access_type %T.283 [symbolic] +// CHECK:STDOUT: %Destroy.lookup_impl_witness.28a: = lookup_impl_witness %T.283, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet.16e: %Destroy.type = facet_value %T.as_type.74b, (%Destroy.lookup_impl_witness.28a) [symbolic] +// CHECK:STDOUT: %MaybeUnformed.a4b: type = class_type @MaybeUnformed, @MaybeUnformed(%Destroy.facet.16e) [symbolic] // CHECK:STDOUT: %DefaultOptionalStorage.d50: type = class_type @DefaultOptionalStorage, @DefaultOptionalStorage(%T.283) [symbolic] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.e4c: type = unbound_element_type %DefaultOptionalStorage.d50, bool [symbolic] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.915: type = unbound_element_type %DefaultOptionalStorage.d50, %MaybeUnformed.a4b [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Get.type.a12: type = fn_type @T.as_type.as.OptionalStorage.impl.Get, @T.as_type.as.OptionalStorage.impl(%T.283) [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Get.d32: %T.as_type.as.OptionalStorage.impl.Get.type.a12 = struct_value () [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Has.type.e5a: type = fn_type @T.as_type.as.OptionalStorage.impl.Has, @T.as_type.as.OptionalStorage.impl(%T.283) [symbolic] @@ -896,6 +902,8 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Optional.Get.529: %Optional.Get.type.2b4 = struct_value () [concrete] // CHECK:STDOUT: %MaybeUnformed.515: type = class_type @MaybeUnformed, @MaybeUnformed(%Destroy.facet.b41) [concrete] // CHECK:STDOUT: %.1d6a7: type = maybe_unformed_type %i32 [concrete] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.02c: type = unbound_element_type %DefaultOptionalStorage.9f1, %MaybeUnformed.515 [concrete] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.c79: type = unbound_element_type %DefaultOptionalStorage.9f1, bool [concrete] // CHECK:STDOUT: %struct_type.value.has_value.f6a: type = struct_type {.value: %MaybeUnformed.515, .has_value: bool} [concrete] // CHECK:STDOUT: %Optional.HasValue.specific_fn.15f: = specific_function %Optional.HasValue.ed9, @Optional.HasValue(%OptionalStorage.facet.6c5) [concrete] // CHECK:STDOUT: %Optional.Get.specific_fn.0dd: = specific_function %Optional.Get.529, @Optional.Get(%OptionalStorage.facet.6c5) [concrete] @@ -1099,6 +1107,8 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Core.import_ref.e9c: @T.as_type.as.OptionalStorage.impl.%T.as_type.as.OptionalStorage.impl.Get.type (%T.as_type.as.OptionalStorage.impl.Get.type.a12) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [symbolic = @T.as_type.as.OptionalStorage.impl.%T.as_type.as.OptionalStorage.impl.Get (constants.%T.as_type.as.OptionalStorage.impl.Get.d32)] // CHECK:STDOUT: %Core.import_ref.0b2 = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], unloaded // CHECK:STDOUT: %OptionalStorage.impl_witness_table.460 = impl_witness_table (%Core.import_ref.0c6, %Core.import_ref.dc3, %Core.import_ref.c53, %Core.import_ref.ed4, %Core.import_ref.e9c, %Core.import_ref.0b2), @T.as_type.as.OptionalStorage.impl [concrete] +// CHECK:STDOUT: %Core.import_ref.e97: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.1 (%DefaultOptionalStorage.elem.915) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.a85] +// CHECK:STDOUT: %Core.import_ref.c86: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.2 (%DefaultOptionalStorage.elem.e4c) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.a94] // CHECK:STDOUT: %Core.import_ref.eef: %facet_type.f48 = import_ref Core//prelude/iterate, loc{{\d+_\d+}}, loaded [symbolic = @T.as_type.as.Iterate.impl.%facet_value (constants.%facet_value.f93)] // CHECK:STDOUT: %Core.import_ref.fcc: %Destroy.type = import_ref Core//prelude/iterate, loc{{\d+_\d+}}, loaded [symbolic = @T.as_type.as.Iterate.impl.%Destroy.facet (constants.%Destroy.facet.9cd)] // CHECK:STDOUT: %Core.import_ref.fd1: @T.as_type.as.Iterate.impl.%T.as_type.as.Iterate.impl.NewCursor.type (%T.as_type.as.Iterate.impl.NewCursor.type.953) = import_ref Core//prelude/iterate, loc{{\d+_\d+}}, loaded [symbolic = @T.as_type.as.Iterate.impl.%T.as_type.as.Iterate.impl.NewCursor (constants.%T.as_type.as.Iterate.impl.NewCursor.544)] @@ -1114,6 +1124,10 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Core.import_ref.47b: Core.IntLiteral = import_ref Core//prelude/types/int, loc{{\d+_\d+}}, loaded [symbolic = @Int.as.AnyInt.impl.%N (constants.%N.fe9)] // CHECK:STDOUT: %Core.import_ref.49b: @Int.as.AnyInt.impl.%Int.as.AnyInt.impl.AsInt.type (%Int.as.AnyInt.impl.AsInt.type.f15) = import_ref Core//prelude/types/int, loc{{\d+_\d+}}, loaded [symbolic = @Int.as.AnyInt.impl.%Int.as.AnyInt.impl.AsInt (constants.%Int.as.AnyInt.impl.AsInt.d10)] // CHECK:STDOUT: %AnyInt.impl_witness_table = impl_witness_table (%Core.import_ref.47b, %Core.import_ref.49b), @Int.as.AnyInt.impl [concrete] +// CHECK:STDOUT: %Core.import_ref.b0d = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.a94: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.2 (%DefaultOptionalStorage.elem.e4c) = field_decl has_value, element1, %Core.import_ref.b0d in [concrete] {} +// CHECK:STDOUT: %Core.import_ref.bb4 = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.a85: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.1 (%DefaultOptionalStorage.elem.915) = field_decl value, element0, %Core.import_ref.bb4 in [concrete] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { @@ -1372,6 +1386,14 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc34_19.5(%self.param: ref %DefaultOptionalStorage.9f1) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %has_value.ref: %DefaultOptionalStorage.elem.c79 = name_ref has_value, imports.%Core.import_ref.c86 [concrete = imports.%field_decl.a94] +// CHECK:STDOUT: %.loc34_19.1: ref bool = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc34_19.1: = bound_method %.loc34_19.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc34_19.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc34_19.1(%.loc34_19.1) +// CHECK:STDOUT: %value.ref: %DefaultOptionalStorage.elem.02c = name_ref value, imports.%Core.import_ref.e97 [concrete = imports.%field_decl.a85] +// CHECK:STDOUT: %.loc34_19.2: ref %MaybeUnformed.515 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc34_19.2: = bound_method %.loc34_19.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.3 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc34_19.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc34_19.2(%.loc34_19.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1638,7 +1660,13 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Optional.HasValue.type.e9e: type = fn_type @Optional.HasValue, @Optional(%T.220) [symbolic] // CHECK:STDOUT: %Optional.HasValue.6cd: %Optional.HasValue.type.e9e = struct_value () [symbolic] // CHECK:STDOUT: %T.283: %facet_type.f48 = symbolic_binding T, 0 [symbolic] +// CHECK:STDOUT: %T.as_type.74b: type = facet_access_type %T.283 [symbolic] +// CHECK:STDOUT: %Destroy.lookup_impl_witness.28a: = lookup_impl_witness %T.283, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet.16e: %Destroy.type = facet_value %T.as_type.74b, (%Destroy.lookup_impl_witness.28a) [symbolic] +// CHECK:STDOUT: %MaybeUnformed.a4b: type = class_type @MaybeUnformed, @MaybeUnformed(%Destroy.facet.16e) [symbolic] // CHECK:STDOUT: %DefaultOptionalStorage.d50: type = class_type @DefaultOptionalStorage, @DefaultOptionalStorage(%T.283) [symbolic] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.e4c: type = unbound_element_type %DefaultOptionalStorage.d50, bool [symbolic] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.915: type = unbound_element_type %DefaultOptionalStorage.d50, %MaybeUnformed.a4b [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Get.type.a12: type = fn_type @T.as_type.as.OptionalStorage.impl.Get, @T.as_type.as.OptionalStorage.impl(%T.283) [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Get.d32: %T.as_type.as.OptionalStorage.impl.Get.type.a12 = struct_value () [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Has.type.e5a: type = fn_type @T.as_type.as.OptionalStorage.impl.Has, @T.as_type.as.OptionalStorage.impl(%T.283) [symbolic] @@ -1725,6 +1753,8 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Destroy.facet.be4: %Destroy.type = facet_value %DiffValueType, (%custom_witness.1bfa2a.1) [concrete] // CHECK:STDOUT: %MaybeUnformed.632: type = class_type @MaybeUnformed, @MaybeUnformed(%Destroy.facet.be4) [concrete] // CHECK:STDOUT: %.a18: type = maybe_unformed_type %DiffValueType [concrete] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.07a: type = unbound_element_type %DefaultOptionalStorage.9a0, %MaybeUnformed.632 [concrete] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.b49: type = unbound_element_type %DefaultOptionalStorage.9a0, bool [concrete] // CHECK:STDOUT: %struct_type.value.has_value.851: type = struct_type {.value: %MaybeUnformed.632, .has_value: bool} [concrete] // CHECK:STDOUT: %Optional.HasValue.specific_fn.a20: = specific_function %Optional.HasValue.960, @Optional.HasValue(%OptionalStorage.facet.beb) [concrete] // CHECK:STDOUT: %Optional.Get.specific_fn.084: = specific_function %Optional.Get.294, @Optional.Get(%OptionalStorage.facet.beb) [concrete] @@ -1925,6 +1955,8 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Core.import_ref.e9c: @T.as_type.as.OptionalStorage.impl.%T.as_type.as.OptionalStorage.impl.Get.type (%T.as_type.as.OptionalStorage.impl.Get.type.a12) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [symbolic = @T.as_type.as.OptionalStorage.impl.%T.as_type.as.OptionalStorage.impl.Get (constants.%T.as_type.as.OptionalStorage.impl.Get.d32)] // CHECK:STDOUT: %Core.import_ref.0b2 = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], unloaded // CHECK:STDOUT: %OptionalStorage.impl_witness_table.460 = impl_witness_table (%Core.import_ref.0c6, %Core.import_ref.dc3, %Core.import_ref.c53, %Core.import_ref.ed4, %Core.import_ref.e9c, %Core.import_ref.0b2), @T.as_type.as.OptionalStorage.impl [concrete] +// CHECK:STDOUT: %Core.import_ref.e97: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.1 (%DefaultOptionalStorage.elem.915) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.a85] +// CHECK:STDOUT: %Core.import_ref.c86: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.2 (%DefaultOptionalStorage.elem.e4c) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.a94] // CHECK:STDOUT: %Core.import_ref.eef: %facet_type.f48 = import_ref Core//prelude/iterate, loc{{\d+_\d+}}, loaded [symbolic = @T.as_type.as.Iterate.impl.%facet_value (constants.%facet_value.f93)] // CHECK:STDOUT: %Core.import_ref.fcc: %Destroy.type = import_ref Core//prelude/iterate, loc{{\d+_\d+}}, loaded [symbolic = @T.as_type.as.Iterate.impl.%Destroy.facet (constants.%Destroy.facet.9cd)] // CHECK:STDOUT: %Core.import_ref.fd1: @T.as_type.as.Iterate.impl.%T.as_type.as.Iterate.impl.NewCursor.type (%T.as_type.as.Iterate.impl.NewCursor.type.953) = import_ref Core//prelude/iterate, loc{{\d+_\d+}}, loaded [symbolic = @T.as_type.as.Iterate.impl.%T.as_type.as.Iterate.impl.NewCursor (constants.%T.as_type.as.Iterate.impl.NewCursor.544)] @@ -1936,6 +1968,10 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: } { // CHECK:STDOUT: // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.b0d = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.a94: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.2 (%DefaultOptionalStorage.elem.e4c) = field_decl has_value, element1, %Core.import_ref.b0d in [concrete] {} +// CHECK:STDOUT: %Core.import_ref.bb4 = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.a85: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.1 (%DefaultOptionalStorage.elem.915) = field_decl value, element0, %Core.import_ref.bb4 in [concrete] {} // CHECK:STDOUT: %DiffMutableRange.decl: type = class_decl @DiffMutableRange [concrete = constants.%DiffMutableRange] {} {} // CHECK:STDOUT: %DiffConstRange.decl: type = class_decl @DiffConstRange [concrete = constants.%DiffConstRange] {} {} // CHECK:STDOUT: } @@ -2199,6 +2235,14 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc44_33.5(%self.param: ref %DefaultOptionalStorage.9a0) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %has_value.ref: %DefaultOptionalStorage.elem.b49 = name_ref has_value, imports.%Core.import_ref.c86 [concrete = imports.%field_decl.a94] +// CHECK:STDOUT: %.loc44_33.1: ref bool = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc44_33.1: = bound_method %.loc44_33.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.5 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc44_33.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc44_33.1(%.loc44_33.1) +// CHECK:STDOUT: %value.ref: %DefaultOptionalStorage.elem.07a = name_ref value, imports.%Core.import_ref.e97 [concrete = imports.%field_decl.a85] +// CHECK:STDOUT: %.loc44_33.2: ref %MaybeUnformed.632 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc44_33.2: = bound_method %.loc44_33.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc44_33.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc44_33.2(%.loc44_33.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -2467,7 +2511,13 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Optional.HasValue.type.e9e: type = fn_type @Optional.HasValue, @Optional(%T.220) [symbolic] // CHECK:STDOUT: %Optional.HasValue.6cd: %Optional.HasValue.type.e9e = struct_value () [symbolic] // CHECK:STDOUT: %T.283: %facet_type.f48 = symbolic_binding T, 0 [symbolic] +// CHECK:STDOUT: %T.as_type.74b: type = facet_access_type %T.283 [symbolic] +// CHECK:STDOUT: %Destroy.lookup_impl_witness.28a: = lookup_impl_witness %T.283, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet.16e: %Destroy.type = facet_value %T.as_type.74b, (%Destroy.lookup_impl_witness.28a) [symbolic] +// CHECK:STDOUT: %MaybeUnformed.a4b: type = class_type @MaybeUnformed, @MaybeUnformed(%Destroy.facet.16e) [symbolic] // CHECK:STDOUT: %DefaultOptionalStorage.d50: type = class_type @DefaultOptionalStorage, @DefaultOptionalStorage(%T.283) [symbolic] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.e4c: type = unbound_element_type %DefaultOptionalStorage.d50, bool [symbolic] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.915: type = unbound_element_type %DefaultOptionalStorage.d50, %MaybeUnformed.a4b [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Get.type.a12: type = fn_type @T.as_type.as.OptionalStorage.impl.Get, @T.as_type.as.OptionalStorage.impl(%T.283) [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Get.d32: %T.as_type.as.OptionalStorage.impl.Get.type.a12 = struct_value () [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Has.type.e5a: type = fn_type @T.as_type.as.OptionalStorage.impl.Has, @T.as_type.as.OptionalStorage.impl(%T.283) [symbolic] @@ -2551,6 +2601,8 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Destroy.facet.d74: %Destroy.type = facet_value %OverloadValueType, (%custom_witness.1bfa2a.1) [concrete] // CHECK:STDOUT: %MaybeUnformed.d16: type = class_type @MaybeUnformed, @MaybeUnformed(%Destroy.facet.d74) [concrete] // CHECK:STDOUT: %.8a2: type = maybe_unformed_type %OverloadValueType [concrete] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.dbb: type = unbound_element_type %DefaultOptionalStorage.fbc, %MaybeUnformed.d16 [concrete] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.02d: type = unbound_element_type %DefaultOptionalStorage.fbc, bool [concrete] // CHECK:STDOUT: %struct_type.value.has_value.35f: type = struct_type {.value: %MaybeUnformed.d16, .has_value: bool} [concrete] // CHECK:STDOUT: %Optional.HasValue.specific_fn.730: = specific_function %Optional.HasValue.ab3, @Optional.HasValue(%OptionalStorage.facet.50c) [concrete] // CHECK:STDOUT: %Optional.Get.specific_fn.f34: = specific_function %Optional.Get.4ea, @Optional.Get(%OptionalStorage.facet.50c) [concrete] @@ -2677,12 +2729,18 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Core.import_ref.e9c: @T.as_type.as.OptionalStorage.impl.%T.as_type.as.OptionalStorage.impl.Get.type (%T.as_type.as.OptionalStorage.impl.Get.type.a12) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [symbolic = @T.as_type.as.OptionalStorage.impl.%T.as_type.as.OptionalStorage.impl.Get (constants.%T.as_type.as.OptionalStorage.impl.Get.d32)] // CHECK:STDOUT: %Core.import_ref.0b2 = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], unloaded // CHECK:STDOUT: %OptionalStorage.impl_witness_table.460 = impl_witness_table (%Core.import_ref.0c6, %Core.import_ref.dc3, %Core.import_ref.c53, %Core.import_ref.ed4, %Core.import_ref.e9c, %Core.import_ref.0b2), @T.as_type.as.OptionalStorage.impl [concrete] +// CHECK:STDOUT: %Core.import_ref.e97: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.1 (%DefaultOptionalStorage.elem.915) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.a85] +// CHECK:STDOUT: %Core.import_ref.c86: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.2 (%DefaultOptionalStorage.elem.e4c) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.a94] // CHECK:STDOUT: %Core.import_ref.eef: %facet_type.f48 = import_ref Core//prelude/iterate, loc{{\d+_\d+}}, loaded [symbolic = @T.as_type.as.Iterate.impl.%facet_value (constants.%facet_value.f93)] // CHECK:STDOUT: %Core.import_ref.fcc: %Destroy.type = import_ref Core//prelude/iterate, loc{{\d+_\d+}}, loaded [symbolic = @T.as_type.as.Iterate.impl.%Destroy.facet (constants.%Destroy.facet.9cd)] // CHECK:STDOUT: %Core.import_ref.fd1: @T.as_type.as.Iterate.impl.%T.as_type.as.Iterate.impl.NewCursor.type (%T.as_type.as.Iterate.impl.NewCursor.type.953) = import_ref Core//prelude/iterate, loc{{\d+_\d+}}, loaded [symbolic = @T.as_type.as.Iterate.impl.%T.as_type.as.Iterate.impl.NewCursor (constants.%T.as_type.as.Iterate.impl.NewCursor.544)] // CHECK:STDOUT: %Core.import_ref.273: @T.as_type.as.Iterate.impl.%T.as_type.as.Iterate.impl.Next.type (%T.as_type.as.Iterate.impl.Next.type.b36) = import_ref Core//prelude/iterate, loc{{\d+_\d+}}, loaded [symbolic = @T.as_type.as.Iterate.impl.%T.as_type.as.Iterate.impl.Next (constants.%T.as_type.as.Iterate.impl.Next.d6b)] // CHECK:STDOUT: %Iterate.impl_witness_table.121 = impl_witness_table (%Core.import_ref.eef, %Core.import_ref.fcc, %Core.import_ref.fd1, %Core.import_ref.273), @T.as_type.as.Iterate.impl [concrete] // CHECK:STDOUT: %OverloadValueType.decl: type = class_decl @OverloadValueType [concrete = constants.%OverloadValueType] {} {} +// CHECK:STDOUT: %Core.import_ref.b0d = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.a94: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.2 (%DefaultOptionalStorage.elem.e4c) = field_decl has_value, element1, %Core.import_ref.b0d in [concrete] {} +// CHECK:STDOUT: %Core.import_ref.bb4 = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.a85: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.1 (%DefaultOptionalStorage.elem.915) = field_decl value, element0, %Core.import_ref.bb4 in [concrete] {} // CHECK:STDOUT: %Range.decl: type = class_decl @Range [concrete = constants.%Range] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: @@ -2937,6 +2995,14 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc27_37.5(%self.param: ref %DefaultOptionalStorage.fbc) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %has_value.ref: %DefaultOptionalStorage.elem.02d = name_ref has_value, imports.%Core.import_ref.c86 [concrete = imports.%field_decl.a94] +// CHECK:STDOUT: %.loc27_37.1: ref bool = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc27_37.1: = bound_method %.loc27_37.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.5 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc27_37.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc27_37.1(%.loc27_37.1) +// CHECK:STDOUT: %value.ref: %DefaultOptionalStorage.elem.dbb = name_ref value, imports.%Core.import_ref.e97 [concrete = imports.%field_decl.a85] +// CHECK:STDOUT: %.loc27_37.2: ref %MaybeUnformed.d16 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc27_37.2: = bound_method %.loc27_37.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc27_37.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc27_37.2(%.loc27_37.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -3091,7 +3157,13 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Optional.HasValue.type.e9e: type = fn_type @Optional.HasValue, @Optional(%T.220) [symbolic] // CHECK:STDOUT: %Optional.HasValue.6cd: %Optional.HasValue.type.e9e = struct_value () [symbolic] // CHECK:STDOUT: %T.283: %facet_type.f48 = symbolic_binding T, 0 [symbolic] +// CHECK:STDOUT: %T.as_type.74b: type = facet_access_type %T.283 [symbolic] +// CHECK:STDOUT: %Destroy.lookup_impl_witness.28a: = lookup_impl_witness %T.283, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet.16e: %Destroy.type = facet_value %T.as_type.74b, (%Destroy.lookup_impl_witness.28a) [symbolic] +// CHECK:STDOUT: %MaybeUnformed.a4b: type = class_type @MaybeUnformed, @MaybeUnformed(%Destroy.facet.16e) [symbolic] // CHECK:STDOUT: %DefaultOptionalStorage.d50: type = class_type @DefaultOptionalStorage, @DefaultOptionalStorage(%T.283) [symbolic] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.e4c: type = unbound_element_type %DefaultOptionalStorage.d50, bool [symbolic] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.915: type = unbound_element_type %DefaultOptionalStorage.d50, %MaybeUnformed.a4b [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Get.type.a12: type = fn_type @T.as_type.as.OptionalStorage.impl.Get, @T.as_type.as.OptionalStorage.impl(%T.283) [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Get.d32: %T.as_type.as.OptionalStorage.impl.Get.type.a12 = struct_value () [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Has.type.e5a: type = fn_type @T.as_type.as.OptionalStorage.impl.Has, @T.as_type.as.OptionalStorage.impl(%T.283) [symbolic] @@ -3175,6 +3247,8 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Destroy.facet.d87: %Destroy.type = facet_value %f64.dc1, (%custom_witness.f8f19d.2) [concrete] // CHECK:STDOUT: %MaybeUnformed.8ff: type = class_type @MaybeUnformed, @MaybeUnformed(%Destroy.facet.d87) [concrete] // CHECK:STDOUT: %.cc0: type = maybe_unformed_type %f64.dc1 [concrete] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.b21: type = unbound_element_type %DefaultOptionalStorage.3e2, %MaybeUnformed.8ff [concrete] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.645: type = unbound_element_type %DefaultOptionalStorage.3e2, bool [concrete] // CHECK:STDOUT: %struct_type.value.has_value.58e: type = struct_type {.value: %MaybeUnformed.8ff, .has_value: bool} [concrete] // CHECK:STDOUT: %Optional.HasValue.specific_fn.9fc: = specific_function %Optional.HasValue.776, @Optional.HasValue(%OptionalStorage.facet.405) [concrete] // CHECK:STDOUT: %Optional.Get.specific_fn.e69: = specific_function %Optional.Get.cb6, @Optional.Get(%OptionalStorage.facet.405) [concrete] @@ -3308,6 +3382,8 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Core.import_ref.e9c: @T.as_type.as.OptionalStorage.impl.%T.as_type.as.OptionalStorage.impl.Get.type (%T.as_type.as.OptionalStorage.impl.Get.type.a12) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [symbolic = @T.as_type.as.OptionalStorage.impl.%T.as_type.as.OptionalStorage.impl.Get (constants.%T.as_type.as.OptionalStorage.impl.Get.d32)] // CHECK:STDOUT: %Core.import_ref.0b2 = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], unloaded // CHECK:STDOUT: %OptionalStorage.impl_witness_table.460 = impl_witness_table (%Core.import_ref.0c6, %Core.import_ref.dc3, %Core.import_ref.c530, %Core.import_ref.ed4, %Core.import_ref.e9c, %Core.import_ref.0b2), @T.as_type.as.OptionalStorage.impl [concrete] +// CHECK:STDOUT: %Core.import_ref.e978: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.1 (%DefaultOptionalStorage.elem.915) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.a85] +// CHECK:STDOUT: %Core.import_ref.c86: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.2 (%DefaultOptionalStorage.elem.e4c) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.a94] // CHECK:STDOUT: %Core.import_ref.eef: %facet_type.f48 = import_ref Core//prelude/iterate, loc{{\d+_\d+}}, loaded [symbolic = @T.as_type.as.Iterate.impl.%facet_value (constants.%facet_value.f93)] // CHECK:STDOUT: %Core.import_ref.fcc: %Destroy.type = import_ref Core//prelude/iterate, loc{{\d+_\d+}}, loaded [symbolic = @T.as_type.as.Iterate.impl.%Destroy.facet (constants.%Destroy.facet.9cd)] // CHECK:STDOUT: %Core.import_ref.fd1a: @T.as_type.as.Iterate.impl.%T.as_type.as.Iterate.impl.NewCursor.type (%T.as_type.as.Iterate.impl.NewCursor.type.953) = import_ref Core//prelude/iterate, loc{{\d+_\d+}}, loaded [symbolic = @T.as_type.as.Iterate.impl.%T.as_type.as.Iterate.impl.NewCursor (constants.%T.as_type.as.Iterate.impl.NewCursor.544)] @@ -3317,6 +3393,10 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Copy.impl_witness_table.8dd = impl_witness_table (%Core.import_ref.e69), @Float.as.Copy.impl [concrete] // CHECK:STDOUT: %Core.import_ref.cb3: @Float.as.AddAssignWith.impl.%Float.as.AddAssignWith.impl.Op.type (%Float.as.AddAssignWith.impl.Op.type.fdd) = import_ref Core//prelude/types/float, loc{{\d+_\d+}}, loaded [symbolic = @Float.as.AddAssignWith.impl.%Float.as.AddAssignWith.impl.Op (constants.%Float.as.AddAssignWith.impl.Op.430)] // CHECK:STDOUT: %AddAssignWith.impl_witness_table = impl_witness_table (%Core.import_ref.cb3), @Float.as.AddAssignWith.impl [concrete] +// CHECK:STDOUT: %Core.import_ref.b0d = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.a94: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.2 (%DefaultOptionalStorage.elem.e4c) = field_decl has_value, element1, %Core.import_ref.b0d in [concrete] {} +// CHECK:STDOUT: %Core.import_ref.bb4 = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.a85: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.1 (%DefaultOptionalStorage.elem.915) = field_decl value, element0, %Core.import_ref.bb4 in [concrete] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { @@ -3570,6 +3650,14 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc24_19.5(%self.param: ref %DefaultOptionalStorage.3e2) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %has_value.ref: %DefaultOptionalStorage.elem.645 = name_ref has_value, imports.%Core.import_ref.c86 [concrete = imports.%field_decl.a94] +// CHECK:STDOUT: %.loc24_19.1: ref bool = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc24_19.1: = bound_method %.loc24_19.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.5 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc24_19.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc24_19.1(%.loc24_19.1) +// CHECK:STDOUT: %value.ref: %DefaultOptionalStorage.elem.b21 = name_ref value, imports.%Core.import_ref.e978 [concrete = imports.%field_decl.a85] +// CHECK:STDOUT: %.loc24_19.2: ref %MaybeUnformed.8ff = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc24_19.2: = bound_method %.loc24_19.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc24_19.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc24_19.2(%.loc24_19.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -3724,7 +3812,13 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Optional.HasValue.type.e9e: type = fn_type @Optional.HasValue, @Optional(%T.220) [symbolic] // CHECK:STDOUT: %Optional.HasValue.6cd: %Optional.HasValue.type.e9e = struct_value () [symbolic] // CHECK:STDOUT: %T.283: %facet_type.f48 = symbolic_binding T, 0 [symbolic] +// CHECK:STDOUT: %T.as_type.74b: type = facet_access_type %T.283 [symbolic] +// CHECK:STDOUT: %Destroy.lookup_impl_witness.28a: = lookup_impl_witness %T.283, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet.16e: %Destroy.type = facet_value %T.as_type.74b, (%Destroy.lookup_impl_witness.28a) [symbolic] +// CHECK:STDOUT: %MaybeUnformed.a4b: type = class_type @MaybeUnformed, @MaybeUnformed(%Destroy.facet.16e) [symbolic] // CHECK:STDOUT: %DefaultOptionalStorage.d50: type = class_type @DefaultOptionalStorage, @DefaultOptionalStorage(%T.283) [symbolic] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.e4c: type = unbound_element_type %DefaultOptionalStorage.d50, bool [symbolic] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.915: type = unbound_element_type %DefaultOptionalStorage.d50, %MaybeUnformed.a4b [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Get.type.a12: type = fn_type @T.as_type.as.OptionalStorage.impl.Get, @T.as_type.as.OptionalStorage.impl(%T.283) [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Get.d32: %T.as_type.as.OptionalStorage.impl.Get.type.a12 = struct_value () [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Has.type.e5a: type = fn_type @T.as_type.as.OptionalStorage.impl.Has, @T.as_type.as.OptionalStorage.impl(%T.283) [symbolic] @@ -3808,6 +3902,8 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Destroy.facet.d87: %Destroy.type = facet_value %f64.dc1, (%custom_witness.f8f19d.2) [concrete] // CHECK:STDOUT: %MaybeUnformed.8ff: type = class_type @MaybeUnformed, @MaybeUnformed(%Destroy.facet.d87) [concrete] // CHECK:STDOUT: %.cc0: type = maybe_unformed_type %f64.dc1 [concrete] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.b21: type = unbound_element_type %DefaultOptionalStorage.3e2, %MaybeUnformed.8ff [concrete] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.645: type = unbound_element_type %DefaultOptionalStorage.3e2, bool [concrete] // CHECK:STDOUT: %struct_type.value.has_value.58e: type = struct_type {.value: %MaybeUnformed.8ff, .has_value: bool} [concrete] // CHECK:STDOUT: %Optional.HasValue.specific_fn.9fc: = specific_function %Optional.HasValue.776, @Optional.HasValue(%OptionalStorage.facet.405) [concrete] // CHECK:STDOUT: %Optional.Get.specific_fn.e69: = specific_function %Optional.Get.cb6, @Optional.Get(%OptionalStorage.facet.405) [concrete] @@ -3941,6 +4037,8 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Core.import_ref.e9c: @T.as_type.as.OptionalStorage.impl.%T.as_type.as.OptionalStorage.impl.Get.type (%T.as_type.as.OptionalStorage.impl.Get.type.a12) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [symbolic = @T.as_type.as.OptionalStorage.impl.%T.as_type.as.OptionalStorage.impl.Get (constants.%T.as_type.as.OptionalStorage.impl.Get.d32)] // CHECK:STDOUT: %Core.import_ref.0b2 = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], unloaded // CHECK:STDOUT: %OptionalStorage.impl_witness_table.460 = impl_witness_table (%Core.import_ref.0c6, %Core.import_ref.dc3, %Core.import_ref.c530, %Core.import_ref.ed4, %Core.import_ref.e9c, %Core.import_ref.0b2), @T.as_type.as.OptionalStorage.impl [concrete] +// CHECK:STDOUT: %Core.import_ref.e978: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.1 (%DefaultOptionalStorage.elem.915) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.a85] +// CHECK:STDOUT: %Core.import_ref.c86: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.2 (%DefaultOptionalStorage.elem.e4c) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.a94] // CHECK:STDOUT: %Core.import_ref.eef: %facet_type.f48 = import_ref Core//prelude/iterate, loc{{\d+_\d+}}, loaded [symbolic = @T.as_type.as.Iterate.impl.%facet_value (constants.%facet_value.f93)] // CHECK:STDOUT: %Core.import_ref.fcc: %Destroy.type = import_ref Core//prelude/iterate, loc{{\d+_\d+}}, loaded [symbolic = @T.as_type.as.Iterate.impl.%Destroy.facet (constants.%Destroy.facet.9cd)] // CHECK:STDOUT: %Core.import_ref.fd1a: @T.as_type.as.Iterate.impl.%T.as_type.as.Iterate.impl.NewCursor.type (%T.as_type.as.Iterate.impl.NewCursor.type.953) = import_ref Core//prelude/iterate, loc{{\d+_\d+}}, loaded [symbolic = @T.as_type.as.Iterate.impl.%T.as_type.as.Iterate.impl.NewCursor (constants.%T.as_type.as.Iterate.impl.NewCursor.544)] @@ -3950,6 +4048,10 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Copy.impl_witness_table.8dd = impl_witness_table (%Core.import_ref.e69), @Float.as.Copy.impl [concrete] // CHECK:STDOUT: %Core.import_ref.cb3: @Float.as.AddAssignWith.impl.%Float.as.AddAssignWith.impl.Op.type (%Float.as.AddAssignWith.impl.Op.type.fdd) = import_ref Core//prelude/types/float, loc{{\d+_\d+}}, loaded [symbolic = @Float.as.AddAssignWith.impl.%Float.as.AddAssignWith.impl.Op (constants.%Float.as.AddAssignWith.impl.Op.430)] // CHECK:STDOUT: %AddAssignWith.impl_witness_table = impl_witness_table (%Core.import_ref.cb3), @Float.as.AddAssignWith.impl [concrete] +// CHECK:STDOUT: %Core.import_ref.b0d = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.a94: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.2 (%DefaultOptionalStorage.elem.e4c) = field_decl has_value, element1, %Core.import_ref.b0d in [concrete] {} +// CHECK:STDOUT: %Core.import_ref.bb4 = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.a85: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.1 (%DefaultOptionalStorage.elem.915) = field_decl value, element0, %Core.import_ref.bb4 in [concrete] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: generated { @@ -4203,6 +4305,14 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc26_19.5(%self.param: ref %DefaultOptionalStorage.3e2) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %has_value.ref: %DefaultOptionalStorage.elem.645 = name_ref has_value, imports.%Core.import_ref.c86 [concrete = imports.%field_decl.a94] +// CHECK:STDOUT: %.loc26_19.1: ref bool = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc26_19.1: = bound_method %.loc26_19.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.5 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc26_19.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc26_19.1(%.loc26_19.1) +// CHECK:STDOUT: %value.ref: %DefaultOptionalStorage.elem.b21 = name_ref value, imports.%Core.import_ref.e978 [concrete = imports.%field_decl.a85] +// CHECK:STDOUT: %.loc26_19.2: ref %MaybeUnformed.8ff = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc26_19.2: = bound_method %.loc26_19.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc26_19.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc26_19.2(%.loc26_19.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -4359,7 +4469,13 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Optional.HasValue.type.e9e: type = fn_type @Optional.HasValue, @Optional(%T.220) [symbolic] // CHECK:STDOUT: %Optional.HasValue.6cd: %Optional.HasValue.type.e9e = struct_value () [symbolic] // CHECK:STDOUT: %T.283: %facet_type.f48 = symbolic_binding T, 0 [symbolic] +// CHECK:STDOUT: %T.as_type.74b: type = facet_access_type %T.283 [symbolic] +// CHECK:STDOUT: %Destroy.lookup_impl_witness.28a: = lookup_impl_witness %T.283, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet.16e: %Destroy.type = facet_value %T.as_type.74b, (%Destroy.lookup_impl_witness.28a) [symbolic] +// CHECK:STDOUT: %MaybeUnformed.a4b: type = class_type @MaybeUnformed, @MaybeUnformed(%Destroy.facet.16e) [symbolic] // CHECK:STDOUT: %DefaultOptionalStorage.d50: type = class_type @DefaultOptionalStorage, @DefaultOptionalStorage(%T.283) [symbolic] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.e4c: type = unbound_element_type %DefaultOptionalStorage.d50, bool [symbolic] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.915: type = unbound_element_type %DefaultOptionalStorage.d50, %MaybeUnformed.a4b [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Get.type.a12: type = fn_type @T.as_type.as.OptionalStorage.impl.Get, @T.as_type.as.OptionalStorage.impl(%T.283) [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Get.d32: %T.as_type.as.OptionalStorage.impl.Get.type.a12 = struct_value () [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Has.type.e5a: type = fn_type @T.as_type.as.OptionalStorage.impl.Has, @T.as_type.as.OptionalStorage.impl(%T.283) [symbolic] @@ -4446,6 +4562,8 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Destroy.facet.c1d: %Destroy.type = facet_value %ValueType, (%custom_witness.226) [concrete] // CHECK:STDOUT: %MaybeUnformed.e45: type = class_type @MaybeUnformed, @MaybeUnformed(%Destroy.facet.c1d) [concrete] // CHECK:STDOUT: %.be1: type = maybe_unformed_type %ValueType [concrete] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.457: type = unbound_element_type %DefaultOptionalStorage.53f, %MaybeUnformed.e45 [concrete] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.6ad: type = unbound_element_type %DefaultOptionalStorage.53f, bool [concrete] // CHECK:STDOUT: %struct_type.value.has_value.619: type = struct_type {.value: %MaybeUnformed.e45, .has_value: bool} [concrete] // CHECK:STDOUT: %Optional.HasValue.specific_fn.524: = specific_function %Optional.HasValue.ba9d, @Optional.HasValue(%OptionalStorage.facet.b3c) [concrete] // CHECK:STDOUT: %Optional.Get.specific_fn.f41: = specific_function %Optional.Get.da9, @Optional.Get(%OptionalStorage.facet.b3c) [concrete] @@ -4581,6 +4699,8 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Core.import_ref.e9c: @T.as_type.as.OptionalStorage.impl.%T.as_type.as.OptionalStorage.impl.Get.type (%T.as_type.as.OptionalStorage.impl.Get.type.a12) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [symbolic = @T.as_type.as.OptionalStorage.impl.%T.as_type.as.OptionalStorage.impl.Get (constants.%T.as_type.as.OptionalStorage.impl.Get.d32)] // CHECK:STDOUT: %Core.import_ref.0b2 = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], unloaded // CHECK:STDOUT: %OptionalStorage.impl_witness_table.460 = impl_witness_table (%Core.import_ref.0c6, %Core.import_ref.dc3, %Core.import_ref.c53, %Core.import_ref.ed4, %Core.import_ref.e9c, %Core.import_ref.0b2), @T.as_type.as.OptionalStorage.impl [concrete] +// CHECK:STDOUT: %Core.import_ref.e97: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.1 (%DefaultOptionalStorage.elem.915) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.a85] +// CHECK:STDOUT: %Core.import_ref.c86: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.2 (%DefaultOptionalStorage.elem.e4c) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.a94] // CHECK:STDOUT: %Core.import_ref.eef: %facet_type.f48 = import_ref Core//prelude/iterate, loc{{\d+_\d+}}, loaded [symbolic = @T.as_type.as.Iterate.impl.%facet_value (constants.%facet_value.f93)] // CHECK:STDOUT: %Core.import_ref.fcc: %Destroy.type = import_ref Core//prelude/iterate, loc{{\d+_\d+}}, loaded [symbolic = @T.as_type.as.Iterate.impl.%Destroy.facet (constants.%Destroy.facet.9cd)] // CHECK:STDOUT: %Core.import_ref.fd1: @T.as_type.as.Iterate.impl.%T.as_type.as.Iterate.impl.NewCursor.type (%T.as_type.as.Iterate.impl.NewCursor.type.953) = import_ref Core//prelude/iterate, loc{{\d+_\d+}}, loaded [symbolic = @T.as_type.as.Iterate.impl.%T.as_type.as.Iterate.impl.NewCursor (constants.%T.as_type.as.Iterate.impl.NewCursor.544)] @@ -4597,6 +4717,10 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: } { // CHECK:STDOUT: // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.b0d = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.a94: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.2 (%DefaultOptionalStorage.elem.e4c) = field_decl has_value, element1, %Core.import_ref.b0d in [concrete] {} +// CHECK:STDOUT: %Core.import_ref.bb4 = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.a85: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.1 (%DefaultOptionalStorage.elem.915) = field_decl value, element0, %Core.import_ref.bb4 in [concrete] {} // CHECK:STDOUT: %ConstRange.decl: type = class_decl @ConstRange [concrete = constants.%ConstRange] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: @@ -4858,6 +4982,14 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc31_37.5(%self.param: ref %DefaultOptionalStorage.53f) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %has_value.ref: %DefaultOptionalStorage.elem.6ad = name_ref has_value, imports.%Core.import_ref.c86 [concrete = imports.%field_decl.a94] +// CHECK:STDOUT: %.loc31_37.1: ref bool = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc31_37.1: = bound_method %.loc31_37.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.5 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc31_37.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc31_37.1(%.loc31_37.1) +// CHECK:STDOUT: %value.ref: %DefaultOptionalStorage.elem.457 = name_ref value, imports.%Core.import_ref.e97 [concrete = imports.%field_decl.a85] +// CHECK:STDOUT: %.loc31_37.2: ref %MaybeUnformed.e45 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc31_37.2: = bound_method %.loc31_37.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc31_37.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc31_37.2(%.loc31_37.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -5019,7 +5151,13 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Optional.HasValue.type.e9e: type = fn_type @Optional.HasValue, @Optional(%T.220) [symbolic] // CHECK:STDOUT: %Optional.HasValue.6cd: %Optional.HasValue.type.e9e = struct_value () [symbolic] // CHECK:STDOUT: %T.283: %facet_type.f48 = symbolic_binding T, 0 [symbolic] +// CHECK:STDOUT: %T.as_type.74b: type = facet_access_type %T.283 [symbolic] +// CHECK:STDOUT: %Destroy.lookup_impl_witness.28a: = lookup_impl_witness %T.283, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet.16e: %Destroy.type = facet_value %T.as_type.74b, (%Destroy.lookup_impl_witness.28a) [symbolic] +// CHECK:STDOUT: %MaybeUnformed.a4b: type = class_type @MaybeUnformed, @MaybeUnformed(%Destroy.facet.16e) [symbolic] // CHECK:STDOUT: %DefaultOptionalStorage.d50: type = class_type @DefaultOptionalStorage, @DefaultOptionalStorage(%T.283) [symbolic] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.e4c: type = unbound_element_type %DefaultOptionalStorage.d50, bool [symbolic] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.915: type = unbound_element_type %DefaultOptionalStorage.d50, %MaybeUnformed.a4b [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Get.type.a12: type = fn_type @T.as_type.as.OptionalStorage.impl.Get, @T.as_type.as.OptionalStorage.impl(%T.283) [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Get.d32: %T.as_type.as.OptionalStorage.impl.Get.type.a12 = struct_value () [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Has.type.e5a: type = fn_type @T.as_type.as.OptionalStorage.impl.Has, @T.as_type.as.OptionalStorage.impl(%T.283) [symbolic] @@ -5077,6 +5215,8 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Destroy.facet.6cb: %Destroy.type = facet_value %ValueType, (%custom_witness.3ec) [concrete] // CHECK:STDOUT: %MaybeUnformed.8ca: type = class_type @MaybeUnformed, @MaybeUnformed(%Destroy.facet.6cb) [concrete] // CHECK:STDOUT: %.dd1: type = maybe_unformed_type %ValueType [concrete] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.cea: type = unbound_element_type %DefaultOptionalStorage.6f8, %MaybeUnformed.8ca [concrete] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.64d: type = unbound_element_type %DefaultOptionalStorage.6f8, bool [concrete] // CHECK:STDOUT: %struct_type.value.has_value.786: type = struct_type {.value: %MaybeUnformed.8ca, .has_value: bool} [concrete] // CHECK:STDOUT: %Optional.HasValue.specific_fn: = specific_function %Optional.HasValue.c86, @Optional.HasValue(%OptionalStorage.facet.864) [concrete] // CHECK:STDOUT: %Optional.Get.specific_fn: = specific_function %Optional.Get.d4a, @Optional.Get(%OptionalStorage.facet.864) [concrete] @@ -5150,6 +5290,8 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Core.import_ref.e9c: @T.as_type.as.OptionalStorage.impl.%T.as_type.as.OptionalStorage.impl.Get.type (%T.as_type.as.OptionalStorage.impl.Get.type.a12) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [symbolic = @T.as_type.as.OptionalStorage.impl.%T.as_type.as.OptionalStorage.impl.Get (constants.%T.as_type.as.OptionalStorage.impl.Get.d32)] // CHECK:STDOUT: %Core.import_ref.0b2 = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], unloaded // CHECK:STDOUT: %OptionalStorage.impl_witness_table.460 = impl_witness_table (%Core.import_ref.0c6, %Core.import_ref.daf, %Core.import_ref.bd4, %Core.import_ref.ed4, %Core.import_ref.e9c, %Core.import_ref.0b2), @T.as_type.as.OptionalStorage.impl [concrete] +// CHECK:STDOUT: %Core.import_ref.e97: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.1 (%DefaultOptionalStorage.elem.915) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.a85] +// CHECK:STDOUT: %Core.import_ref.c86: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.2 (%DefaultOptionalStorage.elem.e4c) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.a94] // CHECK:STDOUT: %DiffMutableADL: = namespace [concrete] { // CHECK:STDOUT: .ValueType = %ValueType.decl // CHECK:STDOUT: .MutableRange = %MutableRange.decl @@ -5161,6 +5303,10 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: } { // CHECK:STDOUT: // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.b0d = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.a94: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.2 (%DefaultOptionalStorage.elem.e4c) = field_decl has_value, element1, %Core.import_ref.b0d in [concrete] {} +// CHECK:STDOUT: %Core.import_ref.bb4 = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.a85: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.1 (%DefaultOptionalStorage.elem.915) = field_decl value, element0, %Core.import_ref.bb4 in [concrete] {} // CHECK:STDOUT: %MutableRange.decl: type = class_decl @MutableRange [concrete = constants.%MutableRange] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: @@ -5422,6 +5568,14 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc31_44.5(%self.param: ref %DefaultOptionalStorage.6f8) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %has_value.ref: %DefaultOptionalStorage.elem.64d = name_ref has_value, imports.%Core.import_ref.c86 [concrete = imports.%field_decl.a94] +// CHECK:STDOUT: %.loc31_44.1: ref bool = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc31_44.1: = bound_method %.loc31_44.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.5 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc31_44.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc31_44.1(%.loc31_44.1) +// CHECK:STDOUT: %value.ref: %DefaultOptionalStorage.elem.cea = name_ref value, imports.%Core.import_ref.e97 [concrete = imports.%field_decl.a85] +// CHECK:STDOUT: %.loc31_44.2: ref %MaybeUnformed.8ca = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc31_44.2: = bound_method %.loc31_44.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc31_44.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc31_44.2(%.loc31_44.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -5502,7 +5656,13 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Optional.HasValue.type.e9e: type = fn_type @Optional.HasValue, @Optional(%T.220) [symbolic] // CHECK:STDOUT: %Optional.HasValue.6cd: %Optional.HasValue.type.e9e = struct_value () [symbolic] // CHECK:STDOUT: %T.283: %facet_type.f48 = symbolic_binding T, 0 [symbolic] +// CHECK:STDOUT: %T.as_type.74b: type = facet_access_type %T.283 [symbolic] +// CHECK:STDOUT: %Destroy.lookup_impl_witness.28a: = lookup_impl_witness %T.283, @Destroy [symbolic] +// CHECK:STDOUT: %Destroy.facet.16e: %Destroy.type = facet_value %T.as_type.74b, (%Destroy.lookup_impl_witness.28a) [symbolic] +// CHECK:STDOUT: %MaybeUnformed.a4b: type = class_type @MaybeUnformed, @MaybeUnformed(%Destroy.facet.16e) [symbolic] // CHECK:STDOUT: %DefaultOptionalStorage.d50: type = class_type @DefaultOptionalStorage, @DefaultOptionalStorage(%T.283) [symbolic] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.e4c: type = unbound_element_type %DefaultOptionalStorage.d50, bool [symbolic] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.915: type = unbound_element_type %DefaultOptionalStorage.d50, %MaybeUnformed.a4b [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Get.type.a12: type = fn_type @T.as_type.as.OptionalStorage.impl.Get, @T.as_type.as.OptionalStorage.impl(%T.283) [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Get.d32: %T.as_type.as.OptionalStorage.impl.Get.type.a12 = struct_value () [symbolic] // CHECK:STDOUT: %T.as_type.as.OptionalStorage.impl.Has.type.e5a: type = fn_type @T.as_type.as.OptionalStorage.impl.Has, @T.as_type.as.OptionalStorage.impl(%T.283) [symbolic] @@ -5589,6 +5749,8 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Destroy.facet.745: %Destroy.type = facet_value %ValueType, (%custom_witness.dc3) [concrete] // CHECK:STDOUT: %MaybeUnformed.0af: type = class_type @MaybeUnformed, @MaybeUnformed(%Destroy.facet.745) [concrete] // CHECK:STDOUT: %.8f3: type = maybe_unformed_type %ValueType [concrete] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.147: type = unbound_element_type %DefaultOptionalStorage.58e, %MaybeUnformed.0af [concrete] +// CHECK:STDOUT: %DefaultOptionalStorage.elem.6ce: type = unbound_element_type %DefaultOptionalStorage.58e, bool [concrete] // CHECK:STDOUT: %struct_type.value.has_value.ac3: type = struct_type {.value: %MaybeUnformed.0af, .has_value: bool} [concrete] // CHECK:STDOUT: %Optional.HasValue.specific_fn.e2e: = specific_function %Optional.HasValue.f75, @Optional.HasValue(%OptionalStorage.facet.e68) [concrete] // CHECK:STDOUT: %Optional.Get.specific_fn.296: = specific_function %Optional.Get.483, @Optional.Get(%OptionalStorage.facet.e68) [concrete] @@ -5716,6 +5878,8 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: %Core.import_ref.e9c: @T.as_type.as.OptionalStorage.impl.%T.as_type.as.OptionalStorage.impl.Get.type (%T.as_type.as.OptionalStorage.impl.Get.type.a12) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [symbolic = @T.as_type.as.OptionalStorage.impl.%T.as_type.as.OptionalStorage.impl.Get (constants.%T.as_type.as.OptionalStorage.impl.Get.d32)] // CHECK:STDOUT: %Core.import_ref.0b2 = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], unloaded // CHECK:STDOUT: %OptionalStorage.impl_witness_table.460 = impl_witness_table (%Core.import_ref.0c6, %Core.import_ref.dc3, %Core.import_ref.c53, %Core.import_ref.ed4, %Core.import_ref.e9c, %Core.import_ref.0b2), @T.as_type.as.OptionalStorage.impl [concrete] +// CHECK:STDOUT: %Core.import_ref.e97: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.1 (%DefaultOptionalStorage.elem.915) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.a85] +// CHECK:STDOUT: %Core.import_ref.c86: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.2 (%DefaultOptionalStorage.elem.e4c) = import_ref Core//prelude/iterate, inst{{[0-9A-F]+}} [indirect], loaded [concrete = %field_decl.a94] // CHECK:STDOUT: %Core.import_ref.eef: %facet_type.f48 = import_ref Core//prelude/iterate, loc{{\d+_\d+}}, loaded [symbolic = @T.as_type.as.Iterate.impl.%facet_value (constants.%facet_value.f93)] // CHECK:STDOUT: %Core.import_ref.fcc: %Destroy.type = import_ref Core//prelude/iterate, loc{{\d+_\d+}}, loaded [symbolic = @T.as_type.as.Iterate.impl.%Destroy.facet (constants.%Destroy.facet.9cd)] // CHECK:STDOUT: %Core.import_ref.fd1: @T.as_type.as.Iterate.impl.%T.as_type.as.Iterate.impl.NewCursor.type (%T.as_type.as.Iterate.impl.NewCursor.type.953) = import_ref Core//prelude/iterate, loc{{\d+_\d+}}, loaded [symbolic = @T.as_type.as.Iterate.impl.%T.as_type.as.Iterate.impl.NewCursor (constants.%T.as_type.as.Iterate.impl.NewCursor.544)] @@ -5732,6 +5896,10 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: } { // CHECK:STDOUT: // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.import_ref.b0d = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.a94: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.2 (%DefaultOptionalStorage.elem.e4c) = field_decl has_value, element1, %Core.import_ref.b0d in [concrete] {} +// CHECK:STDOUT: %Core.import_ref.bb4 = import_ref Core//prelude/types/optional, loc{{\d+_\d+}}, unloaded +// CHECK:STDOUT: %field_decl.a85: @DefaultOptionalStorage.%DefaultOptionalStorage.elem.1 (%DefaultOptionalStorage.elem.915) = field_decl value, element0, %Core.import_ref.bb4 in [concrete] {} // CHECK:STDOUT: %MutableAndConstRange.decl: type = class_decl @MutableAndConstRange [concrete = constants.%MutableAndConstRange] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: @@ -5993,6 +6161,14 @@ fn TestDriver(var no_begin_end: Cpp.NoBeginEnd, // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc38_41.5(%self.param: ref %DefaultOptionalStorage.58e) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %has_value.ref: %DefaultOptionalStorage.elem.6ce = name_ref has_value, imports.%Core.import_ref.c86 [concrete = imports.%field_decl.a94] +// CHECK:STDOUT: %.loc38_41.1: ref bool = class_element_access %self.param, element1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc38_41.1: = bound_method %.loc38_41.1, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.5 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc38_41.1: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc38_41.1(%.loc38_41.1) +// CHECK:STDOUT: %value.ref: %DefaultOptionalStorage.elem.147 = name_ref value, imports.%Core.import_ref.e97 [concrete = imports.%field_decl.a85] +// CHECK:STDOUT: %.loc38_41.2: ref %MaybeUnformed.0af = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound.loc38_41.2: = bound_method %.loc38_41.2, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.4 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call.loc38_41.2: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound.loc38_41.2(%.loc38_41.2) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/implicit_as.carbon b/toolchain/check/testdata/operators/overloaded/implicit_as.carbon index bf4efb7703eb..bd7bf2cb23a2 100644 --- a/toolchain/check/testdata/operators/overloaded/implicit_as.carbon +++ b/toolchain/check/testdata/operators/overloaded/implicit_as.carbon @@ -452,6 +452,10 @@ fn Test() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc34_20.3(%self.param: ref %X) { // CHECK:STDOUT: !entry: +// CHECK:STDOUT: %n.ref: %X.elem = name_ref n, @X.%field_decl [concrete = @X.%field_decl] +// CHECK:STDOUT: %.loc34: ref %i32 = class_element_access %self.param, element0 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.loc34, constants.%Destroy.WithSelf.SelfDestruct.db3fdb.1 +// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call %Destroy.WithSelf.SelfDestruct.bound(%.loc34) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/array/iterate.carbon b/toolchain/lower/testdata/array/iterate.carbon index 56867b508ab8..5f950ad2c436 100644 --- a/toolchain/lower/testdata/array/iterate.carbon +++ b/toolchain/lower/testdata/array/iterate.carbon @@ -112,6 +112,10 @@ fn F() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.b7a533f3082ff11b:core.Destroy.Core"(ptr %self) #0 !dbg !55 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc17_19.1.has_value = getelementptr inbounds nuw <{ i32, i1 }>, ptr %self, i32 0, i32 1, !dbg !57 +// CHECK:STDOUT: call void @"_CSelfDestruct.48e0adf639fe7af4:core.Destroy.Core"(ptr %.loc17_19.1.has_value), !dbg !57 +// CHECK:STDOUT: %.loc17_19.2.value = getelementptr inbounds nuw <{ i32, i1 }>, ptr %self, i32 0, i32 0, !dbg !57 +// CHECK:STDOUT: call void @"_CSelfDestruct.51569357b34b54dc:core.Destroy.Core"(ptr %.loc17_19.2.value), !dbg !57 // CHECK:STDOUT: ret void, !dbg !57 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/class/adapt.carbon b/toolchain/lower/testdata/class/adapt.carbon index 923ca2920fcf..c2fa8cdd16a4 100644 --- a/toolchain/lower/testdata/class/adapt.carbon +++ b/toolchain/lower/testdata/class/adapt.carbon @@ -124,6 +124,10 @@ fn DoStuff(a: Int) -> Int { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.a031f5a2c623d311:core.Destroy.Core"(ptr %self) #0 !dbg !73 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc27_3.1.b = getelementptr inbounds nuw { i32, i32 }, ptr %self, i32 0, i32 1, !dbg !75 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc27_3.1.b), !dbg !75 +// CHECK:STDOUT: %.loc27_3.2.a = getelementptr inbounds nuw { i32, i32 }, ptr %self, i32 0, i32 0, !dbg !75 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc27_3.2.a), !dbg !75 // CHECK:STDOUT: ret void, !dbg !75 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/class/basic.carbon b/toolchain/lower/testdata/class/basic.carbon index 4113fb563c47..fa4cc9523259 100644 --- a/toolchain/lower/testdata/class/basic.carbon +++ b/toolchain/lower/testdata/class/basic.carbon @@ -73,6 +73,10 @@ fn Run() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.08d9e38b928ba575:core.Destroy.Core"(ptr %self) #0 !dbg !54 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc22_3.1.b = getelementptr inbounds nuw { i32, ptr }, ptr %self, i32 0, i32 1, !dbg !56 +// CHECK:STDOUT: call void @"_CSelfDestruct.6b633cf020343e69:core.Destroy.Core"(ptr %.loc22_3.1.b), !dbg !56 +// CHECK:STDOUT: %.loc22_3.2.a = getelementptr inbounds nuw { i32, ptr }, ptr %self, i32 0, i32 0, !dbg !56 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc22_3.2.a), !dbg !56 // CHECK:STDOUT: ret void, !dbg !56 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/class/convert.carbon b/toolchain/lower/testdata/class/convert.carbon index ea86e0d5b0dd..cde07655294f 100644 --- a/toolchain/lower/testdata/class/convert.carbon +++ b/toolchain/lower/testdata/class/convert.carbon @@ -95,6 +95,8 @@ fn F(ref d: partial D) -> ref partial B { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.aecc0ff76a42614a:core.Destroy.Core"(ptr %self) #0 !dbg !62 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc14.n = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !64 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc14.n), !dbg !64 // CHECK:STDOUT: ret void, !dbg !64 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/class/field.carbon b/toolchain/lower/testdata/class/field.carbon index d1775272b37f..5f6035061c01 100644 --- a/toolchain/lower/testdata/class/field.carbon +++ b/toolchain/lower/testdata/class/field.carbon @@ -128,6 +128,10 @@ fn Run() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.08d9e38b928ba575:core.Destroy.Core"(ptr %self) #0 !dbg !68 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc14_3.1.b = getelementptr inbounds nuw { i32, ptr }, ptr %self, i32 0, i32 1, !dbg !70 +// CHECK:STDOUT: call void @"_CSelfDestruct.6b633cf020343e69:core.Destroy.Core"(ptr %.loc14_3.1.b), !dbg !70 +// CHECK:STDOUT: %.loc14_3.2.a = getelementptr inbounds nuw { i32, ptr }, ptr %self, i32 0, i32 0, !dbg !70 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc14_3.2.a), !dbg !70 // CHECK:STDOUT: ret void, !dbg !70 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -258,6 +262,10 @@ fn Run() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.2fbae80a61a11ec7:core.Destroy.Core"(ptr %self) #0 !dbg !107 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc15_3.1.b = getelementptr inbounds nuw { ptr, {} }, ptr %self, i32 0, i32 1, !dbg !109 +// CHECK:STDOUT: call void @"_CSelfDestruct.6a519b95f6f059eb:core.Destroy.Core"(ptr %.loc15_3.1.b), !dbg !109 +// CHECK:STDOUT: %.loc15_3.2.a = getelementptr inbounds nuw { ptr, {} }, ptr %self, i32 0, i32 0, !dbg !109 +// CHECK:STDOUT: call void @"_CSelfDestruct.d7c3fbe4c84d0842:core.Destroy.Core"(ptr %.loc15_3.2.a), !dbg !109 // CHECK:STDOUT: ret void, !dbg !109 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -380,6 +388,8 @@ fn Run() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.6a519b95f6f059eb:core.Destroy.Core"(ptr %self) #0 !dbg !143 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc17.v = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !145 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc17.v), !dbg !145 // CHECK:STDOUT: ret void, !dbg !145 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -410,6 +420,10 @@ fn Run() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.2fbae80a61a11ec7:core.Destroy.Core"(ptr %self) #0 !dbg !159 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc17_3.1.b = getelementptr inbounds nuw <{ ptr, { i32 } }>, ptr %self, i32 0, i32 1, !dbg !161 +// CHECK:STDOUT: call void @"_CSelfDestruct.6a519b95f6f059eb:core.Destroy.Core"(ptr %.loc17_3.1.b), !dbg !161 +// CHECK:STDOUT: %.loc17_3.2.a = getelementptr inbounds nuw <{ ptr, { i32 } }>, ptr %self, i32 0, i32 0, !dbg !161 +// CHECK:STDOUT: call void @"_CSelfDestruct.d7c3fbe4c84d0842:core.Destroy.Core"(ptr %.loc17_3.2.a), !dbg !161 // CHECK:STDOUT: ret void, !dbg !161 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/class/generic.carbon b/toolchain/lower/testdata/class/generic.carbon index c20e1f9723db..c0eb743cdd62 100644 --- a/toolchain/lower/testdata/class/generic.carbon +++ b/toolchain/lower/testdata/class/generic.carbon @@ -339,6 +339,10 @@ fn AccessTuple() -> (i32, i32, i32) { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.d012f76a41f764ee:core.Destroy.Core"(ptr %self) #0 !dbg !155 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc16_3.1.w = getelementptr inbounds nuw { i1, i32 }, ptr %self, i32 0, i32 1, !dbg !157 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc16_3.1.w), !dbg !157 +// CHECK:STDOUT: %.loc16_3.2.v = getelementptr inbounds nuw { i1, i32 }, ptr %self, i32 0, i32 0, !dbg !157 +// CHECK:STDOUT: call void @"_CSelfDestruct.48e0adf639fe7af4:core.Destroy.Core"(ptr %.loc16_3.2.v), !dbg !157 // CHECK:STDOUT: ret void, !dbg !157 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -401,6 +405,10 @@ fn AccessTuple() -> (i32, i32, i32) { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.0477b985a5aa27cc:core.Destroy.Core"(ptr %self) #0 !dbg !193 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc26_3.1.w = getelementptr inbounds nuw { i1, {} }, ptr %self, i32 0, i32 1, !dbg !195 +// CHECK:STDOUT: call void @"_CSelfDestruct.61ea2aba74ab3bf1:core.Destroy.Core"(ptr %.loc26_3.1.w), !dbg !195 +// CHECK:STDOUT: %.loc26_3.2.v = getelementptr inbounds nuw { i1, {} }, ptr %self, i32 0, i32 0, !dbg !195 +// CHECK:STDOUT: call void @"_CSelfDestruct.48e0adf639fe7af4:core.Destroy.Core"(ptr %.loc26_3.2.v), !dbg !195 // CHECK:STDOUT: ret void, !dbg !195 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -466,6 +474,10 @@ fn AccessTuple() -> (i32, i32, i32) { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.3cffcf67f1271f67:core.Destroy.Core"(ptr %self) #0 !dbg !226 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc31_3.1.w = getelementptr inbounds nuw { i1, { i32, i32, i32 } }, ptr %self, i32 0, i32 1, !dbg !228 +// CHECK:STDOUT: call void @"_CSelfDestruct.555b1314256372b8:core.Destroy.Core"(ptr %.loc31_3.1.w), !dbg !228 +// CHECK:STDOUT: %.loc31_3.2.v = getelementptr inbounds nuw { i1, { i32, i32, i32 } }, ptr %self, i32 0, i32 0, !dbg !228 +// CHECK:STDOUT: call void @"_CSelfDestruct.48e0adf639fe7af4:core.Destroy.Core"(ptr %.loc31_3.2.v), !dbg !228 // CHECK:STDOUT: ret void, !dbg !228 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/class/virtual.carbon b/toolchain/lower/testdata/class/virtual.carbon index e66e340adf01..55359ae5e4e2 100644 --- a/toolchain/lower/testdata/class/virtual.carbon +++ b/toolchain/lower/testdata/class/virtual.carbon @@ -345,6 +345,8 @@ fn Use() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.4487e305711510e9:core.Destroy.Core"(ptr %self) #0 !dbg !75 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc12.base = getelementptr inbounds nuw { ptr, {} }, ptr %self, i32 0, i32 1, !dbg !77 +// CHECK:STDOUT: call void @"_CSelfDestruct.bf085e1f873e33df:core.Destroy.Core"(ptr %.loc12.base), !dbg !77 // CHECK:STDOUT: ret void, !dbg !77 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -373,6 +375,8 @@ fn Use() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.43ed5d0e08fc7556:core.Destroy.Core"(ptr %self) #0 !dbg !91 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc12.base = getelementptr inbounds nuw { { ptr, {} } }, ptr %self, i32 0, i32 0, !dbg !93 +// CHECK:STDOUT: call void @"_CSelfDestruct.4487e305711510e9:core.Destroy.Core"(ptr %.loc12.base), !dbg !93 // CHECK:STDOUT: ret void, !dbg !93 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -656,6 +660,8 @@ fn Use() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.c6dbe0017b4c8d16:core.Destroy.Core"(ptr %self) #0 !dbg !179 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc13.m = getelementptr inbounds nuw <{ ptr, i32 }>, ptr %self, i32 0, i32 1, !dbg !181 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc13.m), !dbg !181 // CHECK:STDOUT: ret void, !dbg !181 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -809,6 +815,8 @@ fn Use() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.b25525d21a9bd472:core.Destroy.Core"(ptr %self) #0 !dbg !223 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc13.base = getelementptr inbounds nuw { { ptr } }, ptr %self, i32 0, i32 0, !dbg !225 +// CHECK:STDOUT: call void @"_CSelfDestruct.294df737cd074d60:core.Destroy.Core"(ptr %.loc13.base), !dbg !225 // CHECK:STDOUT: ret void, !dbg !225 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1011,6 +1019,8 @@ fn Use() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.b25525d21a9bd472:core.Destroy.Core"(ptr %self) #1 !dbg !281 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc14.base = getelementptr inbounds nuw { { ptr } }, ptr %self, i32 0, i32 0, !dbg !283 +// CHECK:STDOUT: call void @"_CSelfDestruct.294df737cd074d60:core.Destroy.Core"(ptr %.loc14.base), !dbg !283 // CHECK:STDOUT: ret void, !dbg !283 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1161,6 +1171,8 @@ fn Use() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.8578661a61c8bbbf:core.Destroy.Core"(ptr %self) #0 !dbg !317 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc17.v = getelementptr inbounds nuw { {} }, ptr %self, i32 0, i32 0, !dbg !319 +// CHECK:STDOUT: call void @"_CSelfDestruct.13f86630f401913f:core.Destroy.Core"(ptr %.loc17.v), !dbg !319 // CHECK:STDOUT: ret void, !dbg !319 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1397,6 +1409,8 @@ fn Use() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.b25525d21a9bd472:core.Destroy.Core"(ptr %self) #0 !dbg !401 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc15.base = getelementptr inbounds nuw { { ptr } }, ptr %self, i32 0, i32 0, !dbg !403 +// CHECK:STDOUT: call void @"_CSelfDestruct.5b23b4f14feb87e1:core.Destroy.Core"(ptr %.loc15.base), !dbg !403 // CHECK:STDOUT: ret void, !dbg !403 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -1606,6 +1620,8 @@ fn Use() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.b25525d21a9bd472:core.Destroy.Core"(ptr %self) #0 !dbg !487 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc23.base = getelementptr inbounds nuw { { ptr } }, ptr %self, i32 0, i32 0, !dbg !489 +// CHECK:STDOUT: call void @"_CSelfDestruct.294df737cd074d60:core.Destroy.Core"(ptr %.loc23.base), !dbg !489 // CHECK:STDOUT: ret void, !dbg !489 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/for/bindings.carbon b/toolchain/lower/testdata/for/bindings.carbon index 581f268f7e02..28d66c55e549 100644 --- a/toolchain/lower/testdata/for/bindings.carbon +++ b/toolchain/lower/testdata/for/bindings.carbon @@ -156,6 +156,10 @@ fn For() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.b61f4dca88958e98:core.Destroy.Core"(ptr %self) #0 !dbg !75 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc29_33.1.has_value = getelementptr inbounds nuw <{ { i32, i32 }, i1 }>, ptr %self, i32 0, i32 1, !dbg !77 +// CHECK:STDOUT: call void @"_CSelfDestruct.48e0adf639fe7af4:core.Destroy.Core"(ptr %.loc29_33.1.has_value), !dbg !77 +// CHECK:STDOUT: %.loc29_33.2.value = getelementptr inbounds nuw <{ { i32, i32 }, i1 }>, ptr %self, i32 0, i32 0, !dbg !77 +// CHECK:STDOUT: call void @"_CSelfDestruct.a69fcb7116d040b0:core.Destroy.Core"(ptr %.loc29_33.2.value), !dbg !77 // CHECK:STDOUT: ret void, !dbg !77 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/for/break_continue.carbon b/toolchain/lower/testdata/for/break_continue.carbon index 3b9901c6d04b..5a2647317001 100644 --- a/toolchain/lower/testdata/for/break_continue.carbon +++ b/toolchain/lower/testdata/for/break_continue.carbon @@ -128,6 +128,10 @@ fn For() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.b7a533f3082ff11b:core.Destroy.Core"(ptr %self) #0 !dbg !61 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc18_33.1.has_value = getelementptr inbounds nuw <{ i32, i1 }>, ptr %self, i32 0, i32 1, !dbg !63 +// CHECK:STDOUT: call void @"_CSelfDestruct.48e0adf639fe7af4:core.Destroy.Core"(ptr %.loc18_33.1.has_value), !dbg !63 +// CHECK:STDOUT: %.loc18_33.2.value = getelementptr inbounds nuw <{ i32, i1 }>, ptr %self, i32 0, i32 0, !dbg !63 +// CHECK:STDOUT: call void @"_CSelfDestruct.51569357b34b54dc:core.Destroy.Core"(ptr %.loc18_33.2.value), !dbg !63 // CHECK:STDOUT: ret void, !dbg !63 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -164,6 +168,10 @@ fn For() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.c9184c281ed4335d:core.Destroy.Core"(ptr %self) #0 !dbg !81 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc18_32.1.end = getelementptr inbounds nuw { i32, i32 }, ptr %self, i32 0, i32 1, !dbg !83 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc18_32.1.end), !dbg !83 +// CHECK:STDOUT: %.loc18_32.2.start = getelementptr inbounds nuw { i32, i32 }, ptr %self, i32 0, i32 0, !dbg !83 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc18_32.2.start), !dbg !83 // CHECK:STDOUT: ret void, !dbg !83 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/for/for.carbon b/toolchain/lower/testdata/for/for.carbon index 9b777b34d782..64864c4effc9 100644 --- a/toolchain/lower/testdata/for/for.carbon +++ b/toolchain/lower/testdata/for/for.carbon @@ -115,6 +115,10 @@ fn For() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.b7a533f3082ff11b:core.Destroy.Core"(ptr %self) #0 !dbg !55 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc19_33.1.has_value = getelementptr inbounds nuw <{ i32, i1 }>, ptr %self, i32 0, i32 1, !dbg !57 +// CHECK:STDOUT: call void @"_CSelfDestruct.48e0adf639fe7af4:core.Destroy.Core"(ptr %.loc19_33.1.has_value), !dbg !57 +// CHECK:STDOUT: %.loc19_33.2.value = getelementptr inbounds nuw <{ i32, i1 }>, ptr %self, i32 0, i32 0, !dbg !57 +// CHECK:STDOUT: call void @"_CSelfDestruct.51569357b34b54dc:core.Destroy.Core"(ptr %.loc19_33.2.value), !dbg !57 // CHECK:STDOUT: ret void, !dbg !57 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -151,6 +155,10 @@ fn For() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.c9184c281ed4335d:core.Destroy.Core"(ptr %self) #0 !dbg !75 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc19_32.1.end = getelementptr inbounds nuw { i32, i32 }, ptr %self, i32 0, i32 1, !dbg !77 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc19_32.1.end), !dbg !77 +// CHECK:STDOUT: %.loc19_32.2.start = getelementptr inbounds nuw { i32, i32 }, ptr %self, i32 0, i32 0, !dbg !77 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc19_32.2.start), !dbg !77 // CHECK:STDOUT: ret void, !dbg !77 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/generic/type_representation.carbon b/toolchain/lower/testdata/function/generic/type_representation.carbon index 9fe7245c048c..6741257d942a 100644 --- a/toolchain/lower/testdata/function/generic/type_representation.carbon +++ b/toolchain/lower/testdata/function/generic/type_representation.carbon @@ -138,6 +138,10 @@ fn F_nested_tuple(a: ((i32, i32), X)) -> ((i32, i32), X) { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.8b0bf151036f045a:core.Destroy.Core"(ptr %self) #0 !dbg !80 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc44_13.1.b = getelementptr inbounds nuw { i32, i32 }, ptr %self, i32 0, i32 1, !dbg !82 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc44_13.1.b), !dbg !82 +// CHECK:STDOUT: %.loc44_13.2.a = getelementptr inbounds nuw { i32, i32 }, ptr %self, i32 0, i32 0, !dbg !82 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc44_13.2.a), !dbg !82 // CHECK:STDOUT: ret void, !dbg !82 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/impl/import_thunk.carbon b/toolchain/lower/testdata/impl/import_thunk.carbon index afc04ce808d7..2d9504abf0f6 100644 --- a/toolchain/lower/testdata/impl/import_thunk.carbon +++ b/toolchain/lower/testdata/impl/import_thunk.carbon @@ -139,6 +139,8 @@ fn Test(a: A) -> C { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.8c4b83ecd900f1ea:core.Destroy.Core"(ptr %self) #0 !dbg !72 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc20.b = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !74 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc20.b), !dbg !74 // CHECK:STDOUT: ret void, !dbg !74 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -272,6 +274,8 @@ fn Test(a: A) -> C { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.8c4b83ecd900f1ea:core.Destroy.Core"(ptr %self) #0 !dbg !103 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc7.b = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !105 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc7.b), !dbg !105 // CHECK:STDOUT: ret void, !dbg !105 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -391,6 +395,8 @@ fn Test(a: A) -> C { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.8c4b83ecd900f1ea:core.Destroy.Core"(ptr %self) #0 !dbg !139 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc9.b = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !141 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc9.b), !dbg !141 // CHECK:STDOUT: ret void, !dbg !141 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -512,6 +518,8 @@ fn Test(a: A) -> C { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.8c4b83ecd900f1ea:core.Destroy.Core"(ptr %self) #0 !dbg !170 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc8.b = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !172 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc8.b), !dbg !172 // CHECK:STDOUT: ret void, !dbg !172 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/impl/thunk.carbon b/toolchain/lower/testdata/impl/thunk.carbon index 9b36723a6dc4..18c06d624075 100644 --- a/toolchain/lower/testdata/impl/thunk.carbon +++ b/toolchain/lower/testdata/impl/thunk.carbon @@ -143,6 +143,8 @@ fn CallCallGeneric(c: C(()), b: B) -> A { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.8c4b83ecd900f1ea:core.Destroy.Core"(ptr %self) #0 !dbg !72 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc20.b = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !74 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc20.b), !dbg !74 // CHECK:STDOUT: ret void, !dbg !74 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/interop/cpp/class/export/class.carbon b/toolchain/lower/testdata/interop/cpp/class/export/class.carbon index e2a36c805c85..1da74a9b1ab4 100644 --- a/toolchain/lower/testdata/interop/cpp/class/export/class.carbon +++ b/toolchain/lower/testdata/interop/cpp/class/export/class.carbon @@ -312,6 +312,10 @@ fn G() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.5a318796badc8ab7:core.Destroy.Core"(ptr %self) #5 !dbg !75 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc6_20.1.y = getelementptr inbounds nuw <{ ptr, i32 }>, ptr %self, i32 0, i32 1, !dbg !77 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc6_20.1.y), !dbg !77 +// CHECK:STDOUT: %.loc6_20.2.x = getelementptr inbounds nuw <{ ptr, i32 }>, ptr %self, i32 0, i32 0, !dbg !77 +// CHECK:STDOUT: call void @"_CSelfDestruct.d088c7eb746488be:core.Destroy.Core"(ptr %.loc6_20.2.x), !dbg !77 // CHECK:STDOUT: ret void, !dbg !77 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -357,6 +361,10 @@ fn G() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.98b9397038fd95a2:core.Destroy.Core"(ptr %self) #5 !dbg !99 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc11_15.1.b = getelementptr inbounds nuw { <{ ptr, i32 }>, i32 }, ptr %self, i32 0, i32 1, !dbg !101 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc11_15.1.b), !dbg !101 +// CHECK:STDOUT: %.loc11_15.2.a = getelementptr inbounds nuw { <{ ptr, i32 }>, i32 }, ptr %self, i32 0, i32 0, !dbg !101 +// CHECK:STDOUT: call void @"_CSelfDestruct.5a318796badc8ab7:core.Destroy.Core"(ptr %.loc11_15.2.a), !dbg !101 // CHECK:STDOUT: ret void, !dbg !101 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -402,6 +410,10 @@ fn G() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.bb6bd82e06513595:core.Destroy.Core"(ptr %self) #5 !dbg !123 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc16_15.1.c = getelementptr inbounds nuw { <{ ptr, i32 }>, i32 }, ptr %self, i32 0, i32 1, !dbg !125 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc16_15.1.c), !dbg !125 +// CHECK:STDOUT: %.loc16_15.2.base = getelementptr inbounds nuw { <{ ptr, i32 }>, i32 }, ptr %self, i32 0, i32 0, !dbg !125 +// CHECK:STDOUT: call void @"_CSelfDestruct.5a318796badc8ab7:core.Destroy.Core"(ptr %.loc16_15.2.base), !dbg !125 // CHECK:STDOUT: ret void, !dbg !125 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -597,6 +609,10 @@ fn G() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.718874c3c75b803e:core.Destroy.Core"(ptr %self) #2 !dbg !159 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc6_14.1.b = getelementptr inbounds nuw { i32, i32 }, ptr %self, i32 0, i32 1, !dbg !161 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc6_14.1.b), !dbg !161 +// CHECK:STDOUT: %.loc6_14.2.a = getelementptr inbounds nuw { i32, i32 }, ptr %self, i32 0, i32 0, !dbg !161 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc6_14.2.a), !dbg !161 // CHECK:STDOUT: ret void, !dbg !161 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/interop/cpp/class/import/dynamic.carbon b/toolchain/lower/testdata/interop/cpp/class/import/dynamic.carbon index 603de4edf6f7..e9ef0b7b78f7 100644 --- a/toolchain/lower/testdata/interop/cpp/class/import/dynamic.carbon +++ b/toolchain/lower/testdata/interop/cpp/class/import/dynamic.carbon @@ -132,6 +132,8 @@ fn DoThing() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.b25525d21a9bd472:core.Destroy.Core"(ptr %self) #2 !dbg !76 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc22.base = getelementptr inbounds nuw { [16 x i8] }, ptr %self, i32 0, i32 0, !dbg !78 +// CHECK:STDOUT: call void @"_CSelfDestruct.352b8f386f44a614:core.Destroy.Core"(ptr %.loc22.base), !dbg !78 // CHECK:STDOUT: ret void, !dbg !78 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/interop/cpp/class/virtual_fn.carbon b/toolchain/lower/testdata/interop/cpp/class/virtual_fn.carbon index d59d7be718cb..6635eecb05ff 100644 --- a/toolchain/lower/testdata/interop/cpp/class/virtual_fn.carbon +++ b/toolchain/lower/testdata/interop/cpp/class/virtual_fn.carbon @@ -242,6 +242,8 @@ void delete_new_Base() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.28387b086eba9957:core.Destroy.Core"(ptr %self) #8 !dbg !53 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc12.base = getelementptr inbounds nuw { [8 x i8] }, ptr %self, i32 0, i32 0, !dbg !55 +// CHECK:STDOUT: call void @"_CSelfDestruct.f2cd4feee22137a3:core.Destroy.Core"(ptr %.loc12.base), !dbg !55 // CHECK:STDOUT: ret void, !dbg !55 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -278,6 +280,8 @@ void delete_new_Base() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.294df737cd074d60:core.Destroy.Core"(ptr %self) #8 !dbg !74 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc17.base = getelementptr inbounds nuw { [8 x i8] }, ptr %self, i32 0, i32 0, !dbg !76 +// CHECK:STDOUT: call void @"_CSelfDestruct.f2cd4feee22137a3:core.Destroy.Core"(ptr %.loc17.base), !dbg !76 // CHECK:STDOUT: ret void, !dbg !76 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/interop/cpp/class/virtual_fn_carbon_only.carbon b/toolchain/lower/testdata/interop/cpp/class/virtual_fn_carbon_only.carbon index 1822feb160cf..1f40236560d3 100644 --- a/toolchain/lower/testdata/interop/cpp/class/virtual_fn_carbon_only.carbon +++ b/toolchain/lower/testdata/interop/cpp/class/virtual_fn_carbon_only.carbon @@ -108,6 +108,8 @@ fn F() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.680f7fa3ef86df7a:core.Destroy.Core"(ptr %self) #1 !dbg !39 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc18.base = getelementptr inbounds nuw { [8 x i8] }, ptr %self, i32 0, i32 0, !dbg !41 +// CHECK:STDOUT: call void @"_CSelfDestruct.3d7b8a41b4c67e71:core.Destroy.Core"(ptr %.loc18.base), !dbg !41 // CHECK:STDOUT: ret void, !dbg !41 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/interop/cpp/issue7142.carbon b/toolchain/lower/testdata/interop/cpp/issue7142.carbon index 919a9853d6ca..1799523dac32 100644 --- a/toolchain/lower/testdata/interop/cpp/issue7142.carbon +++ b/toolchain/lower/testdata/interop/cpp/issue7142.carbon @@ -94,6 +94,8 @@ void f() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.5a23cc09585c55d2:core.Destroy.Core"(ptr %self) #1 !dbg !34 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc15.price = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !36 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc15.price), !dbg !36 // CHECK:STDOUT: ret void, !dbg !36 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/let/copy_value_rep.carbon b/toolchain/lower/testdata/let/copy_value_rep.carbon index 5e3307831cc1..80d3041ac832 100644 --- a/toolchain/lower/testdata/let/copy_value_rep.carbon +++ b/toolchain/lower/testdata/let/copy_value_rep.carbon @@ -67,6 +67,8 @@ fn Run() -> i32 { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.8b0bf151036f045a:core.Destroy.Core"(ptr %self) #0 !dbg !52 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc18.a = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !54 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc18.a), !dbg !54 // CHECK:STDOUT: ret void, !dbg !54 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/operators/overloaded.carbon b/toolchain/lower/testdata/operators/overloaded.carbon index 6977132fb84a..a51ccce561d6 100644 --- a/toolchain/lower/testdata/operators/overloaded.carbon +++ b/toolchain/lower/testdata/operators/overloaded.carbon @@ -127,6 +127,8 @@ fn Calculate(a: Number, b: Number) -> Number { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.3e6115156c640ef2:core.Destroy.Core"(ptr %self) #0 !dbg !64 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc30.is_positive = getelementptr inbounds nuw { i1 }, ptr %self, i32 0, i32 0, !dbg !66 +// CHECK:STDOUT: call void @"_CSelfDestruct.48e0adf639fe7af4:core.Destroy.Core"(ptr %.loc30.is_positive), !dbg !66 // CHECK:STDOUT: ret void, !dbg !66 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/packages/separate_compilation_witness.carbon b/toolchain/lower/testdata/packages/separate_compilation_witness.carbon index edce145745f2..78360546a34e 100644 --- a/toolchain/lower/testdata/packages/separate_compilation_witness.carbon +++ b/toolchain/lower/testdata/packages/separate_compilation_witness.carbon @@ -215,6 +215,8 @@ fn CallGeneric() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.d9636b4f2fbd64a7:core.Destroy.Core"(ptr %self) #0 !dbg !65 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc5.x = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !67 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc5.x), !dbg !67 // CHECK:STDOUT: ret void, !dbg !67 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -317,6 +319,8 @@ fn CallGeneric() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.d9636b4f2fbd64a7:core.Destroy.Core"(ptr %self) #0 !dbg !98 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc7.x = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !100 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc7.x), !dbg !100 // CHECK:STDOUT: ret void, !dbg !100 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -408,6 +412,8 @@ fn CallGeneric() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.d9636b4f2fbd64a7:core.Destroy.Core"(ptr %self) #0 !dbg !122 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc6.x = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !124 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc6.x), !dbg !124 // CHECK:STDOUT: ret void, !dbg !124 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -504,6 +510,8 @@ fn CallGeneric() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.d9636b4f2fbd64a7:core.Destroy.Core"(ptr %self) #0 !dbg !151 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc7.x = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !153 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc7.x), !dbg !153 // CHECK:STDOUT: ret void, !dbg !153 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -633,6 +641,8 @@ fn CallGeneric() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.d9636b4f2fbd64a7:core.Destroy.Core"(ptr %self) #0 !dbg !195 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc7.x = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !197 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc7.x), !dbg !197 // CHECK:STDOUT: ret void, !dbg !197 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -740,6 +750,8 @@ fn CallGeneric() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.d9636b4f2fbd64a7:core.Destroy.Core"(ptr %self) #0 !dbg !222 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc7.x = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !224 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc7.x), !dbg !224 // CHECK:STDOUT: ret void, !dbg !224 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -858,6 +870,8 @@ fn CallGeneric() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.d9636b4f2fbd64a7:core.Destroy.Core"(ptr %self) #0 !dbg !255 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc6.x = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !257 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc6.x), !dbg !257 // CHECK:STDOUT: ret void, !dbg !257 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -954,6 +968,8 @@ fn CallGeneric() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.d9636b4f2fbd64a7:core.Destroy.Core"(ptr %self) #0 !dbg !282 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc7.x = getelementptr inbounds nuw { i32 }, ptr %self, i32 0, i32 0, !dbg !284 +// CHECK:STDOUT: call void @"_CSelfDestruct.f58524831c37807e:core.Destroy.Core"(ptr %.loc7.x), !dbg !284 // CHECK:STDOUT: ret void, !dbg !284 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/primitives/optional.carbon b/toolchain/lower/testdata/primitives/optional.carbon index b5bd431fc5bf..4adee65de206 100644 --- a/toolchain/lower/testdata/primitives/optional.carbon +++ b/toolchain/lower/testdata/primitives/optional.carbon @@ -186,6 +186,10 @@ fn F(c: Core.Optional(C*)) -> Core.Optional(C*) { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.d81dc56afe745c8e:core.Destroy.Core"(ptr %self) #0 !dbg !105 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc18_3.1.has_value = getelementptr inbounds nuw <{ i32, i1 }>, ptr %self, i32 0, i32 1, !dbg !107 +// CHECK:STDOUT: call void @"_CSelfDestruct.48e0adf639fe7af4:core.Destroy.Core"(ptr %.loc18_3.1.has_value), !dbg !107 +// CHECK:STDOUT: %.loc18_3.2.value = getelementptr inbounds nuw <{ i32, i1 }>, ptr %self, i32 0, i32 0, !dbg !107 +// CHECK:STDOUT: call void @"_CSelfDestruct.ef6922493c513f55:core.Destroy.Core"(ptr %.loc18_3.2.value), !dbg !107 // CHECK:STDOUT: ret void, !dbg !107 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -254,6 +258,10 @@ fn F(c: Core.Optional(C*)) -> Core.Optional(C*) { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.9f155f365c9e4267:core.Destroy.Core"(ptr %self) #0 !dbg !145 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc16_3.1.has_value = getelementptr inbounds nuw <{ i32, i1 }>, ptr %self, i32 0, i32 1, !dbg !147 +// CHECK:STDOUT: call void @"_CSelfDestruct.48e0adf639fe7af4:core.Destroy.Core"(ptr %.loc16_3.1.has_value), !dbg !147 +// CHECK:STDOUT: %.loc16_3.2.value = getelementptr inbounds nuw <{ i32, i1 }>, ptr %self, i32 0, i32 0, !dbg !147 +// CHECK:STDOUT: call void @"_CSelfDestruct.51569357b34b54dc:core.Destroy.Core"(ptr %.loc16_3.2.value), !dbg !147 // CHECK:STDOUT: ret void, !dbg !147 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/template/class.carbon b/toolchain/lower/testdata/template/class.carbon index 63ed7cfc2e82..950a1da00a3c 100644 --- a/toolchain/lower/testdata/template/class.carbon +++ b/toolchain/lower/testdata/template/class.carbon @@ -92,6 +92,8 @@ fn Run() { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.d32110776493a13a:core.Destroy.Core"(ptr %self) #0 !dbg !51 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc22.field = getelementptr inbounds nuw { {} }, ptr %self, i32 0, i32 0, !dbg !53 +// CHECK:STDOUT: call void @"_CSelfDestruct.8c4b83ecd900f1ea:core.Destroy.Core"(ptr %.loc22.field), !dbg !53 // CHECK:STDOUT: ret void, !dbg !53 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/template/convert.carbon b/toolchain/lower/testdata/template/convert.carbon index 0919eba8a764..152cc570dd26 100644 --- a/toolchain/lower/testdata/template/convert.carbon +++ b/toolchain/lower/testdata/template/convert.carbon @@ -699,6 +699,10 @@ fn Test2(c: C) { // CHECK:STDOUT: ; Function Attrs: nounwind // CHECK:STDOUT: define weak_odr void @"_CSubobjectDestroy.680f7fa3ef86df7a:core.Destroy.Core"(ptr %self) #0 !dbg !239 { // CHECK:STDOUT: entry: +// CHECK:STDOUT: %.loc9_3.1.b = getelementptr inbounds nuw { {}, {} }, ptr %self, i32 0, i32 1, !dbg !241 +// CHECK:STDOUT: call void @"_CSelfDestruct.12212b84320f2fd6:core.Destroy.Core"(ptr %.loc9_3.1.b), !dbg !241 +// CHECK:STDOUT: %.loc9_3.2.a = getelementptr inbounds nuw { {}, {} }, ptr %self, i32 0, i32 0, !dbg !241 +// CHECK:STDOUT: call void @"_CSelfDestruct.8b0bf151036f045a:core.Destroy.Core"(ptr %.loc9_3.2.a), !dbg !241 // CHECK:STDOUT: ret void, !dbg !241 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/sem_ir/ids.h b/toolchain/sem_ir/ids.h index 8ef59cc7bdf0..af4a6b9a2fd4 100644 --- a/toolchain/sem_ir/ids.h +++ b/toolchain/sem_ir/ids.h @@ -723,6 +723,16 @@ inline constexpr int NameId::NonIndexValueCount = 1 CARBON_SPECIAL_NAME_ID(CARBON_SPECIAL_NAME_ID_FOR_COUNT); #undef CARBON_SPECIAL_NAME_ID_FOR_COUNT +// An X-macro for special name scopes. Uses should look like: +// +// #define CARBON_SPECIAL_NAME_SCOPE_ID_FOR_XYZ(Name) ... +// CARBON_SPECIAL_NAME_SCOPE_ID(CARBON_SPECIAL_NAME_SCOPE_ID_FOR_XYZ) +// #undef CARBON_SPECIAL_NAME_SCOPE_ID_FOR_XYZ +#define CARBON_SPECIAL_NAME_SCOPE_ID(X) \ + /* A scope used by the toolchain to indicate it has access to all */ \ + /* of a class' members. */ \ + X(AllowHighestAccessLevel) + // The ID of a `NameScope`. struct NameScopeId : public IdBase { static constexpr llvm::StringLiteral Label = "name_scope"; @@ -730,11 +740,35 @@ struct NameScopeId : public IdBase { // The package (or file) name scope, guaranteed to be the first added. static const NameScopeId Package; + // An enum of special name scopes. + enum class SpecialNameScopeId : uint8_t { +#define CARBON_SPECIAL_NAME_SCOPE_ID_FOR_ENUM(Name) Name, + CARBON_SPECIAL_NAME_SCOPE_ID(CARBON_SPECIAL_NAME_SCOPE_ID_FOR_ENUM) +#undef CARBON_SPECIAL_NAME_SCOPE_ID_FOR_ENUM + }; + + // For each SpecialNameScopeId, provide a matching `NameScopeId` instance for + // convenience. +#define CARBON_SPECIAL_NAME_SCOPE_ID_FOR_DECL(Name) \ + static const NameScopeId Name; + CARBON_SPECIAL_NAME_SCOPE_ID(CARBON_SPECIAL_NAME_SCOPE_ID_FOR_DECL) +#undef CARBON_SPECIAL_NAME_SCOPE_ID_FOR_DECL + using IdBase::IdBase; }; inline constexpr NameScopeId NameScopeId::Package = NameScopeId(0); +// Define the special `static const NameScopeId` values. +#define CARBON_SPECIAL_NAME_SCOPE_ID_FOR_DEF(Name) \ + inline constexpr NameScopeId NameScopeId::Name = \ + NameScopeId(NoneIndex - 1 - \ + static_cast(NameScopeId::SpecialNameScopeId::Name)); +CARBON_SPECIAL_NAME_SCOPE_ID(CARBON_SPECIAL_NAME_SCOPE_ID_FOR_DEF) +#undef CARBON_SPECIAL_NAME_SCOPE_ID_FOR_DEF + +#undef CARBON_SPECIAL_NAME_SCOPE_ID + // The ID of an `InstId` block. struct InstBlockId : public IdBase { static constexpr llvm::StringLiteral Label = "inst_block";