From 309d3d63c5cf15d7c14f62753f9d2d5cde83d49e Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Sat, 17 Oct 2026 00:14:10 +0000 Subject: [PATCH] Use `IndirectIndexWith.Ref` for subscripting when available (#7975) When checking `a[i]` for a non-array type, first try `IndirectIndexWith.Ref`, falling back to `IndexWith.At`, per the indexing design. This allows subscripting to produce a reference expression, so that `a[i] = v` works and non-copyable elements can be accessed. Extracted from #7536 (the `Core.Slice` proposal). --- toolchain/check/core_identifier.def | 2 + toolchain/check/cpp/operators.cpp | 6 + toolchain/check/handle_index.cpp | 36 +- .../testdata/index/fail_invalid_base.carbon | 4 + .../index/fail_non_tuple_access.carbon | 4 + .../operators/overloaded/index.carbon | 648 +----------------- .../overloaded/index_with_prelude.carbon | 16 + .../overloaded/indirect_index_with.carbon | 161 +++++ .../testdata/index/indirect_index_with.carbon | 139 ++-- 9 files changed, 324 insertions(+), 692 deletions(-) diff --git a/toolchain/check/core_identifier.def b/toolchain/check/core_identifier.def index 31feb96173a8..489b32d2696c 100644 --- a/toolchain/check/core_identifier.def +++ b/toolchain/check/core_identifier.def @@ -53,6 +53,7 @@ CARBON_CORE_IDENTIFIER(HasValue) CARBON_CORE_IDENTIFIER(ImplicitAs) CARBON_CORE_IDENTIFIER(Inc) CARBON_CORE_IDENTIFIER(IndexWith) +CARBON_CORE_IDENTIFIER(IndirectIndexWith) CARBON_CORE_IDENTIFIER(Int) CARBON_CORE_IDENTIFIER(IntFitsIn) CARBON_CORE_IDENTIFIER(Iterate) @@ -75,6 +76,7 @@ CARBON_CORE_IDENTIFIER(NullptrT) CARBON_CORE_IDENTIFIER(Op) CARBON_CORE_IDENTIFIER(Optional) CARBON_CORE_IDENTIFIER(OrderedWith) +CARBON_CORE_IDENTIFIER(Ref) CARBON_CORE_IDENTIFIER(RightShiftAssignWith) CARBON_CORE_IDENTIFIER(RightShiftWith) CARBON_CORE_IDENTIFIER(SelfDestruct) diff --git a/toolchain/check/cpp/operators.cpp b/toolchain/check/cpp/operators.cpp index 4474311efae5..7af33f85b4de 100644 --- a/toolchain/check/cpp/operators.cpp +++ b/toolchain/check/cpp/operators.cpp @@ -200,6 +200,12 @@ static auto GetClangOperatorKind(Context& context, SemIR::LocId loc_id, return clang::OO_Subscript; } + // C++ `operator[]` is found through `IndexWith`, which subscripting falls + // back to. + case CoreIdentifier::IndirectIndexWith: { + return std::nullopt; + } + default: { context.TODO(loc_id, llvm::formatv("Unsupported operator interface `{0}`", interface_name)); diff --git a/toolchain/check/handle_index.cpp b/toolchain/check/handle_index.cpp index 7a3e7a732f28..97ed5a9f3a3a 100644 --- a/toolchain/check/handle_index.cpp +++ b/toolchain/check/handle_index.cpp @@ -26,20 +26,22 @@ auto HandleParseNode(Context& /*context*/, Parse::IndexExprStartId /*node_id*/) return true; } -// Performs an index with base expression `operand_inst_id` and -// `operand_type_id` for types that are not an array. This checks if -// the base expression implements the `IndexWith` interface; if so, uses the -// `At` associative method, otherwise prints a diagnostic. -static auto PerformIndexWith(Context& context, Parse::NodeId node_id, - SemIR::InstId operand_inst_id, - SemIR::InstId index_inst_id) -> SemIR::InstId { +// Performs an index with base expression `operand_inst_id` for types that are +// not an array, using the `op_name` method of the interface `interface_name`. +// On failure, returns an `ErrorInst`, and diagnoses unless `diagnose` is false. +static auto PerformIndexOperator(Context& context, Parse::NodeId node_id, + CoreIdentifier interface_name, + CoreIdentifier op_name, + SemIR::InstId operand_inst_id, + SemIR::InstId index_inst_id, bool diagnose) + -> SemIR::InstId { SemIR::InstId args[] = {context.types().GetTypeInstId( context.insts().Get(index_inst_id).type_id())}; - Operator op{.interface_name = CoreIdentifier::IndexWith, + Operator op{.interface_name = interface_name, .interface_args_ref = args, - .op_name = CoreIdentifier::At}; + .op_name = op_name}; return BuildBinaryOperator(context, node_id, op, operand_inst_id, - index_inst_id); + index_inst_id, diagnose); } auto HandleParseNode(Context& context, Parse::IndexExprId node_id) -> bool { @@ -83,8 +85,18 @@ auto HandleParseNode(Context& context, Parse::IndexExprId node_id) -> bool { } context.node_stack().Push(node_id, elem_id); } else { - auto elem_id = - PerformIndexWith(context, node_id, operand_inst_id, index_inst_id); + // Per the design, prefer `IndirectIndexWith` if the type implements it, + // otherwise fall back to `IndexWith`. + // TODO: Use `IndexWith.Ref` when the operand is a durable reference. + auto elem_id = PerformIndexOperator( + context, node_id, CoreIdentifier::IndirectIndexWith, + CoreIdentifier::Ref, operand_inst_id, index_inst_id, + /*diagnose=*/false); + if (elem_id == SemIR::ErrorInst::InstId) { + elem_id = PerformIndexOperator( + context, node_id, CoreIdentifier::IndexWith, CoreIdentifier::At, + operand_inst_id, index_inst_id, /*diagnose=*/true); + } context.node_stack().Push(node_id, elem_id); } return true; diff --git a/toolchain/check/testdata/index/fail_invalid_base.carbon b/toolchain/check/testdata/index/fail_invalid_base.carbon index 95cca4118bd5..1c50fedbd3c4 100644 --- a/toolchain/check/testdata/index/fail_invalid_base.carbon +++ b/toolchain/check/testdata/index/fail_invalid_base.carbon @@ -48,6 +48,8 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: %b.patt: %pattern_type.d94 = ref_binding_pattern b [concrete] // CHECK:STDOUT: %b.var_patt: %pattern_type.d94 = var_pattern %b.patt [concrete] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %IndirectIndexWith.type.841: type = generic_interface_type @IndirectIndexWith [concrete] +// CHECK:STDOUT: %IndirectIndexWith.generic: %IndirectIndexWith.type.841 = struct_value () [concrete] // CHECK:STDOUT: %IndexWith.type.df6: type = generic_interface_type @IndexWith [concrete] // CHECK:STDOUT: %IndexWith.generic: %IndexWith.type.df6 = struct_value () [concrete] // CHECK:STDOUT: %c.patt: %pattern_type.d94 = ref_binding_pattern c [concrete] @@ -63,11 +65,13 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .IndirectIndexWith = %Core.IndirectIndexWith // CHECK:STDOUT: .IndexWith = %Core.IndexWith // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %Core.IndirectIndexWith: %IndirectIndexWith.type.841 = import_ref Core//prelude/operators/index, IndirectIndexWith, loaded [concrete = constants.%IndirectIndexWith.generic] // CHECK:STDOUT: %Core.IndexWith: %IndexWith.type.df6 = import_ref Core//prelude/operators/index, IndexWith, loaded [concrete = constants.%IndexWith.generic] // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/fail_non_tuple_access.carbon b/toolchain/check/testdata/index/fail_non_tuple_access.carbon index d3f464a34ea6..2dd52f23ec90 100644 --- a/toolchain/check/testdata/index/fail_non_tuple_access.carbon +++ b/toolchain/check/testdata/index/fail_non_tuple_access.carbon @@ -26,16 +26,20 @@ fn Main() { // CHECK:STDOUT: %Main: %Main.type = struct_value () [concrete] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete] +// CHECK:STDOUT: %IndirectIndexWith.type.841: type = generic_interface_type @IndirectIndexWith [concrete] +// CHECK:STDOUT: %IndirectIndexWith.generic: %IndirectIndexWith.type.841 = struct_value () [concrete] // CHECK:STDOUT: %IndexWith.type.df6: type = generic_interface_type @IndexWith [concrete] // CHECK:STDOUT: %IndexWith.generic: %IndexWith.type.df6 = struct_value () [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { +// CHECK:STDOUT: .IndirectIndexWith = %Core.IndirectIndexWith // CHECK:STDOUT: .IndexWith = %Core.IndexWith // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } +// CHECK:STDOUT: %Core.IndirectIndexWith: %IndirectIndexWith.type.841 = import_ref Core//prelude/operators/index, IndirectIndexWith, loaded [concrete = constants.%IndirectIndexWith.generic] // CHECK:STDOUT: %Core.IndexWith: %IndexWith.type.df6 = import_ref Core//prelude/operators/index, IndexWith, loaded [concrete = constants.%IndexWith.generic] // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/index.carbon b/toolchain/check/testdata/operators/overloaded/index.carbon index 53c441022cb1..ce4e5befaec1 100644 --- a/toolchain/check/testdata/operators/overloaded/index.carbon +++ b/toolchain/check/testdata/operators/overloaded/index.carbon @@ -3,8 +3,6 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/convert.carbon -// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". -// EXTRA-ARGS: --dump-sem-ir-ranges=if-present // // AUTOUPDATE // TIP: To test this file alone, run: @@ -18,23 +16,33 @@ package Core library "[[@TEST_NAME]]"; class IndexWith {} +class IndirectIndexWith {} + // --- fail_wrong_index_with.carbon library "[[@TEST_NAME]]"; import Core library "core_wrong_index_with"; +//@dump-sem-ir-begin +// CHECK:STDERR: fail_wrong_index_with.carbon:[[@LINE+4]]:10-13: error: value of type `type` is not callable [CallToNonCallable] +// CHECK:STDERR: // CHECK:STDERR: fail_wrong_index_with.carbon:[[@LINE+2]]:10-13: error: value of type `type` is not callable [CallToNonCallable] // CHECK:STDERR: fn F() { 0[1]; } +//@dump-sem-ir-end // --- fail_missing_index_with.carbon library "[[@TEST_NAME]]"; +//@dump-sem-ir-begin +// CHECK:STDERR: fail_missing_index_with.carbon:[[@LINE+4]]:10-13: error: name `Core.IndirectIndexWith` implicitly referenced here, but not found [CoreNameNotFound] +// CHECK:STDERR: // CHECK:STDERR: fail_missing_index_with.carbon:[[@LINE+2]]:10-13: error: name `Core.IndexWith` implicitly referenced here, but not found [CoreNameNotFound] // CHECK:STDERR: fn F() { 0[1]; } +//@dump-sem-ir-end // --- core_wrong_arg_count.carbon @@ -44,6 +52,11 @@ interface IndexWith(SubscriptType: type, ElementType: type) { fn At(self, subscript: SubscriptType) -> ElementType; } +interface IndirectIndexWith(SubscriptType: type) { + let ElementType: type; + fn Ref(self, subscript: SubscriptType) -> ref ElementType; +} + // --- fail_wrong_arg_count.carbon @@ -65,55 +78,12 @@ fn F() { // CHECK:STDERR: core_wrong_arg_count.carbon:4:1-61: note: calling generic interface declared here [InCallToEntity] // CHECK:STDERR: c[()]; + // CHECK:STDERR: fail_wrong_arg_count.carbon:[[@LINE+2]]:3: error: missing `//@dump-sem-ir-begin` to match `//@dump-sem-ir-end` [DumpSemIRRangeMissingBegin] + // CHECK:STDERR: + //@dump-sem-ir-end } -// CHECK:STDOUT: --- core_wrong_index_with.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: type: type = facet_type [concrete] -// CHECK:STDOUT: %IndexWith: type = class_type @IndexWith [concrete] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core.UnsafeAs = import_ref Core//prelude/parts/as, UnsafeAs, unloaded -// CHECK:STDOUT: %Core.As = import_ref Core//prelude/parts/as, As, unloaded -// CHECK:STDOUT: %Core.ImplicitAs = import_ref Core//prelude/parts/as, ImplicitAs, unloaded -// CHECK:STDOUT: %Core.BitAndWith = import_ref Core//prelude/parts/as, BitAndWith, unloaded -// CHECK:STDOUT: %Core.Copy = import_ref Core//prelude/parts/copy, Copy, unloaded -// CHECK:STDOUT: %Core.DefaultOrUnformed = import_ref Core//prelude/parts/default, DefaultOrUnformed, unloaded -// CHECK:STDOUT: %Core.Default = import_ref Core//prelude/parts/default, Default, unloaded -// CHECK:STDOUT: %Core.Destroy = import_ref Core//prelude/parts/destroy, Destroy, unloaded -// CHECK:STDOUT: %Core.Form = import_ref Core//prelude/parts/form, Form, unloaded -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .UnsafeAs = imports.%Core.UnsafeAs -// CHECK:STDOUT: .As = imports.%Core.As -// CHECK:STDOUT: .ImplicitAs = imports.%Core.ImplicitAs -// CHECK:STDOUT: .BitAndWith = imports.%Core.BitAndWith -// CHECK:STDOUT: .Copy = imports.%Core.Copy -// CHECK:STDOUT: .DefaultOrUnformed = imports.%Core.DefaultOrUnformed -// CHECK:STDOUT: .Default = imports.%Core.Default -// CHECK:STDOUT: .Destroy = imports.%Core.Destroy -// CHECK:STDOUT: .Form = imports.%Core.Form -// CHECK:STDOUT: .IndexWith = %IndexWith.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %IndexWith.decl: type = class_decl @IndexWith [concrete = constants.%IndexWith] {} {} -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @IndexWith { -// CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%IndexWith -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: --- fail_wrong_index_with.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -122,39 +92,12 @@ fn F() { // CHECK:STDOUT: %F: %F.type = struct_value () [concrete] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete] -// CHECK:STDOUT: %IndexWith: type = class_type @IndexWith [concrete] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: .IndexWith = %Core.IndexWith -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//core_wrong_index_with -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.IndexWith: type = import_ref Core//core_wrong_index_with, IndexWith, loaded [concrete = constants.%IndexWith] -// CHECK:STDOUT: %Core.import_ref.8f2: = import_ref Core//core_wrong_index_with, loc{{\d+_\d+}}, loaded [concrete = constants.%complete_type] -// CHECK:STDOUT: %Core.import_ref.f02 = import_ref Core//core_wrong_index_with, inst{{[0-9A-F]+}} [no loc], unloaded // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: class @IndexWith [from "core_wrong_index_with.carbon"] { -// CHECK:STDOUT: complete_type_witness = imports.%Core.import_ref.8f2 -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%Core.import_ref.f02 -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0] @@ -172,20 +115,7 @@ fn F() { // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: .IndexWith = -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: // CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} // CHECK:STDOUT: } // CHECK:STDOUT: @@ -196,545 +126,3 @@ fn F() { // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- core_wrong_arg_count.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: type: type = facet_type [concrete] -// CHECK:STDOUT: %.Self.frozen: type = symbolic_binding .Self [symbolic_self] -// CHECK:STDOUT: %pattern_type.9a5: type = pattern_type type [concrete] -// CHECK:STDOUT: %SubscriptType.patt: %pattern_type.9a5 = symbolic_binding_pattern SubscriptType, 0 [symbolic] -// CHECK:STDOUT: %SubscriptType: type = symbolic_binding SubscriptType, 0 [symbolic] -// CHECK:STDOUT: %ElementType.patt: %pattern_type.9a5 = symbolic_binding_pattern ElementType, 1 [symbolic] -// CHECK:STDOUT: %ElementType: type = symbolic_binding ElementType, 1 [symbolic] -// CHECK:STDOUT: %IndexWith.type.df6: type = generic_interface_type @IndexWith [concrete] -// CHECK:STDOUT: %IndexWith.generic: %IndexWith.type.df6 = struct_value () [concrete] -// CHECK:STDOUT: %IndexWith.type.3a9: type = facet_type <@IndexWith, @IndexWith(%SubscriptType, %ElementType)> [symbolic] -// CHECK:STDOUT: %Self: %IndexWith.type.3a9 = symbolic_binding Self, 2 [symbolic] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic] -// CHECK:STDOUT: %pattern_type.482: type = pattern_type %Self.as_type [symbolic] -// CHECK:STDOUT: %self.param_patt: %pattern_type.482 = value_param_pattern [symbolic] -// CHECK:STDOUT: %self.patt: %pattern_type.482 = wrapper_binding_pattern self, %self.param_patt [symbolic] -// CHECK:STDOUT: %pattern_type.51d: type = pattern_type %SubscriptType [symbolic] -// CHECK:STDOUT: %subscript.param_patt: %pattern_type.51d = value_param_pattern [symbolic] -// CHECK:STDOUT: %subscript.patt: %pattern_type.51d = wrapper_binding_pattern subscript, %subscript.param_patt [symbolic] -// CHECK:STDOUT: %.822: Core.Form = init_form %ElementType [symbolic] -// CHECK:STDOUT: %pattern_type.946: type = pattern_type %ElementType [symbolic] -// CHECK:STDOUT: %return.param_patt: %pattern_type.946 = out_param_pattern [symbolic] -// CHECK:STDOUT: %return.patt: %pattern_type.946 = return_slot_pattern %return.param_patt, %ElementType [symbolic] -// CHECK:STDOUT: %IndexWith.WithSelf.At.type: type = fn_type @IndexWith.WithSelf.At, @IndexWith.WithSelf(%SubscriptType, %ElementType, %Self) [symbolic] -// CHECK:STDOUT: %IndexWith.WithSelf.At: %IndexWith.WithSelf.At.type = struct_value () [symbolic] -// CHECK:STDOUT: %IndexWith.assoc_type: type = assoc_entity_type @IndexWith, @IndexWith(%SubscriptType, %ElementType) [symbolic] -// CHECK:STDOUT: %assoc0: %IndexWith.assoc_type = assoc_entity element0, @IndexWith.WithSelf.%IndexWith.WithSelf.At.decl [symbolic] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core.UnsafeAs = import_ref Core//prelude/parts/as, UnsafeAs, unloaded -// CHECK:STDOUT: %Core.As = import_ref Core//prelude/parts/as, As, unloaded -// CHECK:STDOUT: %Core.ImplicitAs = import_ref Core//prelude/parts/as, ImplicitAs, unloaded -// CHECK:STDOUT: %Core.BitAndWith = import_ref Core//prelude/parts/as, BitAndWith, unloaded -// CHECK:STDOUT: %Core.Copy = import_ref Core//prelude/parts/copy, Copy, unloaded -// CHECK:STDOUT: %Core.DefaultOrUnformed = import_ref Core//prelude/parts/default, DefaultOrUnformed, unloaded -// CHECK:STDOUT: %Core.Default = import_ref Core//prelude/parts/default, Default, unloaded -// CHECK:STDOUT: %Core.Destroy = import_ref Core//prelude/parts/destroy, Destroy, unloaded -// CHECK:STDOUT: %Core.Form = import_ref Core//prelude/parts/form, Form, unloaded -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .UnsafeAs = imports.%Core.UnsafeAs -// CHECK:STDOUT: .As = imports.%Core.As -// CHECK:STDOUT: .ImplicitAs = imports.%Core.ImplicitAs -// CHECK:STDOUT: .BitAndWith = imports.%Core.BitAndWith -// CHECK:STDOUT: .Copy = imports.%Core.Copy -// CHECK:STDOUT: .DefaultOrUnformed = imports.%Core.DefaultOrUnformed -// CHECK:STDOUT: .Default = imports.%Core.Default -// CHECK:STDOUT: .Destroy = imports.%Core.Destroy -// CHECK:STDOUT: .Form = imports.%Core.Form -// CHECK:STDOUT: .IndexWith = %IndexWith.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %default.import = import -// CHECK:STDOUT: %IndexWith.decl: %IndexWith.type.df6 = interface_decl @IndexWith [concrete = constants.%IndexWith.generic] { -// CHECK:STDOUT: %SubscriptType.patt.loc4_34.1: %pattern_type.9a5 = symbolic_binding_pattern SubscriptType, 0 [symbolic = %SubscriptType.patt.loc4_34.2 (constants.%SubscriptType.patt)] -// CHECK:STDOUT: %ElementType.patt.loc4_53.1: %pattern_type.9a5 = symbolic_binding_pattern ElementType, 1 [symbolic = %ElementType.patt.loc4_53.2 (constants.%ElementType.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc4_36.1: type = splice_block %.loc4_36.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc4_34: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc4_36.2: type = type_literal type [concrete = type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %SubscriptType.loc4_34.2: type = symbolic_binding SubscriptType, 0 [symbolic = %SubscriptType.loc4_34.1 (constants.%SubscriptType)] -// CHECK:STDOUT: %.loc4_55.1: type = splice_block %.loc4_55.2 [concrete = type] { -// CHECK:STDOUT: %.Self.frozen.loc4_53: type = symbolic_binding .Self [symbolic_self = constants.%.Self.frozen] -// CHECK:STDOUT: %.loc4_55.2: type = type_literal type [concrete = type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %ElementType.loc4_53.2: type = symbolic_binding ElementType, 1 [symbolic = %ElementType.loc4_53.1 (constants.%ElementType)] -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @IndexWith(%SubscriptType.loc4_34.2: type, %ElementType.loc4_53.2: type) { -// CHECK:STDOUT: %SubscriptType.patt.loc4_34.2: %pattern_type.9a5 = symbolic_binding_pattern SubscriptType, 0 [symbolic = %SubscriptType.patt.loc4_34.2 (constants.%SubscriptType.patt)] -// CHECK:STDOUT: %SubscriptType.loc4_34.1: type = symbolic_binding SubscriptType, 0 [symbolic = %SubscriptType.loc4_34.1 (constants.%SubscriptType)] -// CHECK:STDOUT: %ElementType.patt.loc4_53.2: %pattern_type.9a5 = symbolic_binding_pattern ElementType, 1 [symbolic = %ElementType.patt.loc4_53.2 (constants.%ElementType.patt)] -// CHECK:STDOUT: %ElementType.loc4_53.1: type = symbolic_binding ElementType, 1 [symbolic = %ElementType.loc4_53.1 (constants.%ElementType)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %IndexWith.type: type = facet_type <@IndexWith, @IndexWith(%SubscriptType.loc4_34.1, %ElementType.loc4_53.1)> [symbolic = %IndexWith.type (constants.%IndexWith.type.3a9)] -// CHECK:STDOUT: %Self.loc4_61.2: @IndexWith.%IndexWith.type (%IndexWith.type.3a9) = symbolic_binding Self, 2 [symbolic = %Self.loc4_61.2 (constants.%Self)] -// CHECK:STDOUT: -// CHECK:STDOUT: interface { -// CHECK:STDOUT: %Self.loc4_61.1: @IndexWith.%IndexWith.type (%IndexWith.type.3a9) = symbolic_binding Self, 2 [symbolic = %Self.loc4_61.2 (constants.%Self)] -// CHECK:STDOUT: %IndexWith.WithSelf.decl = interface_with_self_decl @IndexWith [concrete] -// CHECK:STDOUT: -// CHECK:STDOUT: !with Self: -// CHECK:STDOUT: %IndexWith.WithSelf.At.decl: @IndexWith.WithSelf.%IndexWith.WithSelf.At.type (%IndexWith.WithSelf.At.type) = fn_decl @IndexWith.WithSelf.At [symbolic = @IndexWith.WithSelf.%IndexWith.WithSelf.At (constants.%IndexWith.WithSelf.At)] { -// CHECK:STDOUT: %self.param_patt.loc5_9.1: @IndexWith.WithSelf.At.%pattern_type.loc5_9 (%pattern_type.482) = value_param_pattern [symbolic = %self.param_patt.loc5_9.2 (constants.%self.param_patt)] -// CHECK:STDOUT: %self.patt.loc5_9.1: @IndexWith.WithSelf.At.%pattern_type.loc5_9 (%pattern_type.482) = wrapper_binding_pattern self, %self.param_patt.loc5_9.1 [symbolic = %self.patt.loc5_9.2 (constants.%self.patt)] -// CHECK:STDOUT: %subscript.param_patt.loc5_24.1: @IndexWith.WithSelf.At.%pattern_type.loc5_24 (%pattern_type.51d) = value_param_pattern [symbolic = %subscript.param_patt.loc5_24.2 (constants.%subscript.param_patt)] -// CHECK:STDOUT: %subscript.patt.loc5_24.1: @IndexWith.WithSelf.At.%pattern_type.loc5_24 (%pattern_type.51d) = wrapper_binding_pattern subscript, %subscript.param_patt.loc5_24.1 [symbolic = %subscript.patt.loc5_24.2 (constants.%subscript.patt)] -// CHECK:STDOUT: %return.param_patt.loc5_44.1: @IndexWith.WithSelf.At.%pattern_type.loc5_44 (%pattern_type.946) = out_param_pattern [symbolic = %return.param_patt.loc5_44.2 (constants.%return.param_patt)] -// CHECK:STDOUT: %return.patt.loc5_41.1: @IndexWith.WithSelf.At.%pattern_type.loc5_44 (%pattern_type.946) = return_slot_pattern %return.param_patt.loc5_44.1, %ElementType.ref [symbolic = %return.patt.loc5_41.2 (constants.%return.patt)] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc5_44.2: type = specific_constant @IndexWith.%ElementType.loc4_53.2, @IndexWith(constants.%SubscriptType, constants.%ElementType) [symbolic = %ElementType (constants.%ElementType)] -// CHECK:STDOUT: %ElementType.ref: type = name_ref ElementType, %.loc5_44.2 [symbolic = %ElementType (constants.%ElementType)] -// CHECK:STDOUT: %.loc5_44.3: Core.Form = init_form %ElementType.ref [symbolic = %.loc5_44.1 (constants.%.822)] -// CHECK:STDOUT: %self.param: @IndexWith.WithSelf.At.%Self.as_type.loc5_9.1 (%Self.as_type) = value_param call_param0 -// CHECK:STDOUT: %.loc5_9.1: type = splice_block %.loc5_9.3 [symbolic = %Self.as_type.loc5_9.1 (constants.%Self.as_type)] { -// CHECK:STDOUT: %.loc5_9.2: @IndexWith.WithSelf.At.%IndexWith.type (%IndexWith.type.3a9) = specific_constant @IndexWith.%Self.loc4_61.1, @IndexWith(constants.%SubscriptType, constants.%ElementType) [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.ref: @IndexWith.WithSelf.At.%IndexWith.type (%IndexWith.type.3a9) = name_ref Self, %.loc5_9.2 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc5_9.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_9.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %.loc5_9.3: type = converted %Self.ref, %Self.as_type.loc5_9.2 [symbolic = %Self.as_type.loc5_9.1 (constants.%Self.as_type)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %self: @IndexWith.WithSelf.At.%Self.as_type.loc5_9.1 (%Self.as_type) = wrapper_binding self, %self.param -// CHECK:STDOUT: %subscript.param: @IndexWith.WithSelf.At.%SubscriptType (%SubscriptType) = value_param call_param1 -// CHECK:STDOUT: %.loc5_26.1: type = splice_block %SubscriptType.ref [symbolic = %SubscriptType (constants.%SubscriptType)] { -// CHECK:STDOUT: %.loc5_26.2: type = specific_constant @IndexWith.%SubscriptType.loc4_34.2, @IndexWith(constants.%SubscriptType, constants.%ElementType) [symbolic = %SubscriptType (constants.%SubscriptType)] -// CHECK:STDOUT: %SubscriptType.ref: type = name_ref SubscriptType, %.loc5_26.2 [symbolic = %SubscriptType (constants.%SubscriptType)] -// CHECK:STDOUT: } -// CHECK:STDOUT: %subscript: @IndexWith.WithSelf.At.%SubscriptType (%SubscriptType) = wrapper_binding subscript, %subscript.param -// CHECK:STDOUT: %return.param: ref @IndexWith.WithSelf.At.%ElementType (%ElementType) = out_param call_param2 -// CHECK:STDOUT: %return: ref @IndexWith.WithSelf.At.%ElementType (%ElementType) = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %assoc0.loc5_55.1: @IndexWith.WithSelf.%IndexWith.assoc_type (%IndexWith.assoc_type) = assoc_entity element0, %IndexWith.WithSelf.At.decl [symbolic = %assoc0.loc5_55.2 (constants.%assoc0)] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = %Self.loc4_61.1 -// CHECK:STDOUT: .SubscriptType = -// CHECK:STDOUT: .ElementType = -// CHECK:STDOUT: .SubscriptType = -// CHECK:STDOUT: .ElementType = -// CHECK:STDOUT: .At = @IndexWith.WithSelf.%assoc0.loc5_55.1 -// CHECK:STDOUT: witness = (@IndexWith.WithSelf.%IndexWith.WithSelf.At.decl) -// CHECK:STDOUT: -// CHECK:STDOUT: !requires: -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @IndexWith.WithSelf.At(@IndexWith.%SubscriptType.loc4_34.2: type, @IndexWith.%ElementType.loc4_53.2: type, @IndexWith.%Self.loc4_61.1: @IndexWith.%IndexWith.type (%IndexWith.type.3a9)) { -// CHECK:STDOUT: %SubscriptType: type = symbolic_binding SubscriptType, 0 [symbolic = %SubscriptType (constants.%SubscriptType)] -// CHECK:STDOUT: %ElementType: type = symbolic_binding ElementType, 1 [symbolic = %ElementType (constants.%ElementType)] -// CHECK:STDOUT: %IndexWith.type: type = facet_type <@IndexWith, @IndexWith(%SubscriptType, %ElementType)> [symbolic = %IndexWith.type (constants.%IndexWith.type.3a9)] -// CHECK:STDOUT: %Self: @IndexWith.WithSelf.At.%IndexWith.type (%IndexWith.type.3a9) = symbolic_binding Self, 2 [symbolic = %Self (constants.%Self)] -// CHECK:STDOUT: %Self.as_type.loc5_9.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_9.1 (constants.%Self.as_type)] -// CHECK:STDOUT: %pattern_type.loc5_9: type = pattern_type %Self.as_type.loc5_9.1 [symbolic = %pattern_type.loc5_9 (constants.%pattern_type.482)] -// CHECK:STDOUT: %self.param_patt.loc5_9.2: @IndexWith.WithSelf.At.%pattern_type.loc5_9 (%pattern_type.482) = value_param_pattern [symbolic = %self.param_patt.loc5_9.2 (constants.%self.param_patt)] -// CHECK:STDOUT: %self.patt.loc5_9.2: @IndexWith.WithSelf.At.%pattern_type.loc5_9 (%pattern_type.482) = wrapper_binding_pattern self, %self.param_patt.loc5_9.2 [symbolic = %self.patt.loc5_9.2 (constants.%self.patt)] -// CHECK:STDOUT: %pattern_type.loc5_24: type = pattern_type %SubscriptType [symbolic = %pattern_type.loc5_24 (constants.%pattern_type.51d)] -// CHECK:STDOUT: %subscript.param_patt.loc5_24.2: @IndexWith.WithSelf.At.%pattern_type.loc5_24 (%pattern_type.51d) = value_param_pattern [symbolic = %subscript.param_patt.loc5_24.2 (constants.%subscript.param_patt)] -// CHECK:STDOUT: %subscript.patt.loc5_24.2: @IndexWith.WithSelf.At.%pattern_type.loc5_24 (%pattern_type.51d) = wrapper_binding_pattern subscript, %subscript.param_patt.loc5_24.2 [symbolic = %subscript.patt.loc5_24.2 (constants.%subscript.patt)] -// CHECK:STDOUT: %.loc5_44.1: Core.Form = init_form %ElementType [symbolic = %.loc5_44.1 (constants.%.822)] -// CHECK:STDOUT: %pattern_type.loc5_44: type = pattern_type %ElementType [symbolic = %pattern_type.loc5_44 (constants.%pattern_type.946)] -// CHECK:STDOUT: %return.param_patt.loc5_44.2: @IndexWith.WithSelf.At.%pattern_type.loc5_44 (%pattern_type.946) = out_param_pattern [symbolic = %return.param_patt.loc5_44.2 (constants.%return.param_patt)] -// CHECK:STDOUT: %return.patt.loc5_41.2: @IndexWith.WithSelf.At.%pattern_type.loc5_44 (%pattern_type.946) = return_slot_pattern %return.param_patt.loc5_44.2, %ElementType [symbolic = %return.patt.loc5_41.2 (constants.%return.patt)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn(%self.param: @IndexWith.WithSelf.At.%Self.as_type.loc5_9.1 (%Self.as_type), %subscript.param: @IndexWith.WithSelf.At.%SubscriptType (%SubscriptType)) -> out %return.param: @IndexWith.WithSelf.At.%ElementType (%ElementType); -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @IndexWith(constants.%SubscriptType, constants.%ElementType) { -// CHECK:STDOUT: %SubscriptType.patt.loc4_34.2 => constants.%SubscriptType.patt -// CHECK:STDOUT: %SubscriptType.loc4_34.1 => constants.%SubscriptType -// CHECK:STDOUT: %ElementType.patt.loc4_53.2 => constants.%ElementType.patt -// CHECK:STDOUT: %ElementType.loc4_53.1 => constants.%ElementType -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @IndexWith.WithSelf(constants.%SubscriptType, constants.%ElementType, constants.%Self) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @IndexWith.WithSelf.At(constants.%SubscriptType, constants.%ElementType, constants.%Self) { -// CHECK:STDOUT: %SubscriptType => constants.%SubscriptType -// CHECK:STDOUT: %ElementType => constants.%ElementType -// CHECK:STDOUT: %IndexWith.type => constants.%IndexWith.type.3a9 -// CHECK:STDOUT: %Self => constants.%Self -// CHECK:STDOUT: %Self.as_type.loc5_9.1 => constants.%Self.as_type -// CHECK:STDOUT: %pattern_type.loc5_9 => constants.%pattern_type.482 -// CHECK:STDOUT: %self.param_patt.loc5_9.2 => constants.%self.param_patt -// CHECK:STDOUT: %self.patt.loc5_9.2 => constants.%self.patt -// CHECK:STDOUT: %pattern_type.loc5_24 => constants.%pattern_type.51d -// CHECK:STDOUT: %subscript.param_patt.loc5_24.2 => constants.%subscript.param_patt -// CHECK:STDOUT: %subscript.patt.loc5_24.2 => constants.%subscript.patt -// CHECK:STDOUT: %.loc5_44.1 => constants.%.822 -// CHECK:STDOUT: %pattern_type.loc5_44 => constants.%pattern_type.946 -// CHECK:STDOUT: %return.param_patt.loc5_44.2 => constants.%return.param_patt -// CHECK:STDOUT: %return.patt.loc5_41.2 => constants.%return.patt -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: --- fail_wrong_arg_count.carbon -// CHECK:STDOUT: -// CHECK:STDOUT: constants { -// CHECK:STDOUT: type: type = facet_type [concrete] -// CHECK:STDOUT: %C: type = class_type @C [concrete] -// CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete] -// CHECK:STDOUT: %complete_type: = complete_type_witness %empty_struct_type [concrete] -// CHECK:STDOUT: %IndexWith.type.df6: type = generic_interface_type @IndexWith [concrete] -// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete] -// CHECK:STDOUT: %IndexWith.generic: %IndexWith.type.df6 = struct_value () [concrete] -// CHECK:STDOUT: %ElementType: type = symbolic_binding ElementType, 1 [symbolic] -// CHECK:STDOUT: %SubscriptType: type = symbolic_binding SubscriptType, 0 [symbolic] -// CHECK:STDOUT: %IndexWith.type.3a9: type = facet_type <@IndexWith, @IndexWith(%SubscriptType, %ElementType)> [symbolic] -// CHECK:STDOUT: %pattern_type.9a5: type = pattern_type type [concrete] -// CHECK:STDOUT: %ElementType.patt: %pattern_type.9a5 = symbolic_binding_pattern ElementType, 1 [symbolic] -// CHECK:STDOUT: %SubscriptType.patt: %pattern_type.9a5 = symbolic_binding_pattern SubscriptType, 0 [symbolic] -// CHECK:STDOUT: %Self.2cc: %IndexWith.type.3a9 = symbolic_binding Self, 2 [symbolic] -// CHECK:STDOUT: %IndexWith.WithSelf.At.type.fcf: type = fn_type @IndexWith.WithSelf.At, @IndexWith.WithSelf(%SubscriptType, %ElementType, %Self.2cc) [symbolic] -// CHECK:STDOUT: %IndexWith.WithSelf.At.76c: %IndexWith.WithSelf.At.type.fcf = struct_value () [symbolic] -// CHECK:STDOUT: %pattern_type.946: type = pattern_type %ElementType [symbolic] -// CHECK:STDOUT: %return.param_patt.6dd: %pattern_type.946 = out_param_pattern [symbolic] -// CHECK:STDOUT: %return.patt.fc9: %pattern_type.946 = return_slot_pattern %return.param_patt.6dd, invalid [symbolic] -// CHECK:STDOUT: %Self.as_type.672: type = facet_access_type %Self.2cc [symbolic] -// CHECK:STDOUT: %pattern_type.b0d: type = pattern_type %Self.as_type.672 [symbolic] -// CHECK:STDOUT: %self.param_patt.9e6: %pattern_type.b0d = value_param_pattern [symbolic] -// CHECK:STDOUT: %self.patt.2f1: %pattern_type.b0d = wrapper_binding_pattern self, %self.param_patt.9e6 [symbolic] -// CHECK:STDOUT: %.822: Core.Form = init_form %ElementType [symbolic] -// CHECK:STDOUT: %pattern_type.51d: type = pattern_type %SubscriptType [symbolic] -// CHECK:STDOUT: %subscript.param_patt.fd1: %pattern_type.51d = value_param_pattern [symbolic] -// CHECK:STDOUT: %subscript.patt.bfe: %pattern_type.51d = wrapper_binding_pattern subscript, %subscript.param_patt.fd1 [symbolic] -// CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete] -// CHECK:STDOUT: %IndexWith.type.a36: type = facet_type <@IndexWith, @IndexWith(%empty_tuple.type, %empty_tuple.type)> [concrete] -// CHECK:STDOUT: %.b6e: = impl_self_witness %C, @IndexWith, @IndexWith(%empty_tuple.type, %empty_tuple.type) [concrete] -// CHECK:STDOUT: %IndexWith.impl_witness: = impl_witness @C.as.IndexWith.impl.%IndexWith.impl_witness_table [concrete] -// CHECK:STDOUT: %Self.cc6: %IndexWith.type.a36 = symbolic_binding Self, 2 [symbolic] -// CHECK:STDOUT: %IndexWith.WithSelf.At.type.540: type = fn_type @IndexWith.WithSelf.At, @IndexWith.WithSelf(%empty_tuple.type, %empty_tuple.type, %Self.2cc) [symbolic] -// CHECK:STDOUT: %IndexWith.WithSelf.At.451: %IndexWith.WithSelf.At.type.540 = struct_value () [symbolic] -// CHECK:STDOUT: %IndexWith.assoc_type.20a: type = assoc_entity_type @IndexWith, @IndexWith(%empty_tuple.type, %empty_tuple.type) [concrete] -// CHECK:STDOUT: %assoc0.8ef: %IndexWith.assoc_type.20a = assoc_entity element0, imports.%Core.import_ref.a1c [concrete] -// CHECK:STDOUT: %pattern_type.98b: type = pattern_type %C [concrete] -// CHECK:STDOUT: %self.param_patt.303: %pattern_type.98b = value_param_pattern [concrete] -// CHECK:STDOUT: %self.patt.36a: %pattern_type.98b = wrapper_binding_pattern self, %self.param_patt.303 [concrete] -// CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete] -// CHECK:STDOUT: %subscript.param_patt.0ba: %pattern_type.cb1 = value_param_pattern [concrete] -// CHECK:STDOUT: %subscript.patt.17b: %pattern_type.cb1 = wrapper_binding_pattern subscript, %subscript.param_patt.0ba [concrete] -// CHECK:STDOUT: %.262: Core.Form = init_form %empty_tuple.type [concrete] -// CHECK:STDOUT: %return.param_patt.900: %pattern_type.cb1 = out_param_pattern [concrete] -// CHECK:STDOUT: %return.patt.427: %pattern_type.cb1 = return_slot_pattern %return.param_patt.900, %empty_tuple.type [concrete] -// CHECK:STDOUT: %C.as.IndexWith.impl.At.type: type = fn_type @C.as.IndexWith.impl.At [concrete] -// CHECK:STDOUT: %C.as.IndexWith.impl.At: %C.as.IndexWith.impl.At.type = struct_value () [concrete] -// CHECK:STDOUT: %IndexWith.facet: %IndexWith.type.a36 = facet_value %C, (%IndexWith.impl_witness) [concrete] -// CHECK:STDOUT: %IndexWith.WithSelf.At.type.d28: type = fn_type @IndexWith.WithSelf.At, @IndexWith.WithSelf(%empty_tuple.type, %empty_tuple.type, %IndexWith.facet) [concrete] -// CHECK:STDOUT: %IndexWith.WithSelf.At.a1d: %IndexWith.WithSelf.At.type.d28 = struct_value () [concrete] -// CHECK:STDOUT: %return.patt.9ca: %pattern_type.cb1 = return_slot_pattern %return.param_patt.900, invalid [concrete] -// CHECK:STDOUT: %F.type: type = fn_type @F [concrete] -// CHECK:STDOUT: %F: %F.type = struct_value () [concrete] -// CHECK:STDOUT: %c.patt: %pattern_type.98b = value_binding_pattern c [concrete] -// CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete] -// CHECK:STDOUT: %C.val: %C = struct_value () [concrete] -// CHECK:STDOUT: %.115: ref %C = temporary invalid, %C.val [concrete] -// CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete] -// CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete] -// CHECK:STDOUT: %self.param_patt.52f: %pattern_type.a96 = ref_param_pattern [concrete] -// CHECK:STDOUT: %self.patt.4b1: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt.52f [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc15_15.1 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.1: type = fn_type @Destroy.WithSelf.Op.loc15_15.1 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.403171.1: %Destroy.WithSelf.Op.type.ef016f.1 = struct_value () [concrete] -// CHECK:STDOUT: %self.param_patt.99a: %pattern_type.98b = ref_param_pattern [concrete] -// CHECK:STDOUT: %self.patt.cbd: %pattern_type.98b = wrapper_binding_pattern self, %self.param_patt.99a [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2: type = fn_type @Destroy.WithSelf.SubobjectDestroy.loc15_15.2 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.d01daf.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.type.ef016f.2: type = fn_type @Destroy.WithSelf.Op.loc15_15.2 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.Op.403171.2: %Destroy.WithSelf.Op.type.ef016f.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2: type = fn_type @Destroy.WithSelf.SelfDestruct.loc15_15.2 [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.db3fdb.2: %Destroy.WithSelf.SelfDestruct.type.fbceb5.2 = struct_value () [concrete] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.bound: = bound_method %.115, %Destroy.WithSelf.SelfDestruct.db3fdb.2 [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: imports { -// CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { -// CHECK:STDOUT: .IndexWith = %Core.IndexWith -// CHECK:STDOUT: .Destroy = %Core.Destroy -// CHECK:STDOUT: import Core//prelude -// CHECK:STDOUT: import Core//core_wrong_arg_count -// CHECK:STDOUT: import Core//prelude/... -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.IndexWith: %IndexWith.type.df6 = import_ref Core//core_wrong_arg_count, IndexWith, loaded [concrete = constants.%IndexWith.generic] -// CHECK:STDOUT: %Core.import_ref.cf2 = import_ref Core//core_wrong_arg_count, loc{{\d+_\d+}}, unloaded -// CHECK:STDOUT: %Core.At: @IndexWith.WithSelf.%IndexWith.WithSelf.At.type (%IndexWith.WithSelf.At.type.fcf) = import_ref Core//core_wrong_arg_count, At, loaded [symbolic = @IndexWith.WithSelf.%IndexWith.WithSelf.At (constants.%IndexWith.WithSelf.At.76c)] -// CHECK:STDOUT: %Core.import_ref.a1c = import_ref Core//core_wrong_arg_count, loc{{\d+_\d+}}, unloaded -// CHECK:STDOUT: %Core.import_ref.b3bc94.2: type = import_ref Core//core_wrong_arg_count, loc{{\d+_\d+}}, loaded [symbolic = @IndexWith.%SubscriptType (constants.%SubscriptType)] -// CHECK:STDOUT: %Core.import_ref.8e8b42.2: type = import_ref Core//core_wrong_arg_count, loc{{\d+_\d+}}, loaded [symbolic = @IndexWith.%ElementType (constants.%ElementType)] -// CHECK:STDOUT: %Core.import_ref.54cd15.2: @IndexWith.%IndexWith.type (%IndexWith.type.3a9) = import_ref Core//core_wrong_arg_count, loc{{\d+_\d+}}, loaded [symbolic = @IndexWith.%Self (constants.%Self.2cc)] -// CHECK:STDOUT: %Core.import_ref.eee = import_ref Core//core_wrong_arg_count, loc{{\d+_\d+}}, unloaded -// CHECK:STDOUT: %Core.import_ref.b3bc94.3: type = import_ref Core//core_wrong_arg_count, loc{{\d+_\d+}}, loaded [symbolic = @IndexWith.%SubscriptType (constants.%SubscriptType)] -// CHECK:STDOUT: %Core.import_ref.8e8b42.3: type = import_ref Core//core_wrong_arg_count, loc{{\d+_\d+}}, loaded [symbolic = @IndexWith.%ElementType (constants.%ElementType)] -// CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generated { -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.1: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.1 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc15_15.1 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.1] { -// CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f] -// CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0 -// CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.1: %Destroy.WithSelf.Op.type.ef016f.1 = fn_decl @Destroy.WithSelf.Op.loc15_15.1 [concrete = constants.%Destroy.WithSelf.Op.403171.1] { -// CHECK:STDOUT: %self.param_patt: %pattern_type.a96 = ref_param_pattern [concrete = constants.%self.param_patt.52f] -// CHECK:STDOUT: %self.patt: %pattern_type.a96 = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.4b1] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: ref %empty_struct_type = ref_param call_param0 -// CHECK:STDOUT: %self: ref %empty_struct_type = wrapper_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.decl.763c71.2: %Destroy.WithSelf.SubobjectDestroy.type.dfcbdb.2 = fn_decl @Destroy.WithSelf.SubobjectDestroy.loc15_15.2 [concrete = constants.%Destroy.WithSelf.SubobjectDestroy.d01daf.2] { -// CHECK:STDOUT: %self.param_patt: %pattern_type.98b = ref_param_pattern [concrete = constants.%self.param_patt.99a] -// CHECK:STDOUT: %self.patt: %pattern_type.98b = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.cbd] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: ref %C = ref_param call_param0 -// CHECK:STDOUT: %self: ref %C = wrapper_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %Destroy.WithSelf.Op.decl.5f94cf.2: %Destroy.WithSelf.Op.type.ef016f.2 = fn_decl @Destroy.WithSelf.Op.loc15_15.2 [concrete = constants.%Destroy.WithSelf.Op.403171.2] { -// CHECK:STDOUT: %self.param_patt: %pattern_type.98b = ref_param_pattern [concrete = constants.%self.param_patt.99a] -// CHECK:STDOUT: %self.patt: %pattern_type.98b = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.cbd] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %self.param: ref %C = ref_param call_param0 -// CHECK:STDOUT: %self: ref %C = wrapper_binding self, %self.param -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: file { -// CHECK:STDOUT: package: = namespace [concrete] { -// CHECK:STDOUT: .Core = imports.%Core -// CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: } -// CHECK:STDOUT: %Core.import = import Core -// CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {} -// CHECK:STDOUT: impl_decl @C.as.IndexWith.impl [concrete] {} { -// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %Core.ref: = name_ref Core, imports.%Core [concrete = imports.%Core] -// CHECK:STDOUT: %IndexWith.ref: %IndexWith.type.df6 = name_ref IndexWith, imports.%Core.IndexWith [concrete = constants.%IndexWith.generic] -// CHECK:STDOUT: %.loc8_27: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_31: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc8_32.1: type = converted %.loc8_27, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc8_32.2: type = converted %.loc8_31, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %IndexWith.type: type = facet_type <@IndexWith, @IndexWith(constants.%empty_tuple.type, constants.%empty_tuple.type)> [concrete = constants.%IndexWith.type.a36] -// CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8: = impl_self_witness @C.as.IndexWith.impl.%C.ref, @IndexWith, @IndexWith(constants.%empty_tuple.type, constants.%empty_tuple.type) [concrete = constants.%.b6e] -// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {} -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic interface @IndexWith(imports.%Core.import_ref.b3bc94.3: type, imports.%Core.import_ref.8e8b42.3: type) [from "core_wrong_arg_count.carbon"] { -// CHECK:STDOUT: %SubscriptType.patt: %pattern_type.9a5 = symbolic_binding_pattern SubscriptType, 0 [symbolic = %SubscriptType.patt (constants.%SubscriptType.patt)] -// CHECK:STDOUT: %SubscriptType: type = symbolic_binding SubscriptType, 0 [symbolic = %SubscriptType (constants.%SubscriptType)] -// CHECK:STDOUT: %ElementType.patt: %pattern_type.9a5 = symbolic_binding_pattern ElementType, 1 [symbolic = %ElementType.patt (constants.%ElementType.patt)] -// CHECK:STDOUT: %ElementType: type = symbolic_binding ElementType, 1 [symbolic = %ElementType (constants.%ElementType)] -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %IndexWith.type: type = facet_type <@IndexWith, @IndexWith(%SubscriptType, %ElementType)> [symbolic = %IndexWith.type (constants.%IndexWith.type.3a9)] -// CHECK:STDOUT: %Self: @IndexWith.%IndexWith.type (%IndexWith.type.3a9) = symbolic_binding Self, 2 [symbolic = %Self (constants.%Self.2cc)] -// CHECK:STDOUT: -// CHECK:STDOUT: interface { -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = imports.%Core.import_ref.eee -// CHECK:STDOUT: .At = imports.%Core.import_ref.cf2 -// CHECK:STDOUT: witness = (imports.%Core.At) -// CHECK:STDOUT: -// CHECK:STDOUT: !requires: -// CHECK:STDOUT: } -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: impl @C.as.IndexWith.impl: %C.ref as %IndexWith.type { -// CHECK:STDOUT: %C.as.IndexWith.impl.At.decl: %C.as.IndexWith.impl.At.type = fn_decl @C.as.IndexWith.impl.At [concrete = constants.%C.as.IndexWith.impl.At] { -// CHECK:STDOUT: %self.param_patt: %pattern_type.98b = value_param_pattern [concrete = constants.%self.param_patt.303] -// CHECK:STDOUT: %self.patt: %pattern_type.98b = wrapper_binding_pattern self, %self.param_patt [concrete = constants.%self.patt.36a] -// CHECK:STDOUT: %subscript.param_patt: %pattern_type.cb1 = value_param_pattern [concrete = constants.%subscript.param_patt.0ba] -// CHECK:STDOUT: %subscript.patt: %pattern_type.cb1 = wrapper_binding_pattern subscript, %subscript.param_patt [concrete = constants.%subscript.patt.17b] -// CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern [concrete = constants.%return.param_patt.900] -// CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %.loc9_48.2 [concrete = constants.%return.patt.427] -// CHECK:STDOUT: } { -// CHECK:STDOUT: %.loc9_48.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc9_48.2: type = converted %.loc9_48.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: %.loc9_48.3: Core.Form = init_form %.loc9_48.2 [concrete = constants.%.262] -// CHECK:STDOUT: %self.param: %C = value_param call_param0 -// CHECK:STDOUT: %Self.ref: type = name_ref Self, @C.as.IndexWith.impl.%C.ref [concrete = constants.%C] -// CHECK:STDOUT: %self: %C = wrapper_binding self, %self.param -// CHECK:STDOUT: %subscript.param: %empty_tuple.type = value_param call_param1 -// CHECK:STDOUT: %.loc9_41.1: type = splice_block %.loc9_41.3 [concrete = constants.%empty_tuple.type] { -// CHECK:STDOUT: %.loc9_41.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc9_41.3: type = converted %.loc9_41.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type] -// CHECK:STDOUT: } -// CHECK:STDOUT: %subscript: %empty_tuple.type = wrapper_binding subscript, %subscript.param -// CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param2 -// CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param -// CHECK:STDOUT: } -// CHECK:STDOUT: %IndexWith.impl_witness_table = impl_witness_table (%C.as.IndexWith.impl.At.decl), @C.as.IndexWith.impl [concrete] -// CHECK:STDOUT: %IndexWith.impl_witness: = impl_witness %IndexWith.impl_witness_table [concrete = constants.%IndexWith.impl_witness] -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .At = %C.as.IndexWith.impl.At.decl -// CHECK:STDOUT: extend %IndexWith.type -// CHECK:STDOUT: witness = %IndexWith.impl_witness -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: class @C { -// CHECK:STDOUT: %complete_type: = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type] -// CHECK:STDOUT: complete_type_witness = %complete_type -// CHECK:STDOUT: -// CHECK:STDOUT: !members: -// CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: generic fn @IndexWith.WithSelf.At(imports.%Core.import_ref.b3bc94.2: type, imports.%Core.import_ref.8e8b42.2: type, imports.%Core.import_ref.54cd15.2: @IndexWith.%IndexWith.type (%IndexWith.type.3a9)) [from "core_wrong_arg_count.carbon"] { -// CHECK:STDOUT: %SubscriptType: type = symbolic_binding SubscriptType, 0 [symbolic = %SubscriptType (constants.%SubscriptType)] -// CHECK:STDOUT: %ElementType: type = symbolic_binding ElementType, 1 [symbolic = %ElementType (constants.%ElementType)] -// CHECK:STDOUT: %IndexWith.type: type = facet_type <@IndexWith, @IndexWith(%SubscriptType, %ElementType)> [symbolic = %IndexWith.type (constants.%IndexWith.type.3a9)] -// CHECK:STDOUT: %Self: @IndexWith.WithSelf.At.%IndexWith.type (%IndexWith.type.3a9) = symbolic_binding Self, 2 [symbolic = %Self (constants.%Self.2cc)] -// CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.672)] -// CHECK:STDOUT: %pattern_type.1: type = pattern_type %Self.as_type [symbolic = %pattern_type.1 (constants.%pattern_type.b0d)] -// CHECK:STDOUT: %self.param_patt: @IndexWith.WithSelf.At.%pattern_type.1 (%pattern_type.b0d) = value_param_pattern [symbolic = %self.param_patt (constants.%self.param_patt.9e6)] -// CHECK:STDOUT: %self.patt: @IndexWith.WithSelf.At.%pattern_type.1 (%pattern_type.b0d) = wrapper_binding_pattern self, %self.param_patt [symbolic = %self.patt (constants.%self.patt.2f1)] -// CHECK:STDOUT: %pattern_type.2: type = pattern_type %SubscriptType [symbolic = %pattern_type.2 (constants.%pattern_type.51d)] -// CHECK:STDOUT: %subscript.param_patt: @IndexWith.WithSelf.At.%pattern_type.2 (%pattern_type.51d) = value_param_pattern [symbolic = %subscript.param_patt (constants.%subscript.param_patt.fd1)] -// CHECK:STDOUT: %subscript.patt: @IndexWith.WithSelf.At.%pattern_type.2 (%pattern_type.51d) = wrapper_binding_pattern subscript, %subscript.param_patt [symbolic = %subscript.patt (constants.%subscript.patt.bfe)] -// CHECK:STDOUT: %.1: Core.Form = init_form %ElementType [symbolic = %.1 (constants.%.822)] -// CHECK:STDOUT: %pattern_type.3: type = pattern_type %ElementType [symbolic = %pattern_type.3 (constants.%pattern_type.946)] -// CHECK:STDOUT: %return.param_patt: @IndexWith.WithSelf.At.%pattern_type.3 (%pattern_type.946) = out_param_pattern [symbolic = %return.param_patt (constants.%return.param_patt.6dd)] -// CHECK:STDOUT: %return.patt: @IndexWith.WithSelf.At.%pattern_type.3 (%pattern_type.946) = return_slot_pattern %return.param_patt, invalid [symbolic = %return.patt (constants.%return.patt.fc9)] -// CHECK:STDOUT: -// CHECK:STDOUT: fn; -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @C.as.IndexWith.impl.At(%self.param: %C, %subscript.param: %empty_tuple.type) -> out %return.param: %empty_tuple.type { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_13.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_13.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %.loc10_14: init %empty_tuple.type = converted %.loc10_13.1, %.loc10_13.2 [concrete = constants.%empty_tuple] -// CHECK:STDOUT: return %.loc10_14 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @F() { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_15.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc15_15.2: ref %C = temporary_storage -// CHECK:STDOUT: %.loc15_15.3: init %C to %.loc15_15.2 = class_init () [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc15_15.4: init %C = converted %.loc15_15.1, %.loc15_15.3 [concrete = constants.%C.val] -// CHECK:STDOUT: %.loc15_15.5: ref %C = temporary %.loc15_15.2, %.loc15_15.4 [concrete = constants.%.115] -// CHECK:STDOUT: %.loc15_15.6: %C = acquire_value %.loc15_15.5 [concrete = constants.%C.val] -// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C] -// CHECK:STDOUT: %c: %C = wrapper_binding c, %.loc15_15.6 -// CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %c.patt: %pattern_type.98b = value_binding_pattern c [concrete = constants.%c.patt] -// CHECK:STDOUT: } -// CHECK:STDOUT: %c.ref: %C = name_ref c, %c -// CHECK:STDOUT: %.loc19: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple] -// CHECK:STDOUT: %Destroy.WithSelf.SelfDestruct.call: init %empty_tuple.type = call constants.%Destroy.WithSelf.SelfDestruct.bound(constants.%.115) -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc15_15.1(%self.param: ref %empty_struct_type) = "no_op"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc15_15.1(%self.param: ref %empty_struct_type) = "no_op"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc15_15.1(%self.param: ref %empty_struct_type) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.1(%self.param) -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.1(%self.param) -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SubobjectDestroy.loc15_15.2(%self.param: ref %C) = "no_op"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.Op.loc15_15.2(%self.param: ref %C) = "no_op"; -// CHECK:STDOUT: -// CHECK:STDOUT: fn @Destroy.WithSelf.SelfDestruct.loc15_15.2(%self.param: ref %C) { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Destroy.WithSelf.Op.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.Op.decl.5f94cf.2(%self.param) -// CHECK:STDOUT: %Destroy.WithSelf.SubobjectDestroy.call: init %empty_tuple.type = call generated.%Destroy.WithSelf.SubobjectDestroy.decl.763c71.2(%self.param) -// CHECK:STDOUT: return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @IndexWith(constants.%SubscriptType, constants.%ElementType) { -// CHECK:STDOUT: %SubscriptType.patt => constants.%SubscriptType.patt -// CHECK:STDOUT: %SubscriptType => constants.%SubscriptType -// CHECK:STDOUT: %ElementType.patt => constants.%ElementType.patt -// CHECK:STDOUT: %ElementType => constants.%ElementType -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @IndexWith.WithSelf(constants.%SubscriptType, constants.%ElementType, constants.%Self.2cc) {} -// CHECK:STDOUT: -// CHECK:STDOUT: specific @IndexWith.WithSelf.At(constants.%SubscriptType, constants.%ElementType, constants.%Self.2cc) { -// CHECK:STDOUT: %SubscriptType => constants.%SubscriptType -// CHECK:STDOUT: %ElementType => constants.%ElementType -// CHECK:STDOUT: %IndexWith.type => constants.%IndexWith.type.3a9 -// CHECK:STDOUT: %Self => constants.%Self.2cc -// CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.672 -// CHECK:STDOUT: %pattern_type.1 => constants.%pattern_type.b0d -// CHECK:STDOUT: %self.param_patt => constants.%self.param_patt.9e6 -// CHECK:STDOUT: %self.patt => constants.%self.patt.2f1 -// CHECK:STDOUT: %pattern_type.2 => constants.%pattern_type.51d -// CHECK:STDOUT: %subscript.param_patt => constants.%subscript.param_patt.fd1 -// CHECK:STDOUT: %subscript.patt => constants.%subscript.patt.bfe -// CHECK:STDOUT: %.1 => constants.%.822 -// CHECK:STDOUT: %pattern_type.3 => constants.%pattern_type.946 -// CHECK:STDOUT: %return.param_patt => constants.%return.param_patt.6dd -// CHECK:STDOUT: %return.patt => constants.%return.patt.fc9 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @IndexWith(constants.%empty_tuple.type, constants.%empty_tuple.type) { -// CHECK:STDOUT: %SubscriptType.patt => constants.%SubscriptType.patt -// CHECK:STDOUT: %SubscriptType => constants.%empty_tuple.type -// CHECK:STDOUT: %ElementType.patt => constants.%ElementType.patt -// CHECK:STDOUT: %ElementType => constants.%empty_tuple.type -// CHECK:STDOUT: -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %IndexWith.type => constants.%IndexWith.type.a36 -// CHECK:STDOUT: %Self => constants.%Self.cc6 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @IndexWith.WithSelf(constants.%empty_tuple.type, constants.%empty_tuple.type, constants.%Self.2cc) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %SubscriptType => constants.%empty_tuple.type -// CHECK:STDOUT: %ElementType => constants.%empty_tuple.type -// CHECK:STDOUT: %IndexWith.type => constants.%IndexWith.type.a36 -// CHECK:STDOUT: %Self => constants.%Self.2cc -// CHECK:STDOUT: %IndexWith.WithSelf.At.type => constants.%IndexWith.WithSelf.At.type.540 -// CHECK:STDOUT: %IndexWith.WithSelf.At => constants.%IndexWith.WithSelf.At.451 -// CHECK:STDOUT: %IndexWith.assoc_type => constants.%IndexWith.assoc_type.20a -// CHECK:STDOUT: %assoc0 => constants.%assoc0.8ef -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @IndexWith.WithSelf(constants.%empty_tuple.type, constants.%empty_tuple.type, constants.%IndexWith.facet) { -// CHECK:STDOUT: !definition: -// CHECK:STDOUT: %SubscriptType => constants.%empty_tuple.type -// CHECK:STDOUT: %ElementType => constants.%empty_tuple.type -// CHECK:STDOUT: %IndexWith.type => constants.%IndexWith.type.a36 -// CHECK:STDOUT: %Self => constants.%IndexWith.facet -// CHECK:STDOUT: %IndexWith.WithSelf.At.type => constants.%IndexWith.WithSelf.At.type.d28 -// CHECK:STDOUT: %IndexWith.WithSelf.At => constants.%IndexWith.WithSelf.At.a1d -// CHECK:STDOUT: %IndexWith.assoc_type => constants.%IndexWith.assoc_type.20a -// CHECK:STDOUT: %assoc0 => constants.%assoc0.8ef -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: specific @IndexWith.WithSelf.At(constants.%empty_tuple.type, constants.%empty_tuple.type, constants.%IndexWith.facet) { -// CHECK:STDOUT: %SubscriptType => constants.%empty_tuple.type -// CHECK:STDOUT: %ElementType => constants.%empty_tuple.type -// CHECK:STDOUT: %IndexWith.type => constants.%IndexWith.type.a36 -// CHECK:STDOUT: %Self => constants.%IndexWith.facet -// CHECK:STDOUT: %Self.as_type => constants.%C -// CHECK:STDOUT: %pattern_type.1 => constants.%pattern_type.98b -// CHECK:STDOUT: %self.param_patt => constants.%self.param_patt.303 -// CHECK:STDOUT: %self.patt => constants.%self.patt.36a -// CHECK:STDOUT: %pattern_type.2 => constants.%pattern_type.cb1 -// CHECK:STDOUT: %subscript.param_patt => constants.%subscript.param_patt.0ba -// CHECK:STDOUT: %subscript.patt => constants.%subscript.patt.17b -// CHECK:STDOUT: %.1 => constants.%.262 -// CHECK:STDOUT: %pattern_type.3 => constants.%pattern_type.cb1 -// CHECK:STDOUT: %return.param_patt => constants.%return.param_patt.900 -// CHECK:STDOUT: %return.patt => constants.%return.patt.9ca -// CHECK:STDOUT: } -// CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/index_with_prelude.carbon b/toolchain/check/testdata/operators/overloaded/index_with_prelude.carbon index 1848ddf7a922..4210ce6978d8 100644 --- a/toolchain/check/testdata/operators/overloaded/index_with_prelude.carbon +++ b/toolchain/check/testdata/operators/overloaded/index_with_prelude.carbon @@ -112,6 +112,8 @@ let x: i32 = c[0]; // CHECK:STDOUT: %pattern_type.ea5: type = pattern_type %SubscriptType.f8f [concrete] // CHECK:STDOUT: %subscript.param_patt.5ee: %pattern_type.ea5 = value_param_pattern [concrete] // CHECK:STDOUT: %subscript.patt.32e: %pattern_type.ea5 = wrapper_binding_pattern subscript, %subscript.param_patt.5ee [concrete] +// CHECK:STDOUT: %IndirectIndexWith.type.841: type = generic_interface_type @IndirectIndexWith [concrete] +// CHECK:STDOUT: %IndirectIndexWith.generic: %IndirectIndexWith.type.841 = struct_value () [concrete] // CHECK:STDOUT: %IndexWith.facet.bd0: %IndexWith.type.a14 = facet_value %C, (%IndexWith.impl_witness.ae9) [concrete] // CHECK:STDOUT: %IndexWith.WithSelf.At.type.a20: type = fn_type @IndexWith.WithSelf.At, @IndexWith.WithSelf(%SubscriptType.f8f, %IndexWith.facet.bd0) [concrete] // CHECK:STDOUT: %.4d0: Core.Form = init_form %ElementType [concrete] @@ -135,6 +137,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .IndexWith = %Core.IndexWith +// CHECK:STDOUT: .IndirectIndexWith = %Core.IndirectIndexWith // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -143,6 +146,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: %Core.import_ref.fc2: type = import_ref Core//prelude/operators/index, loc{{\d+_\d+}}, loaded [concrete = %ElementType] // CHECK:STDOUT: %Core.import_ref.6b6e53.2 = import_ref Core//prelude/operators/index, loc{{\d+_\d+}}, unloaded // CHECK:STDOUT: %ElementType: type = assoc_const_decl @ElementType.1 [concrete] {} +// CHECK:STDOUT: %Core.IndirectIndexWith: %IndirectIndexWith.type.841 = import_ref Core//prelude/operators/index, IndirectIndexWith, loaded [concrete = constants.%IndirectIndexWith.generic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -340,6 +344,8 @@ let x: i32 = c[0]; // CHECK:STDOUT: %s.patt: %pattern_type.8b4 = value_binding_pattern s [concrete] // CHECK:STDOUT: %tuple.adf: %tuple.type.748 = tuple_value (%empty_tuple.4db, %empty_tuple.4db) [concrete] // CHECK:STDOUT: %e.patt: %pattern_type.98b = value_binding_pattern e [concrete] +// CHECK:STDOUT: %IndirectIndexWith.type.841: type = generic_interface_type @IndirectIndexWith [concrete] +// CHECK:STDOUT: %IndirectIndexWith.generic: %IndirectIndexWith.type.841 = struct_value () [concrete] // CHECK:STDOUT: %.12a: type = fn_type_with_self_type %IndexWith.WithSelf.At.type.e67, %IndexWith.facet.5f1 [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: @@ -347,6 +353,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .IndexWith = %Core.IndexWith // CHECK:STDOUT: .IntLiteral = %Core.IntLiteral +// CHECK:STDOUT: .IndirectIndexWith = %Core.IndirectIndexWith // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -356,6 +363,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: %Core.IntLiteral: type = import_ref Core//prelude/types/int_literal, IntLiteral, loaded [concrete = Core.IntLiteral] // CHECK:STDOUT: %Core.import_ref.6b6e53.2 = import_ref Core//prelude/operators/index, loc{{\d+_\d+}}, unloaded // CHECK:STDOUT: %ElementType: type = assoc_const_decl @ElementType [concrete] {} +// CHECK:STDOUT: %Core.IndirectIndexWith: %IndirectIndexWith.type.841 = import_ref Core//prelude/operators/index, IndirectIndexWith, loaded [concrete = constants.%IndirectIndexWith.generic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -531,6 +539,8 @@ let x: i32 = c[0]; // CHECK:STDOUT: %pattern_type.ea5: type = pattern_type %SubscriptType.f8f [concrete] // CHECK:STDOUT: %subscript.param_patt.5ee: %pattern_type.ea5 = value_param_pattern [concrete] // CHECK:STDOUT: %subscript.patt.32e: %pattern_type.ea5 = wrapper_binding_pattern subscript, %subscript.param_patt.5ee [concrete] +// CHECK:STDOUT: %IndirectIndexWith.type.841: type = generic_interface_type @IndirectIndexWith [concrete] +// CHECK:STDOUT: %IndirectIndexWith.generic: %IndirectIndexWith.type.841 = struct_value () [concrete] // CHECK:STDOUT: %IndexWith.facet.bd0: %IndexWith.type.a14 = facet_value %C, (%IndexWith.impl_witness.ae9) [concrete] // CHECK:STDOUT: %.4d0: Core.Form = init_form %ElementType [concrete] // CHECK:STDOUT: %pattern_type.67c: type = pattern_type %ElementType [concrete] @@ -550,6 +560,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .IndexWith = %Core.IndexWith +// CHECK:STDOUT: .IndirectIndexWith = %Core.IndirectIndexWith // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } @@ -558,6 +569,7 @@ let x: i32 = c[0]; // CHECK:STDOUT: %Core.import_ref.fc2: type = import_ref Core//prelude/operators/index, loc{{\d+_\d+}}, loaded [concrete = %ElementType] // CHECK:STDOUT: %Core.import_ref.6b6e53.2 = import_ref Core//prelude/operators/index, loc{{\d+_\d+}}, unloaded // CHECK:STDOUT: %ElementType: type = assoc_const_decl @ElementType.1 [concrete] {} +// CHECK:STDOUT: %Core.IndirectIndexWith: %IndirectIndexWith.type.841 = import_ref Core//prelude/operators/index, IndirectIndexWith, loaded [concrete = constants.%IndirectIndexWith.generic] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -708,6 +720,8 @@ let x: i32 = c[0]; // CHECK:STDOUT: %pattern_type.d94: type = pattern_type %i32 [concrete] // CHECK:STDOUT: %x.patt: %pattern_type.d94 = value_binding_pattern x [concrete] // CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete] +// CHECK:STDOUT: %IndirectIndexWith.type.841: type = generic_interface_type @IndirectIndexWith [concrete] +// CHECK:STDOUT: %IndirectIndexWith.generic: %IndirectIndexWith.type.841 = struct_value () [concrete] // CHECK:STDOUT: %IndexWith.type.df6: type = generic_interface_type @IndexWith [concrete] // CHECK:STDOUT: %IndexWith.generic: %IndexWith.type.df6 = struct_value () [concrete] // CHECK:STDOUT: } @@ -715,11 +729,13 @@ let x: i32 = c[0]; // CHECK:STDOUT: imports { // CHECK:STDOUT: %Core: = namespace file.%Core.import, [concrete] { // CHECK:STDOUT: .Int = %Core.Int +// CHECK:STDOUT: .IndirectIndexWith = %Core.IndirectIndexWith // CHECK:STDOUT: .IndexWith = %Core.IndexWith // CHECK:STDOUT: import Core//prelude // CHECK:STDOUT: import Core//prelude/... // CHECK:STDOUT: } // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic] +// CHECK:STDOUT: %Core.IndirectIndexWith: %IndirectIndexWith.type.841 = import_ref Core//prelude/operators/index, IndirectIndexWith, loaded [concrete = constants.%IndirectIndexWith.generic] // CHECK:STDOUT: %Core.IndexWith: %IndexWith.type.df6 = import_ref Core//prelude/operators/index, IndexWith, loaded [concrete = constants.%IndexWith.generic] // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/indirect_index_with.carbon b/toolchain/check/testdata/operators/overloaded/indirect_index_with.carbon index e680bcabbdb3..de4d63e461fc 100644 --- a/toolchain/check/testdata/operators/overloaded/indirect_index_with.carbon +++ b/toolchain/check/testdata/operators/overloaded/indirect_index_with.carbon @@ -94,6 +94,42 @@ fn F(c: CNonCopy, s: SubscriptType) { c.(Core.IndexWith(SubscriptType).At)(s); } +// --- subscript_copyable.carbon + +library "[[@TEST_NAME]]"; + +import library "types"; + +fn F(c: C, s: SubscriptType) -> Copyable { + //@dump-sem-ir-begin + return c[s]; + //@dump-sem-ir-end +} + +// --- subscript_non_copyable.carbon + +library "[[@TEST_NAME]]"; + +import library "types"; + +fn F(c: CNonCopy, s: SubscriptType) -> ref NonCopyable { + //@dump-sem-ir-begin + return c[s]; + //@dump-sem-ir-end +} + +// --- subscript_assign.carbon + +library "[[@TEST_NAME]]"; + +import library "types"; + +fn F(c: C, s: SubscriptType, v: Copyable) { + //@dump-sem-ir-begin + c[s] = v; + //@dump-sem-ir-end +} + // CHECK:STDOUT: --- types.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { @@ -455,3 +491,128 @@ fn F(c: CNonCopy, s: SubscriptType) { // CHECK:STDOUT: return %T.as_type.as.IndexWith.impl.At.call to %return.param // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: --- subscript_copyable.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: type: type = facet_type [concrete] +// CHECK:STDOUT: %C: type = class_type @C [concrete] +// CHECK:STDOUT: %Copyable: type = class_type @Copyable [concrete] +// CHECK:STDOUT: %SubscriptType.f8f: type = class_type @SubscriptType [concrete] +// CHECK:STDOUT: %IndirectIndexWith.type.c10: type = facet_type <@IndirectIndexWith, @IndirectIndexWith(%SubscriptType.f8f)> [concrete] +// CHECK:STDOUT: %IndirectIndexWith.impl_witness: = impl_witness imports.%IndirectIndexWith.impl_witness_table [concrete] +// CHECK:STDOUT: %IndirectIndexWith.facet: %IndirectIndexWith.type.c10 = facet_value %C, (%IndirectIndexWith.impl_witness) [concrete] +// CHECK:STDOUT: %IndirectIndexWith.WithSelf.Ref.type.7ed: type = fn_type @IndirectIndexWith.WithSelf.Ref, @IndirectIndexWith.WithSelf(%SubscriptType.f8f, %IndirectIndexWith.facet) [concrete] +// CHECK:STDOUT: %.edc: type = fn_type_with_self_type %IndirectIndexWith.WithSelf.Ref.type.7ed, %IndirectIndexWith.facet [concrete] +// CHECK:STDOUT: %C.as.IndirectIndexWith.impl.Ref.type: type = fn_type @C.as.IndirectIndexWith.impl.Ref [concrete] +// CHECK:STDOUT: %C.as.IndirectIndexWith.impl.Ref: %C.as.IndirectIndexWith.impl.Ref.type = struct_value () [concrete] +// CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete] +// CHECK:STDOUT: %Copy.impl_witness.c00: = impl_witness imports.%Copy.impl_witness_table.a69 [concrete] +// CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %Copyable, (%Copy.impl_witness.c00) [concrete] +// CHECK:STDOUT: %Copy.WithSelf.Op.type.43f: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%Copy.facet) [concrete] +// CHECK:STDOUT: %.9d4: type = fn_type_with_self_type %Copy.WithSelf.Op.type.43f, %Copy.facet [concrete] +// CHECK:STDOUT: %Copyable.as.Copy.impl.Op.type: type = fn_type @Copyable.as.Copy.impl.Op [concrete] +// CHECK:STDOUT: %Copyable.as.Copy.impl.Op: %Copyable.as.Copy.impl.Op.type = struct_value () [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Main.import_ref.bdc = import_ref Main//types, loc17_79, unloaded +// CHECK:STDOUT: %Main.import_ref.2b0: %C.as.IndirectIndexWith.impl.Ref.type = import_ref Main//types, loc18_65, loaded [concrete = constants.%C.as.IndirectIndexWith.impl.Ref] +// CHECK:STDOUT: %IndirectIndexWith.impl_witness_table = impl_witness_table (%Main.import_ref.bdc, %Main.import_ref.2b0), @C.as.IndirectIndexWith.impl [concrete] +// CHECK:STDOUT: %Main.import_ref.b8e: %Copyable.as.Copy.impl.Op.type = import_ref Main//types, loc6_32, loaded [concrete = constants.%Copyable.as.Copy.impl.Op] +// CHECK:STDOUT: %Copy.impl_witness_table.a69 = impl_witness_table (%Main.import_ref.b8e), @Copyable.as.Copy.impl [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F(%c.param: %C, %s.param: %SubscriptType.f8f) -> out %return.param: %Copyable { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %c.ref: %C = name_ref c, %c +// CHECK:STDOUT: %s.ref: %SubscriptType.f8f = name_ref s, %s +// CHECK:STDOUT: %impl.elem1: %.edc = impl_witness_access constants.%IndirectIndexWith.impl_witness, element1 [concrete = constants.%C.as.IndirectIndexWith.impl.Ref] +// CHECK:STDOUT: %bound_method.loc8_13.1: = bound_method %c.ref, %impl.elem1 +// CHECK:STDOUT: %C.as.IndirectIndexWith.impl.Ref.call: ref %Copyable = call %bound_method.loc8_13.1(%c.ref, %s.ref) +// CHECK:STDOUT: %.loc8: %Copyable = acquire_value %C.as.IndirectIndexWith.impl.Ref.call +// CHECK:STDOUT: %impl.elem0: %.9d4 = impl_witness_access constants.%Copy.impl_witness.c00, element0 [concrete = constants.%Copyable.as.Copy.impl.Op] +// CHECK:STDOUT: %bound_method.loc8_13.2: = bound_method %.loc8, %impl.elem0 +// CHECK:STDOUT: +// CHECK:STDOUT: %Copyable.as.Copy.impl.Op.call: init %Copyable to %.loc6_33.1 = call %bound_method.loc8_13.2(%.loc8) +// CHECK:STDOUT: return %Copyable.as.Copy.impl.Op.call to %return.param +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- subscript_non_copyable.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: type: type = facet_type [concrete] +// CHECK:STDOUT: %CNonCopy: type = class_type @CNonCopy [concrete] +// CHECK:STDOUT: %NonCopyable: type = class_type @NonCopyable [concrete] +// CHECK:STDOUT: %SubscriptType.f8f: type = class_type @SubscriptType [concrete] +// CHECK:STDOUT: %IndirectIndexWith.type.c10: type = facet_type <@IndirectIndexWith, @IndirectIndexWith(%SubscriptType.f8f)> [concrete] +// CHECK:STDOUT: %IndirectIndexWith.impl_witness: = impl_witness imports.%IndirectIndexWith.impl_witness_table [concrete] +// CHECK:STDOUT: %IndirectIndexWith.facet: %IndirectIndexWith.type.c10 = facet_value %CNonCopy, (%IndirectIndexWith.impl_witness) [concrete] +// CHECK:STDOUT: %IndirectIndexWith.WithSelf.Ref.type.111: type = fn_type @IndirectIndexWith.WithSelf.Ref, @IndirectIndexWith.WithSelf(%SubscriptType.f8f, %IndirectIndexWith.facet) [concrete] +// CHECK:STDOUT: %.e4b: type = fn_type_with_self_type %IndirectIndexWith.WithSelf.Ref.type.111, %IndirectIndexWith.facet [concrete] +// CHECK:STDOUT: %CNonCopy.as.IndirectIndexWith.impl.Ref.type: type = fn_type @CNonCopy.as.IndirectIndexWith.impl.Ref [concrete] +// CHECK:STDOUT: %CNonCopy.as.IndirectIndexWith.impl.Ref: %CNonCopy.as.IndirectIndexWith.impl.Ref.type = struct_value () [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Main.import_ref.e33 = import_ref Main//types, loc29_38, unloaded +// CHECK:STDOUT: %Main.import_ref.2b0: %CNonCopy.as.IndirectIndexWith.impl.Ref.type = import_ref Main//types, loc30_68, loaded [concrete = constants.%CNonCopy.as.IndirectIndexWith.impl.Ref] +// CHECK:STDOUT: %IndirectIndexWith.impl_witness_table = impl_witness_table (%Main.import_ref.e33, %Main.import_ref.2b0), @CNonCopy.as.IndirectIndexWith.impl [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F(%c.param: %CNonCopy, %s.param: %SubscriptType.f8f) -> ref %NonCopyable { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %c.ref: %CNonCopy = name_ref c, %c +// CHECK:STDOUT: %s.ref: %SubscriptType.f8f = name_ref s, %s +// CHECK:STDOUT: %impl.elem1: %.e4b = impl_witness_access constants.%IndirectIndexWith.impl_witness, element1 [concrete = constants.%CNonCopy.as.IndirectIndexWith.impl.Ref] +// CHECK:STDOUT: %bound_method: = bound_method %c.ref, %impl.elem1 +// CHECK:STDOUT: %CNonCopy.as.IndirectIndexWith.impl.Ref.call: ref %NonCopyable = call %bound_method(%c.ref, %s.ref) +// CHECK:STDOUT: return %CNonCopy.as.IndirectIndexWith.impl.Ref.call +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: --- subscript_assign.carbon +// CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: type: type = facet_type [concrete] +// CHECK:STDOUT: %C: type = class_type @C [concrete] +// CHECK:STDOUT: %Copyable: type = class_type @Copyable [concrete] +// CHECK:STDOUT: %SubscriptType.f8f: type = class_type @SubscriptType [concrete] +// CHECK:STDOUT: %IndirectIndexWith.type.c10: type = facet_type <@IndirectIndexWith, @IndirectIndexWith(%SubscriptType.f8f)> [concrete] +// CHECK:STDOUT: %IndirectIndexWith.impl_witness: = impl_witness imports.%IndirectIndexWith.impl_witness_table [concrete] +// CHECK:STDOUT: %IndirectIndexWith.facet: %IndirectIndexWith.type.c10 = facet_value %C, (%IndirectIndexWith.impl_witness) [concrete] +// CHECK:STDOUT: %IndirectIndexWith.WithSelf.Ref.type.7ed: type = fn_type @IndirectIndexWith.WithSelf.Ref, @IndirectIndexWith.WithSelf(%SubscriptType.f8f, %IndirectIndexWith.facet) [concrete] +// CHECK:STDOUT: %.edc: type = fn_type_with_self_type %IndirectIndexWith.WithSelf.Ref.type.7ed, %IndirectIndexWith.facet [concrete] +// CHECK:STDOUT: %C.as.IndirectIndexWith.impl.Ref.type: type = fn_type @C.as.IndirectIndexWith.impl.Ref [concrete] +// CHECK:STDOUT: %C.as.IndirectIndexWith.impl.Ref: %C.as.IndirectIndexWith.impl.Ref.type = struct_value () [concrete] +// CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete] +// CHECK:STDOUT: %Copy.impl_witness.c00: = impl_witness imports.%Copy.impl_witness_table.a69 [concrete] +// CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %Copyable, (%Copy.impl_witness.c00) [concrete] +// CHECK:STDOUT: %Copy.WithSelf.Op.type.43f: type = fn_type @Copy.WithSelf.Op, @Copy.WithSelf(%Copy.facet) [concrete] +// CHECK:STDOUT: %.9d4: type = fn_type_with_self_type %Copy.WithSelf.Op.type.43f, %Copy.facet [concrete] +// CHECK:STDOUT: %Copyable.as.Copy.impl.Op.type: type = fn_type @Copyable.as.Copy.impl.Op [concrete] +// CHECK:STDOUT: %Copyable.as.Copy.impl.Op: %Copyable.as.Copy.impl.Op.type = struct_value () [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: imports { +// CHECK:STDOUT: %Main.import_ref.bdc = import_ref Main//types, loc17_79, unloaded +// CHECK:STDOUT: %Main.import_ref.2b0: %C.as.IndirectIndexWith.impl.Ref.type = import_ref Main//types, loc18_65, loaded [concrete = constants.%C.as.IndirectIndexWith.impl.Ref] +// CHECK:STDOUT: %IndirectIndexWith.impl_witness_table = impl_witness_table (%Main.import_ref.bdc, %Main.import_ref.2b0), @C.as.IndirectIndexWith.impl [concrete] +// CHECK:STDOUT: %Main.import_ref.b8e: %Copyable.as.Copy.impl.Op.type = import_ref Main//types, loc6_32, loaded [concrete = constants.%Copyable.as.Copy.impl.Op] +// CHECK:STDOUT: %Copy.impl_witness_table.a69 = impl_witness_table (%Main.import_ref.b8e), @Copyable.as.Copy.impl [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: fn @F(%c.param: %C, %s.param: %SubscriptType.f8f, %v.param: %Copyable) { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %c.ref: %C = name_ref c, %c +// CHECK:STDOUT: %s.ref: %SubscriptType.f8f = name_ref s, %s +// CHECK:STDOUT: %impl.elem1: %.edc = impl_witness_access constants.%IndirectIndexWith.impl_witness, element1 [concrete = constants.%C.as.IndirectIndexWith.impl.Ref] +// CHECK:STDOUT: %bound_method.loc8_6: = bound_method %c.ref, %impl.elem1 +// CHECK:STDOUT: %C.as.IndirectIndexWith.impl.Ref.call: ref %Copyable = call %bound_method.loc8_6(%c.ref, %s.ref) +// CHECK:STDOUT: %v.ref: %Copyable = name_ref v, %v +// CHECK:STDOUT: %impl.elem0: %.9d4 = impl_witness_access constants.%Copy.impl_witness.c00, element0 [concrete = constants.%Copyable.as.Copy.impl.Op] +// CHECK:STDOUT: %bound_method.loc8_10: = bound_method %v.ref, %impl.elem0 +// CHECK:STDOUT: %.loc8: ref %Copyable = splice_block %C.as.IndirectIndexWith.impl.Ref.call {} +// CHECK:STDOUT: %Copyable.as.Copy.impl.Op.call: init %Copyable to %.loc8 = call %bound_method.loc8_10(%v.ref) +// CHECK:STDOUT: assign %C.as.IndirectIndexWith.impl.Ref.call, %Copyable.as.Copy.impl.Op.call +// CHECK:STDOUT: +// CHECK:STDOUT: } +// CHECK:STDOUT: diff --git a/toolchain/lower/testdata/index/indirect_index_with.carbon b/toolchain/lower/testdata/index/indirect_index_with.carbon index b709da366cec..44ee51821237 100644 --- a/toolchain/lower/testdata/index/indirect_index_with.carbon +++ b/toolchain/lower/testdata/index/indirect_index_with.carbon @@ -32,46 +32,70 @@ fn LoadViaAt(s: Span) -> i32 { return s.(Core.IndexWith(i32).At)(0); } +fn StoreSubscript(s: Span, i: i32, v: i32) { + s[i] = v; +} + +fn LoadSubscript(s: Span, i: i32) -> i32 { + return s[i]; +} + // CHECK:STDOUT: ; --- // CHECK:STDOUT: ; ModuleID = 'indirect_index_with.carbon' // CHECK:STDOUT: source_filename = "indirect_index_with.carbon" // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define ptr @"_CRef.Span.Main:IndirectIndexWith.55456748a8a2eb70.Core"(ptr %self, i32 %subscript) #0 !dbg !14 { +// CHECK:STDOUT: define ptr @"_CRef.Span.Main:IndirectIndexWith.55456748a8a2eb70.Core"(ptr %self, i32 %subscript) #0 !dbg !18 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc19_17.1.ptr = getelementptr inbounds nuw { ptr }, ptr %self, i32 0, i32 0, !dbg !21 -// CHECK:STDOUT: %.loc19_17.2 = load ptr, ptr %.loc19_17.1.ptr, align 8, !dbg !21 -// CHECK:STDOUT: ret ptr %.loc19_17.2, !dbg !23 +// CHECK:STDOUT: %.loc19_17.1.ptr = getelementptr inbounds nuw { ptr }, ptr %self, i32 0, i32 0, !dbg !25 +// CHECK:STDOUT: %.loc19_17.2 = load ptr, ptr %.loc19_17.1.ptr, align 8, !dbg !25 +// CHECK:STDOUT: ret ptr %.loc19_17.2, !dbg !27 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define void @_CStore.Main(ptr %s, i32 %v) #0 !dbg !25 { +// CHECK:STDOUT: define void @_CStore.Main(ptr %s, i32 %v) #0 !dbg !29 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %Span.as.IndirectIndexWith.impl.Ref.call = call ptr @"_CRef.Span.Main:IndirectIndexWith.55456748a8a2eb70.Core"(ptr %s, i32 0), !dbg !30 -// CHECK:STDOUT: store i32 %v, ptr %Span.as.IndirectIndexWith.impl.Ref.call, align 4, !dbg !30 -// CHECK:STDOUT: ret void, !dbg !32 +// CHECK:STDOUT: %Span.as.IndirectIndexWith.impl.Ref.call = call ptr @"_CRef.Span.Main:IndirectIndexWith.55456748a8a2eb70.Core"(ptr %s, i32 0), !dbg !34 +// CHECK:STDOUT: store i32 %v, ptr %Span.as.IndirectIndexWith.impl.Ref.call, align 4, !dbg !34 +// CHECK:STDOUT: ret void, !dbg !36 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define i32 @_CLoad.Main(ptr %s) #0 !dbg !34 { +// CHECK:STDOUT: define i32 @_CLoad.Main(ptr %s) #0 !dbg !38 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %Span.as.IndirectIndexWith.impl.Ref.call = call ptr @"_CRef.Span.Main:IndirectIndexWith.55456748a8a2eb70.Core"(ptr %s, i32 0), !dbg !39 -// CHECK:STDOUT: %.loc28_47 = load i32, ptr %Span.as.IndirectIndexWith.impl.Ref.call, align 4, !dbg !39 -// CHECK:STDOUT: ret i32 %.loc28_47, !dbg !40 +// CHECK:STDOUT: %Span.as.IndirectIndexWith.impl.Ref.call = call ptr @"_CRef.Span.Main:IndirectIndexWith.55456748a8a2eb70.Core"(ptr %s, i32 0), !dbg !43 +// CHECK:STDOUT: %.loc28_47 = load i32, ptr %Span.as.IndirectIndexWith.impl.Ref.call, align 4, !dbg !43 +// CHECK:STDOUT: ret i32 %.loc28_47, !dbg !44 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define i32 @_CLoadViaAt.Main(ptr %s) #0 !dbg !42 { +// CHECK:STDOUT: define i32 @_CLoadViaAt.Main(ptr %s) #0 !dbg !46 { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %T.as_type.as.IndexWith.impl.At.call = call i32 @"_CAt.4b18d5ec6f2c7a47:IndexWith.eb057aa32837c84e.Core.7d2c1205e4a4eaa2"(ptr %s, i32 0), !dbg !47 -// CHECK:STDOUT: ret i32 %T.as_type.as.IndexWith.impl.At.call, !dbg !50 +// CHECK:STDOUT: %T.as_type.as.IndexWith.impl.At.call = call i32 @"_CAt.4b18d5ec6f2c7a47:IndexWith.eb057aa32837c84e.Core.7d2c1205e4a4eaa2"(ptr %s, i32 0), !dbg !51 +// CHECK:STDOUT: ret i32 %T.as_type.as.IndexWith.impl.At.call, !dbg !52 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nounwind -// CHECK:STDOUT: define linkonce_odr i32 @"_CAt.4b18d5ec6f2c7a47:IndexWith.eb057aa32837c84e.Core.7d2c1205e4a4eaa2"(ptr %self, i32 %subscript) #0 !dbg !53 { -// CHECK:STDOUT: %1 = call ptr @"_CRef.Span.Main:IndirectIndexWith.55456748a8a2eb70.Core"(ptr %self, i32 %subscript), !dbg !60 -// CHECK:STDOUT: %2 = load i32, ptr %1, align 4, !dbg !60 -// CHECK:STDOUT: ret i32 %2, !dbg !62 +// CHECK:STDOUT: define void @_CStoreSubscript.Main(ptr %s, i32 %i, i32 %v) #0 !dbg !54 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %Span.as.IndirectIndexWith.impl.Ref.call = call ptr @"_CRef.Span.Main:IndirectIndexWith.55456748a8a2eb70.Core"(ptr %s, i32 %i), !dbg !61 +// CHECK:STDOUT: store i32 %v, ptr %Span.as.IndirectIndexWith.impl.Ref.call, align 4, !dbg !61 +// CHECK:STDOUT: ret void, !dbg !64 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define i32 @_CLoadSubscript.Main(ptr %s, i32 %i) #0 !dbg !66 { +// CHECK:STDOUT: entry: +// CHECK:STDOUT: %Span.as.IndirectIndexWith.impl.Ref.call = call ptr @"_CRef.Span.Main:IndirectIndexWith.55456748a8a2eb70.Core"(ptr %s, i32 %i), !dbg !73 +// CHECK:STDOUT: %.loc40 = load i32, ptr %Span.as.IndirectIndexWith.impl.Ref.call, align 4, !dbg !73 +// CHECK:STDOUT: ret i32 %.loc40, !dbg !75 +// CHECK:STDOUT: } +// CHECK:STDOUT: +// CHECK:STDOUT: ; Function Attrs: nounwind +// CHECK:STDOUT: define linkonce_odr i32 @"_CAt.4b18d5ec6f2c7a47:IndexWith.eb057aa32837c84e.Core.7d2c1205e4a4eaa2"(ptr %self, i32 %subscript) #0 !dbg !78 { +// CHECK:STDOUT: %1 = call ptr @"_CRef.Span.Main:IndirectIndexWith.55456748a8a2eb70.Core"(ptr %self, i32 %subscript), !dbg !85 +// CHECK:STDOUT: %2 = load i32, ptr %1, align 4, !dbg !85 +// CHECK:STDOUT: ret i32 %2, !dbg !87 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: attributes #0 = { nounwind } @@ -91,35 +115,50 @@ fn LoadViaAt(s: Span) -> i32 { // CHECK:STDOUT: !11 = !DISubroutineType(types: !10) // CHECK:STDOUT: !12 = !{!6, !7} // CHECK:STDOUT: !13 = !DISubroutineType(types: !12) -// CHECK:STDOUT: !14 = distinct !DISubprogram(name: "Ref", linkageName: "_CRef.Span.Main:IndirectIndexWith.55456748a8a2eb70.Core", scope: null, file: !4, line: 18, type: !9, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !24) -// CHECK:STDOUT: !15 = !DILocalVariable(arg: 1, scope: !14, type: !7) -// CHECK:STDOUT: !16 = !DILocalVariable(arg: 2, scope: !14, type: !6) -// CHECK:STDOUT: !21 = !DILocation(line: 19, column: 13, scope: !14) -// CHECK:STDOUT: !23 = !DILocation(line: 19, column: 5, scope: !14) -// CHECK:STDOUT: !24 = !{!15, !16} -// CHECK:STDOUT: !25 = distinct !DISubprogram(name: "Store", linkageName: "_CStore.Main", scope: null, file: !4, line: 23, type: !11, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !33) -// CHECK:STDOUT: !26 = !DILocalVariable(arg: 1, scope: !25, type: !7) -// CHECK:STDOUT: !27 = !DILocalVariable(arg: 2, scope: !25, type: !6) -// CHECK:STDOUT: !30 = !DILocation(line: 24, column: 3, scope: !25) -// CHECK:STDOUT: !32 = !DILocation(line: 23, column: 1, scope: !25) -// CHECK:STDOUT: !33 = !{!26, !27} -// CHECK:STDOUT: !34 = distinct !DISubprogram(name: "Load", linkageName: "_CLoad.Main", scope: null, file: !4, line: 27, type: !13, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !41) -// CHECK:STDOUT: !35 = !DILocalVariable(arg: 1, scope: !34, type: !7) -// CHECK:STDOUT: !39 = !DILocation(line: 28, column: 10, scope: !34) -// CHECK:STDOUT: !40 = !DILocation(line: 28, column: 3, scope: !34) -// CHECK:STDOUT: !41 = !{!35} -// CHECK:STDOUT: !42 = distinct !DISubprogram(name: "LoadViaAt", linkageName: "_CLoadViaAt.Main", scope: null, file: !4, line: 31, type: !13, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !51) -// CHECK:STDOUT: !43 = !DILocalVariable(arg: 1, scope: !42, type: !7) -// CHECK:STDOUT: !47 = !DILocation(line: 32, column: 10, scope: !42) -// CHECK:STDOUT: !48 = !{!6, !7, !6} -// CHECK:STDOUT: !49 = !DISubroutineType(types: !48) -// CHECK:STDOUT: !50 = !DILocation(line: 32, column: 3, scope: !42) -// CHECK:STDOUT: !51 = !{!43} -// CHECK:STDOUT: !52 = !DIFile(filename: "{{.*}}/prelude/operators/index.carbon", directory: "") -// CHECK:STDOUT: !53 = distinct !DISubprogram(name: "At", linkageName: "_CAt.4b18d5ec6f2c7a47:IndexWith.eb057aa32837c84e.Core.7d2c1205e4a4eaa2", scope: null, file: !52, line: 25, type: !49, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !63) -// CHECK:STDOUT: !54 = !DILocalVariable(arg: 1, scope: !53, type: !7) -// CHECK:STDOUT: !55 = !DILocalVariable(arg: 2, scope: !53, type: !6) -// CHECK:STDOUT: !60 = !DILocation(line: 26, column: 12, scope: !53) -// CHECK:STDOUT: !62 = !DILocation(line: 26, column: 5, scope: !53) -// CHECK:STDOUT: !63 = !{!54, !55} +// CHECK:STDOUT: !14 = !{null, !7, !6, !6} +// CHECK:STDOUT: !15 = !DISubroutineType(types: !14) +// CHECK:STDOUT: !16 = !{!6, !7, !6} +// CHECK:STDOUT: !17 = !DISubroutineType(types: !16) +// CHECK:STDOUT: !18 = distinct !DISubprogram(name: "Ref", linkageName: "_CRef.Span.Main:IndirectIndexWith.55456748a8a2eb70.Core", scope: null, file: !4, line: 18, type: !9, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !28) +// CHECK:STDOUT: !19 = !DILocalVariable(arg: 1, scope: !18, type: !7) +// CHECK:STDOUT: !20 = !DILocalVariable(arg: 2, scope: !18, type: !6) +// CHECK:STDOUT: !25 = !DILocation(line: 19, column: 13, scope: !18) +// CHECK:STDOUT: !27 = !DILocation(line: 19, column: 5, scope: !18) +// CHECK:STDOUT: !28 = !{!19, !20} +// CHECK:STDOUT: !29 = distinct !DISubprogram(name: "Store", linkageName: "_CStore.Main", scope: null, file: !4, line: 23, type: !11, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !37) +// CHECK:STDOUT: !30 = !DILocalVariable(arg: 1, scope: !29, type: !7) +// CHECK:STDOUT: !31 = !DILocalVariable(arg: 2, scope: !29, type: !6) +// CHECK:STDOUT: !34 = !DILocation(line: 24, column: 3, scope: !29) +// CHECK:STDOUT: !36 = !DILocation(line: 23, column: 1, scope: !29) +// CHECK:STDOUT: !37 = !{!30, !31} +// CHECK:STDOUT: !38 = distinct !DISubprogram(name: "Load", linkageName: "_CLoad.Main", scope: null, file: !4, line: 27, type: !13, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !45) +// CHECK:STDOUT: !39 = !DILocalVariable(arg: 1, scope: !38, type: !7) +// CHECK:STDOUT: !43 = !DILocation(line: 28, column: 10, scope: !38) +// CHECK:STDOUT: !44 = !DILocation(line: 28, column: 3, scope: !38) +// CHECK:STDOUT: !45 = !{!39} +// CHECK:STDOUT: !46 = distinct !DISubprogram(name: "LoadViaAt", linkageName: "_CLoadViaAt.Main", scope: null, file: !4, line: 31, type: !13, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !53) +// CHECK:STDOUT: !47 = !DILocalVariable(arg: 1, scope: !46, type: !7) +// CHECK:STDOUT: !51 = !DILocation(line: 32, column: 10, scope: !46) +// CHECK:STDOUT: !52 = !DILocation(line: 32, column: 3, scope: !46) +// CHECK:STDOUT: !53 = !{!47} +// CHECK:STDOUT: !54 = distinct !DISubprogram(name: "StoreSubscript", linkageName: "_CStoreSubscript.Main", scope: null, file: !4, line: 35, type: !15, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !65) +// CHECK:STDOUT: !55 = !DILocalVariable(arg: 1, scope: !54, type: !7) +// CHECK:STDOUT: !56 = !DILocalVariable(arg: 2, scope: !54, type: !6) +// CHECK:STDOUT: !57 = !DILocalVariable(arg: 3, scope: !54, type: !6) +// CHECK:STDOUT: !61 = !DILocation(line: 36, column: 3, scope: !54) +// CHECK:STDOUT: !64 = !DILocation(line: 35, column: 1, scope: !54) +// CHECK:STDOUT: !65 = !{!55, !56, !57} +// CHECK:STDOUT: !66 = distinct !DISubprogram(name: "LoadSubscript", linkageName: "_CLoadSubscript.Main", scope: null, file: !4, line: 39, type: !17, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !76) +// CHECK:STDOUT: !67 = !DILocalVariable(arg: 1, scope: !66, type: !7) +// CHECK:STDOUT: !68 = !DILocalVariable(arg: 2, scope: !66, type: !6) +// CHECK:STDOUT: !73 = !DILocation(line: 40, column: 10, scope: !66) +// CHECK:STDOUT: !75 = !DILocation(line: 40, column: 3, scope: !66) +// CHECK:STDOUT: !76 = !{!67, !68} +// CHECK:STDOUT: !77 = !DIFile(filename: "{{.*}}/prelude/operators/index.carbon", directory: "") +// CHECK:STDOUT: !78 = distinct !DISubprogram(name: "At", linkageName: "_CAt.4b18d5ec6f2c7a47:IndexWith.eb057aa32837c84e.Core.7d2c1205e4a4eaa2", scope: null, file: !77, line: 25, type: !17, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !88) +// CHECK:STDOUT: !79 = !DILocalVariable(arg: 1, scope: !78, type: !7) +// CHECK:STDOUT: !80 = !DILocalVariable(arg: 2, scope: !78, type: !6) +// CHECK:STDOUT: !85 = !DILocation(line: 26, column: 12, scope: !78) +// CHECK:STDOUT: !87 = !DILocation(line: 26, column: 5, scope: !78) +// CHECK:STDOUT: !88 = !{!79, !80} // CHECK:STDOUT: