From 7553d864e12298f9638d6ad5b27f24a039c26ec4 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 11 Jan 2024 15:12:58 -0800 Subject: [PATCH] Very basic support for constant evaluation of expressions. (#3581) Form a side table with constant values for each instruction. Evaluation is only supported for a few very simple kinds of instruction for now. This is not observable outside of the SemIR output, because nothing depends on expressions having a constant value phase yet. --- toolchain/check/BUILD | 2 + toolchain/check/context.cpp | 38 ++-- toolchain/check/context.h | 3 + toolchain/check/eval.cpp | 204 ++++++++++++++++++ toolchain/check/eval.h | 24 +++ toolchain/check/handle_call_expr.cpp | 2 +- toolchain/check/handle_name.cpp | 4 +- .../testdata/array/array_in_place.carbon | 24 ++- .../testdata/array/assign_return_value.carbon | 24 ++- .../check/testdata/array/assign_var.carbon | 23 +- toolchain/check/testdata/array/base.carbon | 41 ++-- .../testdata/array/fail_bound_overflow.carbon | 9 +- .../array/fail_incomplete_element.carbon | 19 +- .../testdata/array/fail_invalid_type.carbon | 11 +- .../testdata/array/fail_out_of_bound.carbon | 19 +- .../testdata/array/fail_type_mismatch.carbon | 57 +++-- .../testdata/array/function_param.carbon | 24 ++- .../check/testdata/array/nine_elements.carbon | 37 ++-- toolchain/check/testdata/as/as_type.carbon | 4 +- toolchain/check/testdata/as/basic.carbon | 8 +- .../testdata/as/fail_no_conversion.carbon | 9 +- .../check/testdata/as/fail_not_type.carbon | 9 +- toolchain/check/testdata/as/identity.carbon | 32 +-- toolchain/check/testdata/as/tuple.carbon | 46 ++-- .../testdata/basics/builtin_insts.carbon | 1 + .../testdata/basics/builtin_types.carbon | 11 +- .../check/testdata/basics/fail_bad_run.carbon | 6 +- .../testdata/basics/fail_bad_run_2.carbon | 2 +- .../testdata/basics/fail_name_lookup.carbon | 2 +- .../basics/fail_non_type_as_type.carbon | 6 +- .../check/testdata/basics/multifile.carbon | 4 +- .../multifile_raw_and_textual_ir.carbon | 8 +- .../testdata/basics/multifile_raw_ir.carbon | 4 + .../testdata/basics/numeric_literals.carbon | 58 +++-- toolchain/check/testdata/basics/parens.carbon | 9 +- .../testdata/basics/raw_and_textual_ir.carbon | 77 ++++--- .../testdata/basics/raw_identifier.carbon | 6 +- toolchain/check/testdata/basics/raw_ir.carbon | 63 +++--- toolchain/check/testdata/basics/run.carbon | 2 +- .../check/testdata/basics/run_i32.carbon | 8 +- .../check/testdata/basics/textual_ir.carbon | 14 +- toolchain/check/testdata/class/base.carbon | 52 ++--- .../check/testdata/class/base_field.carbon | 54 ++--- .../class/base_function_unqualified.carbon | 30 +-- .../check/testdata/class/base_method.carbon | 37 ++-- .../testdata/class/base_method_shadow.carbon | 52 ++--- toolchain/check/testdata/class/basic.carbon | 25 +-- .../testdata/class/derived_to_base.carbon | 89 ++++---- .../check/testdata/class/fail_abstract.carbon | 52 ++--- .../testdata/class/fail_addr_not_self.carbon | 8 +- .../testdata/class/fail_addr_self.carbon | 14 +- .../testdata/class/fail_base_bad_type.carbon | 119 +++++----- .../class/fail_base_method_define.carbon | 28 +-- .../testdata/class/fail_base_misplaced.carbon | 2 +- .../testdata/class/fail_base_modifiers.carbon | 42 ++-- .../testdata/class/fail_base_no_extend.carbon | 18 +- .../testdata/class/fail_base_repeated.carbon | 32 +-- .../testdata/class/fail_base_unbound.carbon | 24 +-- .../class/fail_derived_to_base.carbon | 48 ++--- .../class/fail_field_modifiers.carbon | 22 +- .../testdata/class/fail_incomplete.carbon | 38 ++-- .../check/testdata/class/fail_init.carbon | 50 +++-- .../class/fail_init_as_inplace.carbon | 36 ++-- .../class/fail_memaccess_category.carbon | 28 +-- .../testdata/class/fail_member_of_let.carbon | 10 +- .../check/testdata/class/fail_method.carbon | 28 +-- .../class/fail_method_modifiers.carbon | 18 +- .../testdata/class/fail_modifiers.carbon | 14 +- .../class/fail_out_of_line_decl.carbon | 6 +- .../fail_redeclaration_introducer.carbon | 16 +- .../class/fail_redeclaration_scope.carbon | 16 +- .../testdata/class/fail_redefinition.carbon | 14 +- .../check/testdata/class/fail_reorder.carbon | 13 +- .../check/testdata/class/fail_scope.carbon | 11 +- .../check/testdata/class/fail_self.carbon | 24 +-- .../testdata/class/fail_todo_modifiers.carbon | 36 ++-- .../testdata/class/fail_unbound_field.carbon | 20 +- .../testdata/class/fail_unknown_member.carbon | 14 +- .../check/testdata/class/field_access.carbon | 28 +-- .../class/field_access_in_value.carbon | 30 +-- .../testdata/class/forward_declared.carbon | 4 +- toolchain/check/testdata/class/init.carbon | 28 +-- toolchain/check/testdata/class/init_as.carbon | 28 +-- .../check/testdata/class/init_nested.carbon | 52 ++--- toolchain/check/testdata/class/method.carbon | 38 ++-- toolchain/check/testdata/class/nested.carbon | 74 +++---- .../check/testdata/class/nested_name.carbon | 26 +-- .../check/testdata/class/raw_self.carbon | 26 +-- .../check/testdata/class/raw_self_type.carbon | 14 +- .../check/testdata/class/redeclaration.carbon | 8 +- .../class/redeclaration_introducer.carbon | 8 +- .../check/testdata/class/reenter_scope.carbon | 12 +- toolchain/check/testdata/class/scope.carbon | 26 +-- toolchain/check/testdata/class/self.carbon | 20 +- .../testdata/class/self_conversion.carbon | 41 ++-- .../check/testdata/class/self_type.carbon | 20 +- .../check/testdata/class/static_method.carbon | 16 +- .../check/testdata/const/collapse.carbon | 2 +- .../check/testdata/const/fail_collapse.carbon | 2 +- .../expr_category/in_place_tuple_init.carbon | 23 +- .../function/call/empty_struct.carbon | 13 +- .../testdata/function/call/empty_tuple.carbon | 11 +- .../function/call/fail_not_callable.carbon | 7 +- .../function/call/fail_param_count.carbon | 40 ++-- .../function/call/fail_param_type.carbon | 11 +- .../call/fail_return_type_mismatch.carbon | 12 +- .../check/testdata/function/call/i32.carbon | 12 +- .../function/call/more_param_ir.carbon | 21 +- .../testdata/function/call/params_one.carbon | 11 +- .../function/call/params_one_comma.carbon | 16 +- .../testdata/function/call/params_two.carbon | 14 +- .../function/call/params_two_comma.carbon | 22 +- .../testdata/function/call/params_zero.carbon | 8 +- .../function/call/return_implicit.carbon | 8 +- .../declaration/fail_modifiers.carbon | 12 +- .../declaration/fail_todo_modifiers.carbon | 2 +- .../function/declaration/simple.carbon | 8 +- .../fail_param_name_conflict.carbon | 2 +- .../testdata/function/definition/order.carbon | 6 +- .../function/definition/params_one.carbon | 2 +- .../definition/params_one_comma.carbon | 2 +- .../function/definition/params_two.carbon | 2 +- .../definition/params_two_comma.carbon | 2 +- .../function/definition/params_zero.carbon | 2 +- .../definition/same_param_name.carbon | 4 +- .../generic/fail_type_param_mismatch.carbon | 4 +- .../function/generic/type_param.carbon | 4 +- toolchain/check/testdata/if/else.carbon | 16 +- .../if/fail_reachable_fallthrough.carbon | 18 +- toolchain/check/testdata/if/fail_scope.carbon | 8 +- toolchain/check/testdata/if/no_else.carbon | 12 +- .../if/unreachable_fallthrough.carbon | 11 +- toolchain/check/testdata/if_expr/basic.carbon | 15 +- .../if_expr/constant_condition.carbon | 31 +-- .../testdata/if_expr/control_flow.carbon | 19 +- .../if_expr/fail_not_in_function.carbon | 12 +- .../check/testdata/if_expr/nested.carbon | 17 +- .../check/testdata/if_expr/struct.carbon | 18 +- .../index/array_element_access.carbon | 22 +- .../check/testdata/index/expr_category.carbon | 68 ++++-- .../index/fail_array_large_index.carbon | 16 +- .../index/fail_array_non_int_indexing.carbon | 16 +- .../fail_array_out_of_bound_access.carbon | 16 +- .../index/fail_empty_tuple_access.carbon | 11 +- .../testdata/index/fail_expr_category.carbon | 36 ++-- .../testdata/index/fail_invalid_base.carbon | 31 +-- .../testdata/index/fail_name_not_found.carbon | 8 +- .../index/fail_negative_indexing.carbon | 9 +- .../index/fail_non_deterministic_type.carbon | 15 +- .../index/fail_non_tuple_access.carbon | 11 +- .../index/fail_tuple_index_error.carbon | 12 +- .../index/fail_tuple_large_index.carbon | 10 +- .../index/fail_tuple_non_int_indexing.carbon | 15 +- .../fail_tuple_out_of_bound_access.carbon | 15 +- .../index/tuple_element_access.carbon | 10 +- .../index/tuple_return_value_access.carbon | 19 +- .../check/testdata/interface/basic.carbon | 2 +- .../testdata/interface/fail_duplicate.carbon | 6 +- .../interface/fail_todo_modifiers.carbon | 4 +- .../ir/duplicate_name_same_line.carbon | 17 +- toolchain/check/testdata/let/convert.carbon | 20 +- .../testdata/let/fail_duplicate_decl.carbon | 8 +- .../check/testdata/let/fail_generic.carbon | 8 +- .../check/testdata/let/fail_modifiers.carbon | 27 ++- .../testdata/let/fail_todo_modifiers.carbon | 6 +- .../testdata/let/fail_use_in_init.carbon | 2 +- toolchain/check/testdata/let/generic.carbon | 4 +- toolchain/check/testdata/let/global.carbon | 8 +- toolchain/check/testdata/let/local.carbon | 2 +- .../testdata/namespace/add_to_import.carbon | 10 +- .../testdata/namespace/fail_duplicate.carbon | 4 +- .../namespace/fail_unresolved_scope.carbon | 2 +- .../check/testdata/namespace/function.carbon | 10 +- .../check/testdata/namespace/imported.carbon | 18 +- .../namespace/imported_indirect.carbon | 8 +- .../check/testdata/namespace/nested.carbon | 8 +- .../check/testdata/namespace/shadow.carbon | 19 +- .../namespace/unqualified_lookup.carbon | 26 +-- toolchain/check/testdata/operators/and.carbon | 22 +- .../testdata/operators/assignment.carbon | 59 +++-- .../operators/fail_assignment_to_error.carbon | 11 +- .../fail_assignment_to_non_assignable.carbon | 82 ++++--- .../operators/fail_type_mismatch.carbon | 8 +- .../fail_type_mismatch_assignment.carbon | 11 +- .../operators/fail_type_mismatch_once.carbon | 5 + .../operators/fail_unimplemented_op.carbon | 5 + toolchain/check/testdata/operators/or.carbon | 22 +- .../check/testdata/operators/unary_op.carbon | 18 +- .../package_expr/fail_not_found.carbon | 2 +- .../check/testdata/package_expr/syntax.carbon | 36 ++-- .../fail_name_with_import_failure.carbon | 2 +- .../packages/fail_todo_lazy_import_ref.carbon | 8 +- .../testdata/packages/loaded_global.carbon | 20 +- .../packages/unused_lazy_import.carbon | 2 +- .../testdata/pointer/address_of_deref.carbon | 7 +- .../testdata/pointer/address_of_lvalue.carbon | 42 ++-- toolchain/check/testdata/pointer/basic.carbon | 10 +- .../pointer/fail_address_of_error.carbon | 6 +- .../pointer/fail_address_of_value.carbon | 108 ++++++---- .../pointer/fail_deref_function.carbon | 4 +- .../pointer/fail_deref_namespace.carbon | 2 +- .../pointer/fail_deref_not_pointer.carbon | 12 +- .../pointer/fail_type_mismatch.carbon | 4 +- .../testdata/pointer/nested_const.carbon | 2 +- toolchain/check/testdata/pointer/types.carbon | 4 +- .../testdata/return/code_after_return.carbon | 6 +- .../return/code_after_return_value.carbon | 12 +- .../testdata/return/fail_call_in_type.carbon | 10 +- .../testdata/return/fail_error_in_type.carbon | 2 +- .../testdata/return/fail_let_in_type.carbon | 8 +- .../return/fail_missing_return.carbon | 2 +- .../fail_missing_return_empty_tuple.carbon | 4 +- .../fail_return_var_no_returned_var.carbon | 2 +- .../fail_return_with_returned_var.carbon | 36 ++-- .../fail_returned_var_no_return_type.carbon | 4 +- .../return/fail_returned_var_shadow.carbon | 34 ++- .../return/fail_returned_var_type.carbon | 8 +- .../testdata/return/fail_type_mismatch.carbon | 8 +- .../return/fail_value_disallowed.carbon | 8 +- .../testdata/return/fail_value_missing.carbon | 2 +- .../testdata/return/fail_var_in_type.carbon | 8 +- .../missing_return_no_return_type.carbon | 2 +- .../check/testdata/return/no_value.carbon | 2 +- .../check/testdata/return/returned_var.carbon | 33 +-- .../testdata/return/returned_var_scope.carbon | 28 ++- toolchain/check/testdata/return/struct.carbon | 11 +- toolchain/check/testdata/return/tuple.carbon | 14 +- toolchain/check/testdata/return/value.carbon | 8 +- toolchain/check/testdata/struct/empty.carbon | 4 +- .../struct/fail_access_into_invalid.carbon | 2 +- .../testdata/struct/fail_assign_empty.carbon | 4 +- .../testdata/struct/fail_assign_nested.carbon | 10 +- .../struct/fail_assign_to_empty.carbon | 9 +- .../struct/fail_duplicate_name.carbon | 31 +-- .../struct/fail_field_name_mismatch.carbon | 9 +- .../struct/fail_field_type_mismatch.carbon | 7 +- .../struct/fail_member_access_type.carbon | 8 +- .../struct/fail_member_of_function.carbon | 4 +- .../struct/fail_nested_incomplete.carbon | 12 +- .../struct/fail_non_member_access.carbon | 8 +- .../struct/fail_too_few_values.carbon | 9 +- .../testdata/struct/fail_type_assign.carbon | 4 +- .../testdata/struct/fail_value_as_type.carbon | 5 +- .../struct/literal_member_access.carbon | 20 +- .../testdata/struct/member_access.carbon | 10 +- .../struct/nested_struct_in_place.carbon | 20 +- .../check/testdata/struct/one_entry.carbon | 10 +- .../testdata/struct/reorder_fields.carbon | 20 +- .../testdata/struct/tuple_as_element.carbon | 16 +- .../check/testdata/struct/two_entries.carbon | 12 +- toolchain/check/testdata/tuples/empty.carbon | 2 +- .../testdata/tuples/fail_assign_empty.carbon | 6 +- .../testdata/tuples/fail_assign_nested.carbon | 36 ++-- .../tuples/fail_assign_to_empty.carbon | 7 +- .../tuples/fail_element_type_mismatch.carbon | 14 +- .../tuples/fail_nested_incomplete.carbon | 17 +- .../tuples/fail_too_few_element.carbon | 11 +- .../testdata/tuples/fail_type_assign.carbon | 4 +- .../testdata/tuples/fail_value_as_type.carbon | 7 +- .../check/testdata/tuples/nested_tuple.carbon | 23 +- .../tuples/nested_tuple_in_place.carbon | 40 ++-- .../check/testdata/tuples/one_element.carbon | 7 +- .../check/testdata/tuples/two_elements.carbon | 12 +- toolchain/check/testdata/var/decl.carbon | 2 +- .../check/testdata/var/decl_with_init.carbon | 8 +- .../testdata/var/fail_duplicate_decl.carbon | 11 +- .../check/testdata/var/fail_generic.carbon | 8 +- .../var/fail_init_type_mismatch.carbon | 8 +- .../testdata/var/fail_init_with_self.carbon | 2 +- .../var/fail_lookup_outside_scope.carbon | 2 +- .../testdata/var/fail_not_copyable.carbon | 17 +- .../var/fail_storage_is_literal.carbon | 11 +- .../testdata/var/global_decl_with_init.carbon | 6 +- .../check/testdata/var/global_lookup.carbon | 6 +- .../var/global_lookup_in_scope.carbon | 8 +- toolchain/check/testdata/var/lookup.carbon | 8 +- toolchain/check/testdata/var/shadowing.carbon | 17 +- .../testdata/while/break_continue.carbon | 34 +-- .../testdata/while/fail_bad_condition.carbon | 7 +- .../testdata/while/fail_break_continue.carbon | 6 +- .../testdata/while/unreachable_end.carbon | 20 +- toolchain/check/testdata/while/while.carbon | 20 +- toolchain/sem_ir/file.cpp | 1 + toolchain/sem_ir/file.h | 7 + toolchain/sem_ir/formatter.cpp | 8 + toolchain/sem_ir/value_stores.h | 45 ++++ toolchain/sem_ir/yaml_test.cpp | 2 + 287 files changed, 3022 insertions(+), 2042 deletions(-) create mode 100644 toolchain/check/eval.cpp create mode 100644 toolchain/check/eval.h diff --git a/toolchain/check/BUILD b/toolchain/check/BUILD index e690a3a909df..c136e7e10984 100644 --- a/toolchain/check/BUILD +++ b/toolchain/check/BUILD @@ -34,6 +34,7 @@ cc_library( "context.cpp", "convert.cpp", "decl_name_stack.cpp", + "eval.cpp", "inst_block_stack.cpp", "modifiers.cpp", "return.cpp", @@ -43,6 +44,7 @@ cc_library( "convert.h", "decl_name_stack.h", "decl_state.h", + "eval.h", "inst_block_stack.h", "lexical_lookup.h", "modifiers.h", diff --git a/toolchain/check/context.cpp b/toolchain/check/context.cpp index 31673b34c2d3..d9d84880f10d 100644 --- a/toolchain/check/context.cpp +++ b/toolchain/check/context.cpp @@ -11,6 +11,7 @@ #include "common/vlog.h" #include "llvm/ADT/Sequence.h" #include "toolchain/check/decl_name_stack.h" +#include "toolchain/check/eval.h" #include "toolchain/check/inst_block_stack.h" #include "toolchain/lex/tokenized_buffer.h" #include "toolchain/parse/node_kind.h" @@ -63,12 +64,22 @@ auto Context::VerifyOnFinish() -> void { auto Context::AddInst(SemIR::Inst inst) -> SemIR::InstId { auto inst_id = inst_block_stack_.AddInst(inst); CARBON_VLOG() << "AddInst: " << inst << "\n"; + + auto const_id = TryEvalInst(*this, inst_id, inst); + if (const_id.is_valid()) { + CARBON_VLOG() << "Constant: " << inst << " -> " << insts().Get(const_id) + << "\n"; + constant_values().Set(inst_id, const_id); + } + return inst_id; } auto Context::AddConstantInst(SemIR::Inst inst) -> SemIR::InstId { + // TODO: Deduplicate constants. auto inst_id = insts().AddInNoBlock(inst); constants().Add(inst_id); + constant_values().Set(inst_id, inst_id); CARBON_VLOG() << "AddConstantInst: " << inst << "\n"; return inst_id; } @@ -192,6 +203,7 @@ auto Context::ResolveIfLazyImportRef(SemIR::InstId inst_id) -> void { Parse::NodeId::Invalid, GetBuiltinType(SemIR::BuiltinKind::FunctionType), function_id}); + constant_values().Set(inst_id, inst_id); break; } @@ -436,32 +448,6 @@ auto Context::FollowNameRefs(SemIR::InstId inst_id) -> SemIR::InstId { return inst_id; } -auto Context::GetConstantValue(SemIR::InstId inst_id) -> SemIR::InstId { - // TODO: The constant value of an instruction should be computed as we build - // the instruction, or at least cached once computed. - while (true) { - auto inst = insts().Get(inst_id); - switch (inst.kind()) { - case SemIR::NameRef::Kind: - inst_id = inst.As().value_id; - break; - - case SemIR::BindName::Kind: - inst_id = inst.As().value_id; - break; - - case SemIR::BaseDecl::Kind: - case SemIR::FieldDecl::Kind: - case SemIR::FunctionDecl::Kind: - return inst_id; - - default: - // TODO: Handle the remaining cases. - return SemIR::InstId::Invalid; - } - } -} - template static auto AddDominatedBlockAndBranchImpl(Context& context, Parse::NodeId parse_node, diff --git a/toolchain/check/context.h b/toolchain/check/context.h index 0573522fb8d8..9ed64d18902b 100644 --- a/toolchain/check/context.h +++ b/toolchain/check/context.h @@ -378,6 +378,9 @@ class Context { return sem_ir().type_blocks(); } auto insts() -> SemIR::InstStore& { return sem_ir().insts(); } + auto constant_values() -> SemIR::ConstantValueStore& { + return sem_ir().constant_values(); + } auto inst_blocks() -> SemIR::InstBlockStore& { return sem_ir().inst_blocks(); } diff --git a/toolchain/check/eval.cpp b/toolchain/check/eval.cpp new file mode 100644 index 000000000000..1e9bcfc1a149 --- /dev/null +++ b/toolchain/check/eval.cpp @@ -0,0 +1,204 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#include "toolchain/check/eval.h" + +#include "toolchain/sem_ir/typed_insts.h" + +namespace Carbon::Check { + +// `GetConstantValue` checks to see whether the provided ID describes a value +// with constant phase, and if so, returns the corresponding constant value. +// Overloads are provided for different kinds of ID. + +// If the given instruction is constant, returns its constant value. +static auto GetConstantValue(Context& context, SemIR::InstId inst_id) + -> SemIR::InstId { + return context.constant_values().Get(inst_id); +} + +// If the given instruction block contains only constants, returns a +// corresponding block of those values. +static auto GetConstantValue(Context& context, SemIR::InstBlockId inst_block_id) + -> SemIR::InstBlockId { + auto insts = context.inst_blocks().Get(inst_block_id); + llvm::SmallVector const_insts; + for (auto inst_id : insts) { + auto const_inst_id = GetConstantValue(context, inst_id); + if (!const_inst_id.is_valid()) { + return SemIR::InstBlockId::Invalid; + } + + // Once we leave the small buffer, we know the first few elements are all + // constant, so it's likely that the entire block is constant. Resize to the + // target size given that we're going to allocate memory now anyway. + if (const_insts.size() == const_insts.capacity()) { + const_insts.reserve(insts.size()); + } + + const_insts.push_back(const_inst_id); + } + // TODO: If the new block is identical to the original block, return the + // original ID. + return context.inst_blocks().Add(const_insts); +} + +// Replaces the specified field of the given typed instruction with its constant +// value, if it has constant phase. Returns true on success, false if the value +// has runtime phase. +template +static auto ReplaceFieldWithConstantValue(Context& context, InstT* inst, + FieldIdT InstT::*field) -> bool { + auto unwrapped = GetConstantValue(context, inst->*field); + if (!unwrapped.is_valid()) { + return false; + } + inst->*field = unwrapped; + return true; +} + +// If the specified fields of the given typed instruction have constant values, +// replaces the fields with their constant values and builds a corresponding +// constant value. Otherwise returns `SemIR::InstId::Invalid`. +template +static auto RebuildIfFieldsAreConstant(Context& context, SemIR::Inst inst, + EachFieldIdT InstT::*... each_field_id) + -> SemIR::InstId { + // Build a constant instruction by replacing each non-constant operand with + // its constant value. + auto typed_inst = inst.As(); + if ((ReplaceFieldWithConstantValue(context, &typed_inst, each_field_id) && + ...)) { + return context.AddConstantInst(typed_inst); + } + return SemIR::InstId::Invalid; +} + +auto TryEvalInst(Context& context, SemIR::InstId inst_id, SemIR::Inst inst) + -> SemIR::InstId { + // clang warns on unhandled enum values; clang-tidy is incorrect here. + // NOLINTNEXTLINE(bugprone-switch-missing-default-case) + switch (inst.kind()) { + // These cases are constants if their operands are. + case SemIR::AddrOf::Kind: + return RebuildIfFieldsAreConstant(context, inst, + &SemIR::AddrOf::lvalue_id); + case SemIR::ArrayIndex::Kind: + return RebuildIfFieldsAreConstant(context, inst, + &SemIR::ArrayIndex::array_id, + &SemIR::ArrayIndex::index_id); + case SemIR::ArrayType::Kind: + return RebuildIfFieldsAreConstant(context, inst, + &SemIR::ArrayType::bound_id); + case SemIR::BoundMethod::Kind: + return RebuildIfFieldsAreConstant(context, inst, + &SemIR::BoundMethod::object_id, + &SemIR::BoundMethod::function_id); + case SemIR::StructValue::Kind: + return RebuildIfFieldsAreConstant(context, inst, + &SemIR::StructValue::elements_id); + case SemIR::Temporary::Kind: + return RebuildIfFieldsAreConstant(context, inst, + &SemIR::Temporary::init_id); + case SemIR::TupleValue::Kind: + return RebuildIfFieldsAreConstant(context, inst, + &SemIR::TupleValue::elements_id); + + // These cases are constants already. + case SemIR::Builtin::Kind: + case SemIR::ClassType::Kind: + case SemIR::ConstType::Kind: + case SemIR::PointerType::Kind: + case SemIR::StructType::Kind: + case SemIR::TupleType::Kind: + case SemIR::UnboundElementType::Kind: + return inst_id; + + case SemIR::BaseDecl::Kind: + case SemIR::FieldDecl::Kind: + case SemIR::FunctionDecl::Kind: + // TODO: Consider adding a corresponding `Value` inst. + return inst_id; + + case SemIR::BoolLiteral::Kind: + case SemIR::IntLiteral::Kind: + case SemIR::RealLiteral::Kind: + case SemIR::StringLiteral::Kind: + // Promote literals to the constant block. + return context.AddConstantInst(inst); + + // TODO: These need special handling. + case SemIR::StructInit::Kind: + case SemIR::ArrayInit::Kind: + case SemIR::BindValue::Kind: + case SemIR::Call::Kind: + case SemIR::ClassElementAccess::Kind: + case SemIR::ClassInit::Kind: + case SemIR::Converted::Kind: + case SemIR::CrossRef::Kind: + case SemIR::Deref::Kind: + case SemIR::InitializeFrom::Kind: + case SemIR::SpliceBlock::Kind: + case SemIR::StructAccess::Kind: + case SemIR::TemporaryStorage::Kind: + case SemIR::TupleAccess::Kind: + case SemIR::TupleIndex::Kind: + case SemIR::TupleInit::Kind: + case SemIR::ValueAsRef::Kind: + case SemIR::ValueOfInitializer::Kind: + break; + + case SemIR::BindName::Kind: + case SemIR::BindSymbolicName::Kind: { + // TODO: Should we really be looking through runtime and symbolic `let` + // bindings? + return GetConstantValue(context, inst.As().value_id); + } + + case SemIR::NameRef::Kind: { + return GetConstantValue(context, inst.As().value_id); + } + + case SemIR::UnaryOperatorNot::Kind: { + auto const_id = GetConstantValue( + context, inst.As().operand_id); + if (!const_id.is_valid()) { + break; + } + auto value = context.insts().TryGetAs(const_id); + if (!value) { + // TODO: Can we CHECK this instead? + break; + } + value->value = + (value->value == SemIR::BoolValue::False ? SemIR::BoolValue::True + : SemIR::BoolValue::False); + return context.AddConstantInst(*value); + } + + // These cases are either not expressions or not constant. + case SemIR::AddrPattern::Kind: + case SemIR::Assign::Kind: + case SemIR::BlockArg::Kind: + case SemIR::Branch::Kind: + case SemIR::BranchIf::Kind: + case SemIR::BranchWithArg::Kind: + case SemIR::ClassDecl::Kind: + case SemIR::Import::Kind: + case SemIR::InterfaceDecl::Kind: + case SemIR::LazyImportRef::Kind: + case SemIR::Namespace::Kind: + case SemIR::Param::Kind: + case SemIR::ReturnExpr::Kind: + case SemIR::Return::Kind: + case SemIR::StructLiteral::Kind: + case SemIR::StructTypeField::Kind: + case SemIR::TupleLiteral::Kind: + case SemIR::VarStorage::Kind: + break; + } + return SemIR::InstId::Invalid; +} + +} // namespace Carbon::Check diff --git a/toolchain/check/eval.h b/toolchain/check/eval.h new file mode 100644 index 000000000000..174b8ff4636d --- /dev/null +++ b/toolchain/check/eval.h @@ -0,0 +1,24 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#ifndef CARBON_TOOLCHAIN_CHECK_EVAL_H_ +#define CARBON_TOOLCHAIN_CHECK_EVAL_H_ + +#include "toolchain/check/context.h" +#include "toolchain/sem_ir/ids.h" +#include "toolchain/sem_ir/inst.h" + +namespace Carbon::Check { + +// Determines the phase of the instruction `inst`, and returns its constant +// value if it has constant phase. If it has runtime phase, returns +// `SemIR::InstId::Invalid`. +// +// TODO: Support symbolic phase. +auto TryEvalInst(Context& context, SemIR::InstId inst_id, SemIR::Inst inst) + -> SemIR::InstId; + +} // namespace Carbon::Check + +#endif // CARBON_TOOLCHAIN_CHECK_EVAL_H_ diff --git a/toolchain/check/handle_call_expr.cpp b/toolchain/check/handle_call_expr.cpp index 81a512773e7d..4e6dee786ac3 100644 --- a/toolchain/check/handle_call_expr.cpp +++ b/toolchain/check/handle_call_expr.cpp @@ -56,7 +56,7 @@ auto HandleCallExpr(Context& context, Parse::CallExprId parse_node) -> bool { } // Identify the function we're calling. - auto function_decl_id = context.GetConstantValue(function_callee_id); + auto function_decl_id = context.constant_values().Get(function_callee_id); if (!function_decl_id.is_valid()) { return diagnose_not_callable(); } diff --git a/toolchain/check/handle_name.cpp b/toolchain/check/handle_name.cpp index a37bdd238ce3..b055a690a513 100644 --- a/toolchain/check/handle_name.cpp +++ b/toolchain/check/handle_name.cpp @@ -154,7 +154,7 @@ auto HandleMemberAccessExpr(Context& context, // Find the specified element, which could be either a field or a base // class, and build an element access expression. - auto element_id = context.GetConstantValue(member_id); + auto element_id = context.constant_values().Get(member_id); CARBON_CHECK(element_id.is_valid()) << "Non-constant value " << context.insts().Get(member_id) << " of unbound element type"; @@ -178,7 +178,7 @@ auto HandleMemberAccessExpr(Context& context, if (member_type_id == context.GetBuiltinType(SemIR::BuiltinKind::FunctionType)) { // Find the named function and check whether it's an instance method. - auto function_name_id = context.GetConstantValue(member_id); + auto function_name_id = context.constant_values().Get(member_id); CARBON_CHECK(function_name_id.is_valid()) << "Non-constant value " << context.insts().Get(member_id) << " of function type"; diff --git a/toolchain/check/testdata/array/array_in_place.carbon b/toolchain/check/testdata/array/array_in_place.carbon index c3a44b10b911..1286109755ec 100644 --- a/toolchain/check/testdata/array/array_in_place.carbon +++ b/toolchain/check/testdata/array/array_in_place.carbon @@ -13,17 +13,19 @@ fn G() { // CHECK:STDOUT: --- array_in_place.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_25.1: type = tuple_type (type, type, type) -// CHECK:STDOUT: %.loc7_25.2: type = tuple_type (i32, i32, i32) -// CHECK:STDOUT: %.loc7_25.3: type = ptr_type (i32, i32, i32) -// CHECK:STDOUT: %.loc10_29: type = ptr_type [(i32, i32, i32); 2] -// CHECK:STDOUT: %.loc10_42: type = tuple_type ((i32, i32, i32), (i32, i32, i32)) +// CHECK:STDOUT: %.loc7_25.1: type = tuple_type (type, type, type), const +// CHECK:STDOUT: %.loc7_25.2: type = tuple_type (i32, i32, i32), const +// CHECK:STDOUT: %.loc7_25.3: type = ptr_type (i32, i32, i32), const +// CHECK:STDOUT: %.loc10_28: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc10_29.1: type = array_type %.loc10_28, (i32, i32, i32), const +// CHECK:STDOUT: %.loc10_29.2: type = ptr_type [(i32, i32, i32); 2], const +// CHECK:STDOUT: %.loc10_42: type = tuple_type ((i32, i32, i32), (i32, i32, i32)), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F, .G = %G} -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %return: (i32, i32, i32); @@ -31,18 +33,18 @@ fn G() { // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc10_25: (type, type, type) = tuple_literal (i32, i32, i32) -// CHECK:STDOUT: %.loc10_28: i32 = int_literal 2 +// CHECK:STDOUT: %.loc10_28: i32 = int_literal 2, const = constants.%.loc10_28 // CHECK:STDOUT: %.loc7: type = converted %.loc10_25, constants.%.loc7_25.2 -// CHECK:STDOUT: %.loc10_29: type = array_type %.loc10_28, (i32, i32, i32) +// CHECK:STDOUT: %.loc10_29: type = array_type %.loc10_28, (i32, i32, i32), const = constants.%.loc10_29.1 // CHECK:STDOUT: %v.var: ref [(i32, i32, i32); 2] = var v // CHECK:STDOUT: %v: ref [(i32, i32, i32); 2] = bind_name v, %v.var -// CHECK:STDOUT: %F.ref.loc10_34: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref.loc10_34: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc10_42.3: ref (i32, i32, i32) = splice_block %.loc10_42.2 { // CHECK:STDOUT: %.loc10_42.1: i32 = int_literal 0 // CHECK:STDOUT: %.loc10_42.2: ref (i32, i32, i32) = array_index %v.var, %.loc10_42.1 // CHECK:STDOUT: } // CHECK:STDOUT: %.loc10_35: init (i32, i32, i32) = call %F.ref.loc10_34() to %.loc10_42.3 -// CHECK:STDOUT: %F.ref.loc10_39: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref.loc10_39: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc10_42.6: ref (i32, i32, i32) = splice_block %.loc10_42.5 { // CHECK:STDOUT: %.loc10_42.4: i32 = int_literal 1 // CHECK:STDOUT: %.loc10_42.5: ref (i32, i32, i32) = array_index %v.var, %.loc10_42.4 diff --git a/toolchain/check/testdata/array/assign_return_value.carbon b/toolchain/check/testdata/array/assign_return_value.carbon index 7d9eb4db9dde..efb7190245e7 100644 --- a/toolchain/check/testdata/array/assign_return_value.carbon +++ b/toolchain/check/testdata/array/assign_return_value.carbon @@ -13,33 +13,37 @@ fn Run() { // CHECK:STDOUT: --- assign_return_value.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_16.1: type = tuple_type (type) -// CHECK:STDOUT: %.loc7_16.2: type = tuple_type (i32) -// CHECK:STDOUT: %.loc10: type = ptr_type [i32; 1] +// CHECK:STDOUT: %.loc7_16.1: type = tuple_type (type), const +// CHECK:STDOUT: %.loc7_16.2: type = tuple_type (i32), const +// CHECK:STDOUT: %.loc7_28: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc7_30: (i32,) = tuple_value (%.loc7_28), const +// CHECK:STDOUT: %.loc10_16: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc10_17.1: type = array_type %.loc10_16, i32, const +// CHECK:STDOUT: %.loc10_17.2: type = ptr_type [i32; 1], const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F, .Run = %Run} -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %Run: = fn_decl @Run +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %Run: = fn_decl @Run, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> (i32,) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_28: i32 = int_literal 0 +// CHECK:STDOUT: %.loc7_28: i32 = int_literal 0, const = constants.%.loc7_28 // CHECK:STDOUT: %.loc7_30.1: (i32,) = tuple_literal (%.loc7_28) -// CHECK:STDOUT: %.loc7_30.2: (i32,) = tuple_value (%.loc7_28) +// CHECK:STDOUT: %.loc7_30.2: (i32,) = tuple_value (%.loc7_28), const = constants.%.loc7_30 // CHECK:STDOUT: %.loc7_30.3: (i32,) = converted %.loc7_30.1, %.loc7_30.2 // CHECK:STDOUT: return %.loc7_30.3 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_16: i32 = int_literal 1 -// CHECK:STDOUT: %.loc10_17: type = array_type %.loc10_16, i32 +// CHECK:STDOUT: %.loc10_16: i32 = int_literal 1, const = constants.%.loc10_16 +// CHECK:STDOUT: %.loc10_17: type = array_type %.loc10_16, i32, const = constants.%.loc10_17.1 // CHECK:STDOUT: %t.var: ref [i32; 1] = var t // CHECK:STDOUT: %t: ref [i32; 1] = bind_name t, %t.var -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc10_22.1: init (i32,) = call %F.ref() // CHECK:STDOUT: %.loc10_22.2: ref (i32,) = temporary_storage // CHECK:STDOUT: %.loc10_22.3: ref (i32,) = temporary %.loc10_22.2, %.loc10_22.1 diff --git a/toolchain/check/testdata/array/assign_var.carbon b/toolchain/check/testdata/array/assign_var.carbon index 76a747dd2225..500cbf8d7ead 100644 --- a/toolchain/check/testdata/array/assign_var.carbon +++ b/toolchain/check/testdata/array/assign_var.carbon @@ -10,10 +10,15 @@ var b: [i32; 3] = a; // CHECK:STDOUT: --- assign_var.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_22.1: type = tuple_type (type, type, type) -// CHECK:STDOUT: %.loc7_22.2: type = tuple_type (i32, i32, i32) -// CHECK:STDOUT: %.loc7_22.3: type = ptr_type (i32, i32, i32) -// CHECK:STDOUT: %.loc8: type = ptr_type [i32; 3] +// CHECK:STDOUT: %.loc7_22.1: type = tuple_type (type, type, type), const +// CHECK:STDOUT: %.loc7_22.2: type = tuple_type (i32, i32, i32), const +// CHECK:STDOUT: %.loc7_22.3: type = ptr_type (i32, i32, i32), const +// CHECK:STDOUT: %.loc7_27: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc7_30: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc7_33: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc8_14: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc8_15.1: type = array_type %.loc8_14, i32, const +// CHECK:STDOUT: %.loc8_15.2: type = ptr_type [i32; 3], const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -22,9 +27,9 @@ var b: [i32; 3] = a; // CHECK:STDOUT: %.loc7_22.2: type = converted %.loc7_22.1, constants.%.loc7_22.2 // CHECK:STDOUT: %a.var: ref (i32, i32, i32) = var a // CHECK:STDOUT: %a: ref (i32, i32, i32) = bind_name a, %a.var -// CHECK:STDOUT: %.loc7_27: i32 = int_literal 1 -// CHECK:STDOUT: %.loc7_30: i32 = int_literal 2 -// CHECK:STDOUT: %.loc7_33: i32 = int_literal 3 +// CHECK:STDOUT: %.loc7_27: i32 = int_literal 1, const = constants.%.loc7_27 +// CHECK:STDOUT: %.loc7_30: i32 = int_literal 2, const = constants.%.loc7_30 +// CHECK:STDOUT: %.loc7_33: i32 = int_literal 3, const = constants.%.loc7_33 // CHECK:STDOUT: %.loc7_34.1: (i32, i32, i32) = tuple_literal (%.loc7_27, %.loc7_30, %.loc7_33) // CHECK:STDOUT: %.loc7_34.2: ref i32 = tuple_access %a.var, element0 // CHECK:STDOUT: %.loc7_34.3: init i32 = initialize_from %.loc7_27 to %.loc7_34.2 @@ -35,8 +40,8 @@ var b: [i32; 3] = a; // CHECK:STDOUT: %.loc7_34.8: init (i32, i32, i32) = tuple_init (%.loc7_34.3, %.loc7_34.5, %.loc7_34.7) to %a.var // CHECK:STDOUT: %.loc7_34.9: init (i32, i32, i32) = converted %.loc7_34.1, %.loc7_34.8 // CHECK:STDOUT: assign %a.var, %.loc7_34.9 -// CHECK:STDOUT: %.loc8_14: i32 = int_literal 3 -// CHECK:STDOUT: %.loc8_15: type = array_type %.loc8_14, i32 +// CHECK:STDOUT: %.loc8_14: i32 = int_literal 3, const = constants.%.loc8_14 +// CHECK:STDOUT: %.loc8_15: type = array_type %.loc8_14, i32, const = constants.%.loc8_15.1 // CHECK:STDOUT: %b.var: ref [i32; 3] = var b // CHECK:STDOUT: %b: ref [i32; 3] = bind_name b, %b.var // CHECK:STDOUT: %a.ref: ref (i32, i32, i32) = name_ref a, %a diff --git a/toolchain/check/testdata/array/base.carbon b/toolchain/check/testdata/array/base.carbon index adc17d505555..a13aeb2f9a71 100644 --- a/toolchain/check/testdata/array/base.carbon +++ b/toolchain/check/testdata/array/base.carbon @@ -11,22 +11,31 @@ var c: [(); 5] = ((), (), (), (), (),); // CHECK:STDOUT: --- base.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_15: type = ptr_type [i32; 1] -// CHECK:STDOUT: %.loc7_22: type = tuple_type (i32) -// CHECK:STDOUT: %.loc8_15: type = ptr_type [f64; 2] -// CHECK:STDOUT: %.loc8_30: type = tuple_type (f64, f64) -// CHECK:STDOUT: %.loc9_10: type = tuple_type () -// CHECK:STDOUT: %.loc9_14: type = ptr_type [(); 5] -// CHECK:STDOUT: %.loc9_38: type = tuple_type ((), (), (), (), ()) +// CHECK:STDOUT: %.loc7_14: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc7_15.1: type = array_type %.loc7_14, i32, const +// CHECK:STDOUT: %.loc7_15.2: type = ptr_type [i32; 1], const +// CHECK:STDOUT: %.loc7_20: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc7_22: type = tuple_type (i32), const +// CHECK:STDOUT: %.loc8_14: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc8_15.1: type = array_type %.loc8_14, f64, const +// CHECK:STDOUT: %.loc8_15.2: type = ptr_type [f64; 2], const +// CHECK:STDOUT: %.loc8_20: f64 = real_literal 111e-1, const +// CHECK:STDOUT: %.loc8_26: f64 = real_literal 22e-1, const +// CHECK:STDOUT: %.loc8_30: type = tuple_type (f64, f64), const +// CHECK:STDOUT: %.loc9_10: type = tuple_type (), const +// CHECK:STDOUT: %.loc9_13: i32 = int_literal 5, const +// CHECK:STDOUT: %.loc9_14.1: type = array_type %.loc9_13, (), const +// CHECK:STDOUT: %.loc9_14.2: type = ptr_type [(); 5], const +// CHECK:STDOUT: %.loc9_38: type = tuple_type ((), (), (), (), ()), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.a = %a, .b = %b, .c = %c} -// CHECK:STDOUT: %.loc7_14: i32 = int_literal 1 -// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 +// CHECK:STDOUT: %.loc7_14: i32 = int_literal 1, const = constants.%.loc7_14 +// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32, const = constants.%.loc7_15.1 // CHECK:STDOUT: %a.var: ref [i32; 1] = var a // CHECK:STDOUT: %a: ref [i32; 1] = bind_name a, %a.var -// CHECK:STDOUT: %.loc7_20: i32 = int_literal 1 +// CHECK:STDOUT: %.loc7_20: i32 = int_literal 1, const = constants.%.loc7_20 // CHECK:STDOUT: %.loc7_22.1: (i32,) = tuple_literal (%.loc7_20) // CHECK:STDOUT: %.loc7_22.2: i32 = int_literal 0 // CHECK:STDOUT: %.loc7_22.3: ref i32 = array_index %a.var, %.loc7_22.2 @@ -34,12 +43,12 @@ var c: [(); 5] = ((), (), (), (), (),); // CHECK:STDOUT: %.loc7_22.5: init [i32; 1] = array_init (%.loc7_22.4) to %a.var // CHECK:STDOUT: %.loc7_22.6: init [i32; 1] = converted %.loc7_22.1, %.loc7_22.5 // CHECK:STDOUT: assign %a.var, %.loc7_22.6 -// CHECK:STDOUT: %.loc8_14: i32 = int_literal 2 -// CHECK:STDOUT: %.loc8_15: type = array_type %.loc8_14, f64 +// CHECK:STDOUT: %.loc8_14: i32 = int_literal 2, const = constants.%.loc8_14 +// CHECK:STDOUT: %.loc8_15: type = array_type %.loc8_14, f64, const = constants.%.loc8_15.1 // CHECK:STDOUT: %b.var: ref [f64; 2] = var b // CHECK:STDOUT: %b: ref [f64; 2] = bind_name b, %b.var -// CHECK:STDOUT: %.loc8_20: f64 = real_literal 111e-1 -// CHECK:STDOUT: %.loc8_26: f64 = real_literal 22e-1 +// CHECK:STDOUT: %.loc8_20: f64 = real_literal 111e-1, const = constants.%.loc8_20 +// CHECK:STDOUT: %.loc8_26: f64 = real_literal 22e-1, const = constants.%.loc8_26 // CHECK:STDOUT: %.loc8_30.1: (f64, f64) = tuple_literal (%.loc8_20, %.loc8_26) // CHECK:STDOUT: %.loc8_30.2: i32 = int_literal 0 // CHECK:STDOUT: %.loc8_30.3: ref f64 = array_index %b.var, %.loc8_30.2 @@ -51,9 +60,9 @@ var c: [(); 5] = ((), (), (), (), (),); // CHECK:STDOUT: %.loc8_30.9: init [f64; 2] = converted %.loc8_30.1, %.loc8_30.8 // CHECK:STDOUT: assign %b.var, %.loc8_30.9 // CHECK:STDOUT: %.loc9_10.1: () = tuple_literal () -// CHECK:STDOUT: %.loc9_13: i32 = int_literal 5 +// CHECK:STDOUT: %.loc9_13: i32 = int_literal 5, const = constants.%.loc9_13 // CHECK:STDOUT: %.loc9_10.2: type = converted %.loc9_10.1, constants.%.loc9_10 -// CHECK:STDOUT: %.loc9_14: type = array_type %.loc9_13, () +// CHECK:STDOUT: %.loc9_14: type = array_type %.loc9_13, (), const = constants.%.loc9_14.1 // CHECK:STDOUT: %c.var: ref [(); 5] = var c // CHECK:STDOUT: %c: ref [(); 5] = bind_name c, %c.var // CHECK:STDOUT: %.loc9_20.1: () = tuple_literal () diff --git a/toolchain/check/testdata/array/fail_bound_overflow.carbon b/toolchain/check/testdata/array/fail_bound_overflow.carbon index 98adcbe50cb1..3b2afc23c7c6 100644 --- a/toolchain/check/testdata/array/fail_bound_overflow.carbon +++ b/toolchain/check/testdata/array/fail_bound_overflow.carbon @@ -11,10 +11,15 @@ var a: [1; 39999999999999999993]; // CHECK:STDOUT: --- fail_bound_overflow.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc10_9: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc10_12: i32 = int_literal 39999999999999999993, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.a = %a} -// CHECK:STDOUT: %.loc10_9: i32 = int_literal 1 -// CHECK:STDOUT: %.loc10_12: i32 = int_literal 39999999999999999993 +// CHECK:STDOUT: %.loc10_9: i32 = int_literal 1, const = constants.%.loc10_9 +// CHECK:STDOUT: %.loc10_12: i32 = int_literal 39999999999999999993, const = constants.%.loc10_12 // CHECK:STDOUT: %a.var: ref = var a // CHECK:STDOUT: %a: ref = bind_name a, %a.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/array/fail_incomplete_element.carbon b/toolchain/check/testdata/array/fail_incomplete_element.carbon index d86acf0fb69d..35d756273e1c 100644 --- a/toolchain/check/testdata/array/fail_incomplete_element.carbon +++ b/toolchain/check/testdata/array/fail_incomplete_element.carbon @@ -22,24 +22,27 @@ var p: Incomplete* = &a[0]; // CHECK:STDOUT: --- fail_incomplete_element.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc20: type = ptr_type +// CHECK:STDOUT: %.loc15_21: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc15_22: type = array_type %.loc15_21, Incomplete, const +// CHECK:STDOUT: %.loc20_25: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc20_22: type = ptr_type , const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Incomplete = %Incomplete.decl, .a = %a, .p = %p} // CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () -// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete -// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete -// CHECK:STDOUT: %.loc15_21: i32 = int_literal 1 -// CHECK:STDOUT: %.loc15_22: type = array_type %.loc15_21, Incomplete +// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete, const +// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete, const = %Incomplete +// CHECK:STDOUT: %.loc15_21: i32 = int_literal 1, const = constants.%.loc15_21 +// CHECK:STDOUT: %.loc15_22: type = array_type %.loc15_21, Incomplete, const = constants.%.loc15_22 // CHECK:STDOUT: %a.var: ref = var a // CHECK:STDOUT: %a: ref = bind_name a, %a.var -// CHECK:STDOUT: %Incomplete.ref.loc20: type = name_ref Incomplete, %Incomplete -// CHECK:STDOUT: %.loc20_18: type = ptr_type Incomplete +// CHECK:STDOUT: %Incomplete.ref.loc20: type = name_ref Incomplete, %Incomplete, const = %Incomplete +// CHECK:STDOUT: %.loc20_18: type = ptr_type Incomplete, const // CHECK:STDOUT: %p.var: ref Incomplete* = var p // CHECK:STDOUT: %p: ref Incomplete* = bind_name p, %p.var // CHECK:STDOUT: %a.ref: ref = name_ref a, %a -// CHECK:STDOUT: %.loc20_25: i32 = int_literal 0 +// CHECK:STDOUT: %.loc20_25: i32 = int_literal 0, const = constants.%.loc20_25 // CHECK:STDOUT: %.loc20_22: * = addr_of // CHECK:STDOUT: assign %p.var, // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/array/fail_invalid_type.carbon b/toolchain/check/testdata/array/fail_invalid_type.carbon index 16abf73a1e78..0d3ea218a080 100644 --- a/toolchain/check/testdata/array/fail_invalid_type.carbon +++ b/toolchain/check/testdata/array/fail_invalid_type.carbon @@ -12,14 +12,17 @@ var a: [1; 1]; // CHECK:STDOUT: --- fail_invalid_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10: type = ptr_type [; 1] +// CHECK:STDOUT: %.loc10_9: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc10_12: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc10_13.1: type = array_type %.loc10_12, , const +// CHECK:STDOUT: %.loc10_13.2: type = ptr_type [; 1], const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.a = %a} -// CHECK:STDOUT: %.loc10_9: i32 = int_literal 1 -// CHECK:STDOUT: %.loc10_12: i32 = int_literal 1 -// CHECK:STDOUT: %.loc10_13: type = array_type %.loc10_12, +// CHECK:STDOUT: %.loc10_9: i32 = int_literal 1, const = constants.%.loc10_9 +// CHECK:STDOUT: %.loc10_12: i32 = int_literal 1, const = constants.%.loc10_12 +// CHECK:STDOUT: %.loc10_13: type = array_type %.loc10_12, , const = constants.%.loc10_13.1 // CHECK:STDOUT: %a.var: ref [; 1] = var a // CHECK:STDOUT: %a: ref [; 1] = bind_name a, %a.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/array/fail_out_of_bound.carbon b/toolchain/check/testdata/array/fail_out_of_bound.carbon index 448c78e54f08..51981e47fe28 100644 --- a/toolchain/check/testdata/array/fail_out_of_bound.carbon +++ b/toolchain/check/testdata/array/fail_out_of_bound.carbon @@ -12,19 +12,24 @@ var a: [i32; 1] = (1, 2, 3); // CHECK:STDOUT: --- fail_out_of_bound.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10_15: type = ptr_type [i32; 1] -// CHECK:STDOUT: %.loc10_27: type = tuple_type (i32, i32, i32) +// CHECK:STDOUT: %.loc10_14: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc10_15.1: type = array_type %.loc10_14, i32, const +// CHECK:STDOUT: %.loc10_15.2: type = ptr_type [i32; 1], const +// CHECK:STDOUT: %.loc10_20: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc10_23: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc10_26: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc10_27: type = tuple_type (i32, i32, i32), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.a = %a} -// CHECK:STDOUT: %.loc10_14: i32 = int_literal 1 -// CHECK:STDOUT: %.loc10_15: type = array_type %.loc10_14, i32 +// CHECK:STDOUT: %.loc10_14: i32 = int_literal 1, const = constants.%.loc10_14 +// CHECK:STDOUT: %.loc10_15: type = array_type %.loc10_14, i32, const = constants.%.loc10_15.1 // CHECK:STDOUT: %a.var: ref [i32; 1] = var a // CHECK:STDOUT: %a: ref [i32; 1] = bind_name a, %a.var -// CHECK:STDOUT: %.loc10_20: i32 = int_literal 1 -// CHECK:STDOUT: %.loc10_23: i32 = int_literal 2 -// CHECK:STDOUT: %.loc10_26: i32 = int_literal 3 +// CHECK:STDOUT: %.loc10_20: i32 = int_literal 1, const = constants.%.loc10_20 +// CHECK:STDOUT: %.loc10_23: i32 = int_literal 2, const = constants.%.loc10_23 +// CHECK:STDOUT: %.loc10_26: i32 = int_literal 3, const = constants.%.loc10_26 // CHECK:STDOUT: %.loc10_27: (i32, i32, i32) = tuple_literal (%.loc10_20, %.loc10_23, %.loc10_26) // CHECK:STDOUT: assign %a.var, // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/array/fail_type_mismatch.carbon b/toolchain/check/testdata/array/fail_type_mismatch.carbon index 7195fb433bea..e8acb6dc5300 100644 --- a/toolchain/check/testdata/array/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/array/fail_type_mismatch.carbon @@ -29,26 +29,39 @@ var d: [i32; 3] = t2; // CHECK:STDOUT: --- fail_type_mismatch.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10_15: type = ptr_type [i32; 3] -// CHECK:STDOUT: %.1: type = ptr_type String -// CHECK:STDOUT: %.loc10_39.1: type = tuple_type (i32, String, String) -// CHECK:STDOUT: %.loc12: type = tuple_type (type, type, type) -// CHECK:STDOUT: %.loc10_39.2: type = tuple_type (i32, String*, String*) -// CHECK:STDOUT: %.loc10_39.3: type = ptr_type (i32, String*, String*) -// CHECK:STDOUT: %.loc21_24.1: type = tuple_type (i32, i32) -// CHECK:STDOUT: %.loc23: type = tuple_type (type, type) -// CHECK:STDOUT: %.loc21_24.2: type = ptr_type (i32, i32) +// CHECK:STDOUT: %.loc10_14: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc10_15.1: type = array_type %.loc10_14, i32, const +// CHECK:STDOUT: %.loc10_15.2: type = ptr_type [i32; 3], const +// CHECK:STDOUT: %.loc10_20: i32 = int_literal 1, const +// CHECK:STDOUT: %.1: type = ptr_type String, const +// CHECK:STDOUT: %.loc10_23: String = string_literal "Hello", const +// CHECK:STDOUT: %.loc10_32: String = string_literal "World", const +// CHECK:STDOUT: %.loc10_39.1: type = tuple_type (i32, String, String), const +// CHECK:STDOUT: %.loc12: type = tuple_type (type, type, type), const +// CHECK:STDOUT: %.loc10_39.2: type = tuple_type (i32, String*, String*), const +// CHECK:STDOUT: %.loc10_39.3: type = ptr_type (i32, String*, String*), const +// CHECK:STDOUT: %.loc16_14: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc16_15: type = array_type %.loc16_14, i32, const +// CHECK:STDOUT: %.loc21_14: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc21_15: type = array_type %.loc21_14, i32, const +// CHECK:STDOUT: %.loc21_20: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc21_23: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc21_24.1: type = tuple_type (i32, i32), const +// CHECK:STDOUT: %.loc23: type = tuple_type (type, type), const +// CHECK:STDOUT: %.loc21_24.2: type = ptr_type (i32, i32), const +// CHECK:STDOUT: %.loc27_14: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc27_15: type = array_type %.loc27_14, i32, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.a = %a, .t1 = %t1, .b = %b, .c = %c, .t2 = %t2, .d = %d} -// CHECK:STDOUT: %.loc10_14: i32 = int_literal 3 -// CHECK:STDOUT: %.loc10_15: type = array_type %.loc10_14, i32 +// CHECK:STDOUT: %.loc10_14: i32 = int_literal 3, const = constants.%.loc10_14 +// CHECK:STDOUT: %.loc10_15: type = array_type %.loc10_14, i32, const = constants.%.loc10_15.1 // CHECK:STDOUT: %a.var: ref [i32; 3] = var a // CHECK:STDOUT: %a: ref [i32; 3] = bind_name a, %a.var -// CHECK:STDOUT: %.loc10_20: i32 = int_literal 1 -// CHECK:STDOUT: %.loc10_23: String = string_literal "Hello" -// CHECK:STDOUT: %.loc10_32: String = string_literal "World" +// CHECK:STDOUT: %.loc10_20: i32 = int_literal 1, const = constants.%.loc10_20 +// CHECK:STDOUT: %.loc10_23: String = string_literal "Hello", const = constants.%.loc10_23 +// CHECK:STDOUT: %.loc10_32: String = string_literal "World", const = constants.%.loc10_32 // CHECK:STDOUT: %.loc10_39.1: (i32, String, String) = tuple_literal (%.loc10_20, %.loc10_23, %.loc10_32) // CHECK:STDOUT: %.loc10_39.2: i32 = int_literal 0 // CHECK:STDOUT: %.loc10_39.3: ref i32 = array_index %a.var, %.loc10_39.2 @@ -58,8 +71,8 @@ var d: [i32; 3] = t2; // CHECK:STDOUT: %.loc10_39.5: type = converted %.loc12, constants.%.loc10_39.1 // CHECK:STDOUT: %t1.var: ref (i32, String, String) = var t1 // CHECK:STDOUT: %t1: ref (i32, String, String) = bind_name t1, %t1.var -// CHECK:STDOUT: %.loc16_14: i32 = int_literal 3 -// CHECK:STDOUT: %.loc16_15: type = array_type %.loc16_14, i32 +// CHECK:STDOUT: %.loc16_14: i32 = int_literal 3, const = constants.%.loc16_14 +// CHECK:STDOUT: %.loc16_15: type = array_type %.loc16_14, i32, const = constants.%.loc16_15 // CHECK:STDOUT: %b.var: ref [i32; 3] = var b // CHECK:STDOUT: %b: ref [i32; 3] = bind_name b, %b.var // CHECK:STDOUT: %t1.ref: ref (i32, String, String) = name_ref t1, %t1 @@ -70,20 +83,20 @@ var d: [i32; 3] = t2; // CHECK:STDOUT: %.loc16_19.5: init i32 = initialize_from %.loc16_19.2 to %.loc16_19.4 // CHECK:STDOUT: %.loc16_19.6: ref String = tuple_access %t1.ref, element1 // CHECK:STDOUT: assign %b.var, -// CHECK:STDOUT: %.loc21_14: i32 = int_literal 3 -// CHECK:STDOUT: %.loc21_15: type = array_type %.loc21_14, i32 +// CHECK:STDOUT: %.loc21_14: i32 = int_literal 3, const = constants.%.loc21_14 +// CHECK:STDOUT: %.loc21_15: type = array_type %.loc21_14, i32, const = constants.%.loc21_15 // CHECK:STDOUT: %c.var: ref [i32; 3] = var c // CHECK:STDOUT: %c: ref [i32; 3] = bind_name c, %c.var -// CHECK:STDOUT: %.loc21_20: i32 = int_literal 1 -// CHECK:STDOUT: %.loc21_23: i32 = int_literal 2 +// CHECK:STDOUT: %.loc21_20: i32 = int_literal 1, const = constants.%.loc21_20 +// CHECK:STDOUT: %.loc21_23: i32 = int_literal 2, const = constants.%.loc21_23 // CHECK:STDOUT: %.loc21_24.1: (i32, i32) = tuple_literal (%.loc21_20, %.loc21_23) // CHECK:STDOUT: assign %c.var, // CHECK:STDOUT: %.loc23: (type, type) = tuple_literal (i32, i32) // CHECK:STDOUT: %.loc21_24.2: type = converted %.loc23, constants.%.loc21_24.1 // CHECK:STDOUT: %t2.var: ref (i32, i32) = var t2 // CHECK:STDOUT: %t2: ref (i32, i32) = bind_name t2, %t2.var -// CHECK:STDOUT: %.loc27_14: i32 = int_literal 3 -// CHECK:STDOUT: %.loc27_15: type = array_type %.loc27_14, i32 +// CHECK:STDOUT: %.loc27_14: i32 = int_literal 3, const = constants.%.loc27_14 +// CHECK:STDOUT: %.loc27_15: type = array_type %.loc27_14, i32, const = constants.%.loc27_15 // CHECK:STDOUT: %d.var: ref [i32; 3] = var d // CHECK:STDOUT: %d: ref [i32; 3] = bind_name d, %d.var // CHECK:STDOUT: %t2.ref: ref (i32, i32) = name_ref t2, %t2 diff --git a/toolchain/check/testdata/array/function_param.carbon b/toolchain/check/testdata/array/function_param.carbon index c40cec4c2713..ed84367b88de 100644 --- a/toolchain/check/testdata/array/function_param.carbon +++ b/toolchain/check/testdata/array/function_param.carbon @@ -15,14 +15,20 @@ fn G() -> i32 { // CHECK:STDOUT: --- function_param.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7: type = ptr_type [i32; 3] -// CHECK:STDOUT: %.loc12: type = tuple_type (i32, i32, i32) +// CHECK:STDOUT: %.loc7_17: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc7_18.1: type = array_type %.loc7_17, i32, const +// CHECK:STDOUT: %.loc7_18.2: type = ptr_type [i32; 3], const +// CHECK:STDOUT: %.loc12_13: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc12_16: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc12_19: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc12_20: type = tuple_type (i32, i32, i32), const +// CHECK:STDOUT: %.loc12_23: i32 = int_literal 1, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F, .G = %G} -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%arr: [i32; 3], %i: i32) -> i32 { @@ -37,12 +43,12 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F -// CHECK:STDOUT: %.loc12_13: i32 = int_literal 1 -// CHECK:STDOUT: %.loc12_16: i32 = int_literal 2 -// CHECK:STDOUT: %.loc12_19: i32 = int_literal 3 +// CHECK:STDOUT: %F.ref: = name_ref F, file.%F, const = file.%F +// CHECK:STDOUT: %.loc12_13: i32 = int_literal 1, const = constants.%.loc12_13 +// CHECK:STDOUT: %.loc12_16: i32 = int_literal 2, const = constants.%.loc12_16 +// CHECK:STDOUT: %.loc12_19: i32 = int_literal 3, const = constants.%.loc12_19 // CHECK:STDOUT: %.loc12_20.1: (i32, i32, i32) = tuple_literal (%.loc12_13, %.loc12_16, %.loc12_19) -// CHECK:STDOUT: %.loc12_23: i32 = int_literal 1 +// CHECK:STDOUT: %.loc12_23: i32 = int_literal 1, const = constants.%.loc12_23 // CHECK:STDOUT: %.loc12_20.2: ref [i32; 3] = temporary_storage // CHECK:STDOUT: %.loc12_20.3: i32 = int_literal 0 // CHECK:STDOUT: %.loc12_20.4: ref i32 = array_index %.loc12_20.2, %.loc12_20.3 diff --git a/toolchain/check/testdata/array/nine_elements.carbon b/toolchain/check/testdata/array/nine_elements.carbon index a98a2bea05fe..fb68ff81491e 100644 --- a/toolchain/check/testdata/array/nine_elements.carbon +++ b/toolchain/check/testdata/array/nine_elements.carbon @@ -9,25 +9,36 @@ var a: [i32; 9] = (1, 2, 3, 4, 5, 6, 7, 8, 9); // CHECK:STDOUT: --- nine_elements.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_15: type = ptr_type [i32; 9] -// CHECK:STDOUT: %.loc7_45: type = tuple_type (i32, i32, i32, i32, i32, i32, i32, i32, i32) +// CHECK:STDOUT: %.loc7_14: i32 = int_literal 9, const +// CHECK:STDOUT: %.loc7_15.1: type = array_type %.loc7_14, i32, const +// CHECK:STDOUT: %.loc7_15.2: type = ptr_type [i32; 9], const +// CHECK:STDOUT: %.loc7_20: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc7_23: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc7_26: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc7_29: i32 = int_literal 4, const +// CHECK:STDOUT: %.loc7_32: i32 = int_literal 5, const +// CHECK:STDOUT: %.loc7_35: i32 = int_literal 6, const +// CHECK:STDOUT: %.loc7_38: i32 = int_literal 7, const +// CHECK:STDOUT: %.loc7_41: i32 = int_literal 8, const +// CHECK:STDOUT: %.loc7_44: i32 = int_literal 9, const +// CHECK:STDOUT: %.loc7_45: type = tuple_type (i32, i32, i32, i32, i32, i32, i32, i32, i32), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.a = %a} -// CHECK:STDOUT: %.loc7_14: i32 = int_literal 9 -// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 +// CHECK:STDOUT: %.loc7_14: i32 = int_literal 9, const = constants.%.loc7_14 +// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32, const = constants.%.loc7_15.1 // CHECK:STDOUT: %a.var: ref [i32; 9] = var a // CHECK:STDOUT: %a: ref [i32; 9] = bind_name a, %a.var -// CHECK:STDOUT: %.loc7_20: i32 = int_literal 1 -// CHECK:STDOUT: %.loc7_23: i32 = int_literal 2 -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 3 -// CHECK:STDOUT: %.loc7_29: i32 = int_literal 4 -// CHECK:STDOUT: %.loc7_32: i32 = int_literal 5 -// CHECK:STDOUT: %.loc7_35: i32 = int_literal 6 -// CHECK:STDOUT: %.loc7_38: i32 = int_literal 7 -// CHECK:STDOUT: %.loc7_41: i32 = int_literal 8 -// CHECK:STDOUT: %.loc7_44: i32 = int_literal 9 +// CHECK:STDOUT: %.loc7_20: i32 = int_literal 1, const = constants.%.loc7_20 +// CHECK:STDOUT: %.loc7_23: i32 = int_literal 2, const = constants.%.loc7_23 +// CHECK:STDOUT: %.loc7_26: i32 = int_literal 3, const = constants.%.loc7_26 +// CHECK:STDOUT: %.loc7_29: i32 = int_literal 4, const = constants.%.loc7_29 +// CHECK:STDOUT: %.loc7_32: i32 = int_literal 5, const = constants.%.loc7_32 +// CHECK:STDOUT: %.loc7_35: i32 = int_literal 6, const = constants.%.loc7_35 +// CHECK:STDOUT: %.loc7_38: i32 = int_literal 7, const = constants.%.loc7_38 +// CHECK:STDOUT: %.loc7_41: i32 = int_literal 8, const = constants.%.loc7_41 +// CHECK:STDOUT: %.loc7_44: i32 = int_literal 9, const = constants.%.loc7_44 // CHECK:STDOUT: %.loc7_45.1: (i32, i32, i32, i32, i32, i32, i32, i32, i32) = tuple_literal (%.loc7_20, %.loc7_23, %.loc7_26, %.loc7_29, %.loc7_32, %.loc7_35, %.loc7_38, %.loc7_41, %.loc7_44) // CHECK:STDOUT: %.loc7_45.2: i32 = int_literal 0 // CHECK:STDOUT: %.loc7_45.3: ref i32 = array_index %a.var, %.loc7_45.2 diff --git a/toolchain/check/testdata/as/as_type.carbon b/toolchain/check/testdata/as/as_type.carbon index e1cae0fc9549..b9dc39f74bd4 100644 --- a/toolchain/check/testdata/as/as_type.carbon +++ b/toolchain/check/testdata/as/as_type.carbon @@ -9,8 +9,8 @@ let t: type = (i32, i32) as type; // CHECK:STDOUT: --- as_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_24: type = tuple_type (type, type) -// CHECK:STDOUT: %.loc7_26: type = tuple_type (i32, i32) +// CHECK:STDOUT: %.loc7_24: type = tuple_type (type, type), const +// CHECK:STDOUT: %.loc7_26: type = tuple_type (i32, i32), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { diff --git a/toolchain/check/testdata/as/basic.carbon b/toolchain/check/testdata/as/basic.carbon index 77ede8a8788c..07a421b5704d 100644 --- a/toolchain/check/testdata/as/basic.carbon +++ b/toolchain/check/testdata/as/basic.carbon @@ -10,14 +10,18 @@ fn Main() -> i32 { // CHECK:STDOUT: --- basic.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc8: i32 = int_literal 1, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: i32 = int_literal 1 +// CHECK:STDOUT: %.loc8: i32 = int_literal 1, const = constants.%.loc8 // CHECK:STDOUT: return %.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/as/fail_no_conversion.carbon b/toolchain/check/testdata/as/fail_no_conversion.carbon index ac27d6070a57..261dd4f789b4 100644 --- a/toolchain/check/testdata/as/fail_no_conversion.carbon +++ b/toolchain/check/testdata/as/fail_no_conversion.carbon @@ -12,16 +12,17 @@ let n: (i32, i32) = 1 as (i32, i32); // CHECK:STDOUT: --- fail_no_conversion.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10_17.1: type = tuple_type (type, type) -// CHECK:STDOUT: %.loc10_17.2: type = tuple_type (i32, i32) -// CHECK:STDOUT: %.loc10_17.3: type = ptr_type (i32, i32) +// CHECK:STDOUT: %.loc10_17.1: type = tuple_type (type, type), const +// CHECK:STDOUT: %.loc10_17.2: type = tuple_type (i32, i32), const +// CHECK:STDOUT: %.loc10_17.3: type = ptr_type (i32, i32), const +// CHECK:STDOUT: %.loc10_21: i32 = int_literal 1, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {} // CHECK:STDOUT: %.loc10_17.1: (type, type) = tuple_literal (i32, i32) // CHECK:STDOUT: %.loc10_17.2: type = converted %.loc10_17.1, constants.%.loc10_17.2 -// CHECK:STDOUT: %.loc10_21: i32 = int_literal 1 +// CHECK:STDOUT: %.loc10_21: i32 = int_literal 1, const = constants.%.loc10_21 // CHECK:STDOUT: %.loc10_35: (type, type) = tuple_literal (i32, i32) // CHECK:STDOUT: %.loc10_17.3: type = converted %.loc10_35, constants.%.loc10_17.2 // CHECK:STDOUT: %n: (i32, i32) = bind_name n, diff --git a/toolchain/check/testdata/as/fail_not_type.carbon b/toolchain/check/testdata/as/fail_not_type.carbon index fa938271d980..b4b6877ddd85 100644 --- a/toolchain/check/testdata/as/fail_not_type.carbon +++ b/toolchain/check/testdata/as/fail_not_type.carbon @@ -11,10 +11,15 @@ let n: i32 = 1 as 2; // CHECK:STDOUT: --- fail_not_type.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc10_14: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc10_19: i32 = int_literal 2, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {} -// CHECK:STDOUT: %.loc10_14: i32 = int_literal 1 -// CHECK:STDOUT: %.loc10_19: i32 = int_literal 2 +// CHECK:STDOUT: %.loc10_14: i32 = int_literal 1, const = constants.%.loc10_14 +// CHECK:STDOUT: %.loc10_19: i32 = int_literal 2, const = constants.%.loc10_19 // CHECK:STDOUT: %n: i32 = bind_name n, // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/as/identity.carbon b/toolchain/check/testdata/as/identity.carbon index 5d1431f4d98d..b1370f4d4bb3 100644 --- a/toolchain/check/testdata/as/identity.carbon +++ b/toolchain/check/testdata/as/identity.carbon @@ -27,19 +27,19 @@ fn Initializing() { // CHECK:STDOUT: --- identity.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc11_1.1: type = struct_type {} -// CHECK:STDOUT: %.loc11_1.2: type = tuple_type () -// CHECK:STDOUT: %.loc9: type = ptr_type {} +// CHECK:STDOUT: %.loc11_1.1: type = struct_type {}, const +// CHECK:STDOUT: %.loc11_1.2: type = tuple_type (), const +// CHECK:STDOUT: %.loc9: type = ptr_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.X = %X.decl, .Value = %Value, .Reference = %Reference, .Make = %Make, .Initializing = %Initializing} // CHECK:STDOUT: %X.decl = class_decl @X, () -// CHECK:STDOUT: %X: type = class_type @X -// CHECK:STDOUT: %Value: = fn_decl @Value -// CHECK:STDOUT: %Reference: = fn_decl @Reference -// CHECK:STDOUT: %Make: = fn_decl @Make -// CHECK:STDOUT: %Initializing: = fn_decl @Initializing +// CHECK:STDOUT: %X: type = class_type @X, const +// CHECK:STDOUT: %Value: = fn_decl @Value, const +// CHECK:STDOUT: %Reference: = fn_decl @Reference, const +// CHECK:STDOUT: %Make: = fn_decl @Make, const +// CHECK:STDOUT: %Initializing: = fn_decl @Initializing, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @X { @@ -49,20 +49,20 @@ fn Initializing() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Value(%n: X) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %X.ref.loc14_10: type = name_ref X, file.%X +// CHECK:STDOUT: %X.ref.loc14_10: type = name_ref X, file.%X, const = file.%X // CHECK:STDOUT: %n.ref: X = name_ref n, %n -// CHECK:STDOUT: %X.ref.loc14_19: type = name_ref X, file.%X +// CHECK:STDOUT: %X.ref.loc14_19: type = name_ref X, file.%X, const = file.%X // CHECK:STDOUT: %m: X = bind_name m, %n.ref // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Reference(%p: X*) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %X.ref.loc18_10: type = name_ref X, file.%X -// CHECK:STDOUT: %.loc18_11: type = ptr_type X +// CHECK:STDOUT: %X.ref.loc18_10: type = name_ref X, file.%X, const = file.%X +// CHECK:STDOUT: %.loc18_11: type = ptr_type X, const // CHECK:STDOUT: %p.ref: X* = name_ref p, %p // CHECK:STDOUT: %.loc18_17: ref X = deref %p.ref -// CHECK:STDOUT: %X.ref.loc18_23: type = name_ref X, file.%X +// CHECK:STDOUT: %X.ref.loc18_23: type = name_ref X, file.%X, const = file.%X // CHECK:STDOUT: %.loc18_15: X* = addr_of %.loc18_17 // CHECK:STDOUT: %q: X* = bind_name q, %.loc18_15 // CHECK:STDOUT: return @@ -72,13 +72,13 @@ fn Initializing() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Initializing() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %X.ref.loc24_10: type = name_ref X, file.%X +// CHECK:STDOUT: %X.ref.loc24_10: type = name_ref X, file.%X, const = file.%X // CHECK:STDOUT: %x.var: ref X = var x // CHECK:STDOUT: %x: ref X = bind_name x, %x.var -// CHECK:STDOUT: %Make.ref: = name_ref Make, file.%Make +// CHECK:STDOUT: %Make.ref: = name_ref Make, file.%Make, const = file.%Make // CHECK:STDOUT: %.loc24_7: ref X = splice_block %x.var {} // CHECK:STDOUT: %.loc24_19: init X = call %Make.ref() to %.loc24_7 -// CHECK:STDOUT: %X.ref.loc24_25: type = name_ref X, file.%X +// CHECK:STDOUT: %X.ref.loc24_25: type = name_ref X, file.%X, const = file.%X // CHECK:STDOUT: assign %x.var, %.loc24_19 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/as/tuple.carbon b/toolchain/check/testdata/as/tuple.carbon index 6597c9f608d3..12fe7c6669b5 100644 --- a/toolchain/check/testdata/as/tuple.carbon +++ b/toolchain/check/testdata/as/tuple.carbon @@ -23,22 +23,22 @@ fn Var() { // CHECK:STDOUT: --- tuple.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc9_1.1: type = struct_type {} -// CHECK:STDOUT: %.loc9_1.2: type = tuple_type () -// CHECK:STDOUT: %.loc7: type = ptr_type {} -// CHECK:STDOUT: %.loc15_15.1: type = tuple_type (type, type) -// CHECK:STDOUT: %.loc15_15.2: type = tuple_type (X, X) -// CHECK:STDOUT: %.loc15_15.3: type = tuple_type ({}*, {}*) -// CHECK:STDOUT: %.loc15_15.4: type = ptr_type ({}*, {}*) +// CHECK:STDOUT: %.loc9_1.1: type = struct_type {}, const +// CHECK:STDOUT: %.loc9_1.2: type = tuple_type (), const +// CHECK:STDOUT: %.loc7: type = ptr_type {}, const +// CHECK:STDOUT: %.loc15_15.1: type = tuple_type (type, type), const +// CHECK:STDOUT: %.loc15_15.2: type = tuple_type (X, X), const +// CHECK:STDOUT: %.loc15_15.3: type = tuple_type ({}*, {}*), const +// CHECK:STDOUT: %.loc15_15.4: type = ptr_type ({}*, {}*), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.X = %X.decl, .Make = %Make, .Let = %Let, .Var = %Var} // CHECK:STDOUT: %X.decl = class_decl @X, () -// CHECK:STDOUT: %X: type = class_type @X -// CHECK:STDOUT: %Make: = fn_decl @Make -// CHECK:STDOUT: %Let: = fn_decl @Let -// CHECK:STDOUT: %Var: = fn_decl @Var +// CHECK:STDOUT: %X: type = class_type @X, const +// CHECK:STDOUT: %Make: = fn_decl @Make, const +// CHECK:STDOUT: %Let: = fn_decl @Let, const +// CHECK:STDOUT: %Var: = fn_decl @Var, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @X { @@ -50,19 +50,19 @@ fn Var() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Let() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %X.ref.loc15_11: type = name_ref X, file.%X -// CHECK:STDOUT: %X.ref.loc15_14: type = name_ref X, file.%X +// CHECK:STDOUT: %X.ref.loc15_11: type = name_ref X, file.%X, const = file.%X +// CHECK:STDOUT: %X.ref.loc15_14: type = name_ref X, file.%X, const = file.%X // CHECK:STDOUT: %.loc15_15.1: (type, type) = tuple_literal (%X.ref.loc15_11, %X.ref.loc15_14) // CHECK:STDOUT: %.loc15_15.2: type = converted %.loc15_15.1, constants.%.loc15_15.2 -// CHECK:STDOUT: %Make.ref.loc15_20: = name_ref Make, file.%Make +// CHECK:STDOUT: %Make.ref.loc15_20: = name_ref Make, file.%Make, const = file.%Make // CHECK:STDOUT: %.loc15_24.1: ref X = temporary_storage // CHECK:STDOUT: %.loc15_24.2: init X = call %Make.ref.loc15_20() to %.loc15_24.1 -// CHECK:STDOUT: %Make.ref.loc15_28: = name_ref Make, file.%Make +// CHECK:STDOUT: %Make.ref.loc15_28: = name_ref Make, file.%Make, const = file.%Make // CHECK:STDOUT: %.loc15_32.1: ref X = temporary_storage // CHECK:STDOUT: %.loc15_32.2: init X = call %Make.ref.loc15_28() to %.loc15_32.1 // CHECK:STDOUT: %.loc15_34.1: (X, X) = tuple_literal (%.loc15_24.2, %.loc15_32.2) -// CHECK:STDOUT: %X.ref.loc15_40: type = name_ref X, file.%X -// CHECK:STDOUT: %X.ref.loc15_43: type = name_ref X, file.%X +// CHECK:STDOUT: %X.ref.loc15_40: type = name_ref X, file.%X, const = file.%X +// CHECK:STDOUT: %X.ref.loc15_43: type = name_ref X, file.%X, const = file.%X // CHECK:STDOUT: %.loc15_44: (type, type) = tuple_literal (%X.ref.loc15_40, %X.ref.loc15_43) // CHECK:STDOUT: %.loc15_15.3: type = converted %.loc15_44, constants.%.loc15_15.2 // CHECK:STDOUT: %.loc15_24.3: ref X = temporary %.loc15_24.1, %.loc15_24.2 @@ -77,21 +77,21 @@ fn Var() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Var() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %X.ref.loc20_11: type = name_ref X, file.%X -// CHECK:STDOUT: %X.ref.loc20_14: type = name_ref X, file.%X +// CHECK:STDOUT: %X.ref.loc20_11: type = name_ref X, file.%X, const = file.%X +// CHECK:STDOUT: %X.ref.loc20_14: type = name_ref X, file.%X, const = file.%X // CHECK:STDOUT: %.loc20_15: (type, type) = tuple_literal (%X.ref.loc20_11, %X.ref.loc20_14) // CHECK:STDOUT: %.loc15_15.1: type = converted %.loc20_15, constants.%.loc15_15.2 // CHECK:STDOUT: %b.var: ref (X, X) = var b // CHECK:STDOUT: %b: ref (X, X) = bind_name b, %b.var -// CHECK:STDOUT: %Make.ref.loc20_20: = name_ref Make, file.%Make +// CHECK:STDOUT: %Make.ref.loc20_20: = name_ref Make, file.%Make, const = file.%Make // CHECK:STDOUT: %.loc20_34.1: ref X = tuple_access %b.var, element0 // CHECK:STDOUT: %.loc20_24: init X = call %Make.ref.loc20_20() to %.loc20_34.1 -// CHECK:STDOUT: %Make.ref.loc20_28: = name_ref Make, file.%Make +// CHECK:STDOUT: %Make.ref.loc20_28: = name_ref Make, file.%Make, const = file.%Make // CHECK:STDOUT: %.loc20_34.2: ref X = tuple_access %b.var, element1 // CHECK:STDOUT: %.loc20_32: init X = call %Make.ref.loc20_28() to %.loc20_34.2 // CHECK:STDOUT: %.loc20_34.3: (X, X) = tuple_literal (%.loc20_24, %.loc20_32) -// CHECK:STDOUT: %X.ref.loc20_40: type = name_ref X, file.%X -// CHECK:STDOUT: %X.ref.loc20_43: type = name_ref X, file.%X +// CHECK:STDOUT: %X.ref.loc20_40: type = name_ref X, file.%X, const = file.%X +// CHECK:STDOUT: %X.ref.loc20_43: type = name_ref X, file.%X, const = file.%X // CHECK:STDOUT: %.loc20_44: (type, type) = tuple_literal (%X.ref.loc20_40, %X.ref.loc20_43) // CHECK:STDOUT: %.loc15_15.2: type = converted %.loc20_44, constants.%.loc15_15.2 // CHECK:STDOUT: %.loc20_34.4: init (X, X) = tuple_init (%.loc20_24, %.loc20_32) to %b.var diff --git a/toolchain/check/testdata/basics/builtin_insts.carbon b/toolchain/check/testdata/basics/builtin_insts.carbon index 3a304621ab77..3b4af37f77e3 100644 --- a/toolchain/check/testdata/basics/builtin_insts.carbon +++ b/toolchain/check/testdata/basics/builtin_insts.carbon @@ -29,6 +29,7 @@ // CHECK:STDOUT: instBoundMethodType: {kind: CrossRef, arg0: ir0, arg1: instBoundMethodType, type: typeTypeType} // CHECK:STDOUT: instNamespaceType: {kind: CrossRef, arg0: ir0, arg1: instNamespaceType, type: typeTypeType} // CHECK:STDOUT: inst+0: {kind: Namespace, arg0: namePackageNamespace, arg1: name_scope0, type: type0} +// CHECK:STDOUT: constant_values: {} // CHECK:STDOUT: inst_blocks: // CHECK:STDOUT: empty: {} // CHECK:STDOUT: exports: {} diff --git a/toolchain/check/testdata/basics/builtin_types.carbon b/toolchain/check/testdata/basics/builtin_types.carbon index 7fb75ca34a68..ad14d8f81bb8 100644 --- a/toolchain/check/testdata/basics/builtin_types.carbon +++ b/toolchain/check/testdata/basics/builtin_types.carbon @@ -12,20 +12,23 @@ var test_type: type = i32; // CHECK:STDOUT: --- builtin_types.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = ptr_type String +// CHECK:STDOUT: %.loc7: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc8: f64 = real_literal 1e-1, const +// CHECK:STDOUT: %.1: type = ptr_type String, const +// CHECK:STDOUT: %.loc9: String = string_literal "Test", const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.test_i32 = %test_i32, .test_f64 = %test_f64, .test_type = %test_type} // CHECK:STDOUT: %test_i32.var: ref i32 = var test_i32 // CHECK:STDOUT: %test_i32: ref i32 = bind_name test_i32, %test_i32.var -// CHECK:STDOUT: %.loc7: i32 = int_literal 0 +// CHECK:STDOUT: %.loc7: i32 = int_literal 0, const = constants.%.loc7 // CHECK:STDOUT: assign %test_i32.var, %.loc7 // CHECK:STDOUT: %test_f64.var: ref f64 = var test_f64 // CHECK:STDOUT: %test_f64: ref f64 = bind_name test_f64, %test_f64.var -// CHECK:STDOUT: %.loc8: f64 = real_literal 1e-1 +// CHECK:STDOUT: %.loc8: f64 = real_literal 1e-1, const = constants.%.loc8 // CHECK:STDOUT: assign %test_f64.var, %.loc8 -// CHECK:STDOUT: %.loc9: String = string_literal "Test" +// CHECK:STDOUT: %.loc9: String = string_literal "Test", const = constants.%.loc9 // CHECK:STDOUT: %test_str: String = bind_name test_str, %.loc9 // CHECK:STDOUT: %test_type.var: ref type = var test_type // CHECK:STDOUT: %test_type: ref type = bind_name test_type, %test_type.var diff --git a/toolchain/check/testdata/basics/fail_bad_run.carbon b/toolchain/check/testdata/basics/fail_bad_run.carbon index 90c0baeb4975..4433613780b7 100644 --- a/toolchain/check/testdata/basics/fail_bad_run.carbon +++ b/toolchain/check/testdata/basics/fail_bad_run.carbon @@ -15,13 +15,13 @@ fn Run() -> String {} // CHECK:STDOUT: --- fail_bad_run.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = ptr_type String -// CHECK:STDOUT: %.loc13: type = tuple_type () +// CHECK:STDOUT: %.1: type = ptr_type String, const +// CHECK:STDOUT: %.loc13: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Run = %Run} -// CHECK:STDOUT: %Run: = fn_decl @Run +// CHECK:STDOUT: %Run: = fn_decl @Run, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() -> %return: String { diff --git a/toolchain/check/testdata/basics/fail_bad_run_2.carbon b/toolchain/check/testdata/basics/fail_bad_run_2.carbon index bcdee445a15c..c27764d7120c 100644 --- a/toolchain/check/testdata/basics/fail_bad_run_2.carbon +++ b/toolchain/check/testdata/basics/fail_bad_run_2.carbon @@ -13,7 +13,7 @@ fn Run(n: i32) {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Run = %Run} -// CHECK:STDOUT: %Run: = fn_decl @Run +// CHECK:STDOUT: %Run: = fn_decl @Run, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run(%n: i32) { diff --git a/toolchain/check/testdata/basics/fail_name_lookup.carbon b/toolchain/check/testdata/basics/fail_name_lookup.carbon index fe9c3cf40fa4..cc368c11365f 100644 --- a/toolchain/check/testdata/basics/fail_name_lookup.carbon +++ b/toolchain/check/testdata/basics/fail_name_lookup.carbon @@ -15,7 +15,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/basics/fail_non_type_as_type.carbon b/toolchain/check/testdata/basics/fail_non_type_as_type.carbon index 5b34600d12d6..4e0a78b1d78d 100644 --- a/toolchain/check/testdata/basics/fail_non_type_as_type.carbon +++ b/toolchain/check/testdata/basics/fail_non_type_as_type.carbon @@ -11,11 +11,15 @@ var x: type = 42; // CHECK:STDOUT: --- fail_non_type_as_type.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc10: i32 = int_literal 42, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x} // CHECK:STDOUT: %x.var: ref type = var x // CHECK:STDOUT: %x: ref type = bind_name x, %x.var -// CHECK:STDOUT: %.loc10: i32 = int_literal 42 +// CHECK:STDOUT: %.loc10: i32 = int_literal 42, const = constants.%.loc10 // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/basics/multifile.carbon b/toolchain/check/testdata/basics/multifile.carbon index 9da5483cad34..4eddbda18dc8 100644 --- a/toolchain/check/testdata/basics/multifile.carbon +++ b/toolchain/check/testdata/basics/multifile.carbon @@ -18,7 +18,7 @@ fn B() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %A} -// CHECK:STDOUT: %A: = fn_decl @A +// CHECK:STDOUT: %A: = fn_decl @A, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { @@ -30,7 +30,7 @@ fn B() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.B = %B} -// CHECK:STDOUT: %B: = fn_decl @B +// CHECK:STDOUT: %B: = fn_decl @B, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @B() { diff --git a/toolchain/check/testdata/basics/multifile_raw_and_textual_ir.carbon b/toolchain/check/testdata/basics/multifile_raw_and_textual_ir.carbon index 03d8c690ca71..a6c2c7b1928e 100644 --- a/toolchain/check/testdata/basics/multifile_raw_and_textual_ir.carbon +++ b/toolchain/check/testdata/basics/multifile_raw_and_textual_ir.carbon @@ -36,6 +36,8 @@ fn B() {} // CHECK:STDOUT: inst+0: {kind: Namespace, arg0: namePackageNamespace, arg1: name_scope0, type: type0} // CHECK:STDOUT: inst+1: {kind: FunctionDecl, arg0: function0, type: type1} // CHECK:STDOUT: inst+2: {kind: Return} +// CHECK:STDOUT: constant_values: +// CHECK:STDOUT: inst+1: inst+1 // CHECK:STDOUT: inst_blocks: // CHECK:STDOUT: empty: {} // CHECK:STDOUT: exports: @@ -51,7 +53,7 @@ fn B() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %A} -// CHECK:STDOUT: %A: = fn_decl @A +// CHECK:STDOUT: %A: = fn_decl @A, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { @@ -77,6 +79,8 @@ fn B() {} // CHECK:STDOUT: inst+0: {kind: Namespace, arg0: namePackageNamespace, arg1: name_scope0, type: type0} // CHECK:STDOUT: inst+1: {kind: FunctionDecl, arg0: function0, type: type1} // CHECK:STDOUT: inst+2: {kind: Return} +// CHECK:STDOUT: constant_values: +// CHECK:STDOUT: inst+1: inst+1 // CHECK:STDOUT: inst_blocks: // CHECK:STDOUT: empty: {} // CHECK:STDOUT: exports: @@ -92,7 +96,7 @@ fn B() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.B = %B} -// CHECK:STDOUT: %B: = fn_decl @B +// CHECK:STDOUT: %B: = fn_decl @B, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @B() { diff --git a/toolchain/check/testdata/basics/multifile_raw_ir.carbon b/toolchain/check/testdata/basics/multifile_raw_ir.carbon index 4dcbf4087642..0aadc4fdf292 100644 --- a/toolchain/check/testdata/basics/multifile_raw_ir.carbon +++ b/toolchain/check/testdata/basics/multifile_raw_ir.carbon @@ -36,6 +36,8 @@ fn B() {} // CHECK:STDOUT: inst+0: {kind: Namespace, arg0: namePackageNamespace, arg1: name_scope0, type: type0} // CHECK:STDOUT: inst+1: {kind: FunctionDecl, arg0: function0, type: type1} // CHECK:STDOUT: inst+2: {kind: Return} +// CHECK:STDOUT: constant_values: +// CHECK:STDOUT: inst+1: inst+1 // CHECK:STDOUT: inst_blocks: // CHECK:STDOUT: empty: {} // CHECK:STDOUT: exports: @@ -64,6 +66,8 @@ fn B() {} // CHECK:STDOUT: inst+0: {kind: Namespace, arg0: namePackageNamespace, arg1: name_scope0, type: type0} // CHECK:STDOUT: inst+1: {kind: FunctionDecl, arg0: function0, type: type1} // CHECK:STDOUT: inst+2: {kind: Return} +// CHECK:STDOUT: constant_values: +// CHECK:STDOUT: inst+1: inst+1 // CHECK:STDOUT: inst_blocks: // CHECK:STDOUT: empty: {} // CHECK:STDOUT: exports: diff --git a/toolchain/check/testdata/basics/numeric_literals.carbon b/toolchain/check/testdata/basics/numeric_literals.carbon index 5bdc926f0d63..01537ceccd80 100644 --- a/toolchain/check/testdata/basics/numeric_literals.carbon +++ b/toolchain/check/testdata/basics/numeric_literals.carbon @@ -28,28 +28,44 @@ fn F() { // CHECK:STDOUT: --- numeric_literals.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10: type = ptr_type [i32; 5] -// CHECK:STDOUT: %.loc16: type = tuple_type (i32, i32, i32, i32, i32) -// CHECK:STDOUT: %.loc17: type = ptr_type [f64; 7] -// CHECK:STDOUT: %.loc25: type = tuple_type (f64, f64, f64, f64, f64, f64, f64) +// CHECK:STDOUT: %.loc10_19: i32 = int_literal 5, const +// CHECK:STDOUT: %.loc10_20.1: type = array_type %.loc10_19, i32, const +// CHECK:STDOUT: %.loc10_20.2: type = ptr_type [i32; 5], const +// CHECK:STDOUT: %.loc11: i32 = int_literal 8, const +// CHECK:STDOUT: %.loc12: i32 = int_literal 9, const +// CHECK:STDOUT: %.loc13: i32 = int_literal 8, const +// CHECK:STDOUT: %.loc14: i32 = int_literal 8, const +// CHECK:STDOUT: %.loc15: i32 = int_literal 39999999999999999993, const +// CHECK:STDOUT: %.loc16: type = tuple_type (i32, i32, i32, i32, i32), const +// CHECK:STDOUT: %.loc17_21: i32 = int_literal 7, const +// CHECK:STDOUT: %.loc17_22.1: type = array_type %.loc17_21, f64, const +// CHECK:STDOUT: %.loc17_22.2: type = ptr_type [f64; 7], const +// CHECK:STDOUT: %.loc18: f64 = real_literal 9e-1, const +// CHECK:STDOUT: %.loc19: f64 = real_literal 80e-1, const +// CHECK:STDOUT: %.loc20: f64 = real_literal 800e-1, const +// CHECK:STDOUT: %.loc21: f64 = real_literal 10e6, const +// CHECK:STDOUT: %.loc22: f64 = real_literal 10e7, const +// CHECK:STDOUT: %.loc23: f64 = real_literal 10e-9, const +// CHECK:STDOUT: %.loc24: f64 = real_literal 399999999999999999930e39999999999999999992, const +// CHECK:STDOUT: %.loc25: type = tuple_type (f64, f64, f64, f64, f64, f64, f64), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_19: i32 = int_literal 5 -// CHECK:STDOUT: %.loc10_20: type = array_type %.loc10_19, i32 +// CHECK:STDOUT: %.loc10_19: i32 = int_literal 5, const = constants.%.loc10_19 +// CHECK:STDOUT: %.loc10_20: type = array_type %.loc10_19, i32, const = constants.%.loc10_20.1 // CHECK:STDOUT: %ints.var: ref [i32; 5] = var ints // CHECK:STDOUT: %ints: ref [i32; 5] = bind_name ints, %ints.var -// CHECK:STDOUT: %.loc11: i32 = int_literal 8 -// CHECK:STDOUT: %.loc12: i32 = int_literal 9 -// CHECK:STDOUT: %.loc13: i32 = int_literal 8 -// CHECK:STDOUT: %.loc14: i32 = int_literal 8 -// CHECK:STDOUT: %.loc15: i32 = int_literal 39999999999999999993 +// CHECK:STDOUT: %.loc11: i32 = int_literal 8, const = constants.%.loc11 +// CHECK:STDOUT: %.loc12: i32 = int_literal 9, const = constants.%.loc12 +// CHECK:STDOUT: %.loc13: i32 = int_literal 8, const = constants.%.loc13 +// CHECK:STDOUT: %.loc14: i32 = int_literal 8, const = constants.%.loc14 +// CHECK:STDOUT: %.loc15: i32 = int_literal 39999999999999999993, const = constants.%.loc15 // CHECK:STDOUT: %.loc16_3.1: (i32, i32, i32, i32, i32) = tuple_literal (%.loc11, %.loc12, %.loc13, %.loc14, %.loc15) // CHECK:STDOUT: %.loc16_3.2: i32 = int_literal 0 // CHECK:STDOUT: %.loc16_3.3: ref i32 = array_index %ints.var, %.loc16_3.2 @@ -69,17 +85,17 @@ fn F() { // CHECK:STDOUT: %.loc16_3.17: init [i32; 5] = array_init (%.loc16_3.4, %.loc16_3.7, %.loc16_3.10, %.loc16_3.13, %.loc16_3.16) to %ints.var // CHECK:STDOUT: %.loc16_3.18: init [i32; 5] = converted %.loc16_3.1, %.loc16_3.17 // CHECK:STDOUT: assign %ints.var, %.loc16_3.18 -// CHECK:STDOUT: %.loc17_21: i32 = int_literal 7 -// CHECK:STDOUT: %.loc17_22: type = array_type %.loc17_21, f64 +// CHECK:STDOUT: %.loc17_21: i32 = int_literal 7, const = constants.%.loc17_21 +// CHECK:STDOUT: %.loc17_22: type = array_type %.loc17_21, f64, const = constants.%.loc17_22.1 // CHECK:STDOUT: %floats.var: ref [f64; 7] = var floats // CHECK:STDOUT: %floats: ref [f64; 7] = bind_name floats, %floats.var -// CHECK:STDOUT: %.loc18: f64 = real_literal 9e-1 -// CHECK:STDOUT: %.loc19: f64 = real_literal 80e-1 -// CHECK:STDOUT: %.loc20: f64 = real_literal 800e-1 -// CHECK:STDOUT: %.loc21: f64 = real_literal 10e6 -// CHECK:STDOUT: %.loc22: f64 = real_literal 10e7 -// CHECK:STDOUT: %.loc23: f64 = real_literal 10e-9 -// CHECK:STDOUT: %.loc24: f64 = real_literal 399999999999999999930e39999999999999999992 +// CHECK:STDOUT: %.loc18: f64 = real_literal 9e-1, const = constants.%.loc18 +// CHECK:STDOUT: %.loc19: f64 = real_literal 80e-1, const = constants.%.loc19 +// CHECK:STDOUT: %.loc20: f64 = real_literal 800e-1, const = constants.%.loc20 +// CHECK:STDOUT: %.loc21: f64 = real_literal 10e6, const = constants.%.loc21 +// CHECK:STDOUT: %.loc22: f64 = real_literal 10e7, const = constants.%.loc22 +// CHECK:STDOUT: %.loc23: f64 = real_literal 10e-9, const = constants.%.loc23 +// CHECK:STDOUT: %.loc24: f64 = real_literal 399999999999999999930e39999999999999999992, const = constants.%.loc24 // CHECK:STDOUT: %.loc25_3.1: (f64, f64, f64, f64, f64, f64, f64) = tuple_literal (%.loc18, %.loc19, %.loc20, %.loc21, %.loc22, %.loc23, %.loc24) // CHECK:STDOUT: %.loc25_3.2: i32 = int_literal 0 // CHECK:STDOUT: %.loc25_3.3: ref f64 = array_index %floats.var, %.loc25_3.2 diff --git a/toolchain/check/testdata/basics/parens.carbon b/toolchain/check/testdata/basics/parens.carbon index 4828016623a8..d2b856cfa37d 100644 --- a/toolchain/check/testdata/basics/parens.carbon +++ b/toolchain/check/testdata/basics/parens.carbon @@ -9,15 +9,20 @@ var b: i32 = ((2)); // CHECK:STDOUT: --- parens.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc7: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc8: i32 = int_literal 2, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.a = %a, .b = %b} // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %.loc7: i32 = int_literal 1 +// CHECK:STDOUT: %.loc7: i32 = int_literal 1, const = constants.%.loc7 // CHECK:STDOUT: assign %a.var, %.loc7 // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var -// CHECK:STDOUT: %.loc8: i32 = int_literal 2 +// CHECK:STDOUT: %.loc8: i32 = int_literal 2, const = constants.%.loc8 // CHECK:STDOUT: assign %b.var, %.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/basics/raw_and_textual_ir.carbon b/toolchain/check/testdata/basics/raw_and_textual_ir.carbon index 4f65be38f078..d28157afe82d 100644 --- a/toolchain/check/testdata/basics/raw_and_textual_ir.carbon +++ b/toolchain/check/testdata/basics/raw_and_textual_ir.carbon @@ -53,17 +53,28 @@ fn Foo(n: i32) -> (i32, i32, f64) { // CHECK:STDOUT: inst+9: {kind: FunctionDecl, arg0: function0, type: type6} // CHECK:STDOUT: inst+10: {kind: NameRef, arg0: name1, arg1: inst+2, type: type1} // CHECK:STDOUT: inst+11: {kind: IntLiteral, arg0: int4, type: type1} -// CHECK:STDOUT: inst+12: {kind: RealLiteral, arg0: real0, type: type3} -// CHECK:STDOUT: inst+13: {kind: TupleLiteral, arg0: block6, type: type4} -// CHECK:STDOUT: inst+14: {kind: TupleAccess, arg0: inst+7, arg1: element0, type: type1} -// CHECK:STDOUT: inst+15: {kind: InitializeFrom, arg0: inst+10, arg1: inst+14, type: type1} -// CHECK:STDOUT: inst+16: {kind: TupleAccess, arg0: inst+7, arg1: element1, type: type1} -// CHECK:STDOUT: inst+17: {kind: InitializeFrom, arg0: inst+11, arg1: inst+16, type: type1} -// CHECK:STDOUT: inst+18: {kind: TupleAccess, arg0: inst+7, arg1: element2, type: type3} -// CHECK:STDOUT: inst+19: {kind: InitializeFrom, arg0: inst+12, arg1: inst+18, type: type3} -// CHECK:STDOUT: inst+20: {kind: TupleInit, arg0: block7, arg1: inst+7, type: type4} -// CHECK:STDOUT: inst+21: {kind: Converted, arg0: inst+13, arg1: inst+20, type: type4} -// CHECK:STDOUT: inst+22: {kind: ReturnExpr, arg0: inst+21} +// CHECK:STDOUT: inst+12: {kind: IntLiteral, arg0: int4, type: type1} +// CHECK:STDOUT: inst+13: {kind: RealLiteral, arg0: real0, type: type3} +// CHECK:STDOUT: inst+14: {kind: RealLiteral, arg0: real0, type: type3} +// CHECK:STDOUT: inst+15: {kind: TupleLiteral, arg0: block6, type: type4} +// CHECK:STDOUT: inst+16: {kind: TupleAccess, arg0: inst+7, arg1: element0, type: type1} +// CHECK:STDOUT: inst+17: {kind: InitializeFrom, arg0: inst+10, arg1: inst+16, type: type1} +// CHECK:STDOUT: inst+18: {kind: TupleAccess, arg0: inst+7, arg1: element1, type: type1} +// CHECK:STDOUT: inst+19: {kind: InitializeFrom, arg0: inst+11, arg1: inst+18, type: type1} +// CHECK:STDOUT: inst+20: {kind: TupleAccess, arg0: inst+7, arg1: element2, type: type3} +// CHECK:STDOUT: inst+21: {kind: InitializeFrom, arg0: inst+13, arg1: inst+20, type: type3} +// CHECK:STDOUT: inst+22: {kind: TupleInit, arg0: block7, arg1: inst+7, type: type4} +// CHECK:STDOUT: inst+23: {kind: Converted, arg0: inst+15, arg1: inst+22, type: type4} +// CHECK:STDOUT: inst+24: {kind: ReturnExpr, arg0: inst+23} +// CHECK:STDOUT: constant_values: +// CHECK:STDOUT: inst+3: inst+3 +// CHECK:STDOUT: inst+5: inst+5 +// CHECK:STDOUT: inst+8: inst+8 +// CHECK:STDOUT: inst+9: inst+9 +// CHECK:STDOUT: inst+11: inst+12 +// CHECK:STDOUT: inst+12: inst+12 +// CHECK:STDOUT: inst+13: inst+14 +// CHECK:STDOUT: inst+14: inst+14 // CHECK:STDOUT: inst_blocks: // CHECK:STDOUT: empty: {} // CHECK:STDOUT: exports: @@ -83,25 +94,25 @@ fn Foo(n: i32) -> (i32, i32, f64) { // CHECK:STDOUT: block5: // CHECK:STDOUT: 0: inst+10 // CHECK:STDOUT: 1: inst+11 -// CHECK:STDOUT: 2: inst+12 -// CHECK:STDOUT: 3: inst+13 -// CHECK:STDOUT: 4: inst+14 -// CHECK:STDOUT: 5: inst+15 -// CHECK:STDOUT: 6: inst+16 -// CHECK:STDOUT: 7: inst+17 -// CHECK:STDOUT: 8: inst+18 -// CHECK:STDOUT: 9: inst+19 -// CHECK:STDOUT: 10: inst+20 -// CHECK:STDOUT: 11: inst+21 -// CHECK:STDOUT: 12: inst+22 +// CHECK:STDOUT: 2: inst+13 +// CHECK:STDOUT: 3: inst+15 +// CHECK:STDOUT: 4: inst+16 +// CHECK:STDOUT: 5: inst+17 +// CHECK:STDOUT: 6: inst+18 +// CHECK:STDOUT: 7: inst+19 +// CHECK:STDOUT: 8: inst+20 +// CHECK:STDOUT: 9: inst+21 +// CHECK:STDOUT: 10: inst+22 +// CHECK:STDOUT: 11: inst+23 +// CHECK:STDOUT: 12: inst+24 // CHECK:STDOUT: block6: // CHECK:STDOUT: 0: inst+10 // CHECK:STDOUT: 1: inst+11 -// CHECK:STDOUT: 2: inst+12 +// CHECK:STDOUT: 2: inst+13 // CHECK:STDOUT: block7: -// CHECK:STDOUT: 0: inst+15 -// CHECK:STDOUT: 1: inst+17 -// CHECK:STDOUT: 2: inst+19 +// CHECK:STDOUT: 0: inst+17 +// CHECK:STDOUT: 1: inst+19 +// CHECK:STDOUT: 2: inst+21 // CHECK:STDOUT: block8: // CHECK:STDOUT: 0: inst+0 // CHECK:STDOUT: 1: inst+9 @@ -110,21 +121,23 @@ fn Foo(n: i32) -> (i32, i32, f64) { // CHECK:STDOUT: --- raw_and_textual_ir.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc11_33.1: type = tuple_type (type, type, type) -// CHECK:STDOUT: %.loc11_33.2: type = tuple_type (i32, i32, f64) -// CHECK:STDOUT: %.loc11_33.3: type = ptr_type (i32, i32, f64) +// CHECK:STDOUT: %.loc11_33.1: type = tuple_type (type, type, type), const +// CHECK:STDOUT: %.loc11_33.2: type = tuple_type (i32, i32, f64), const +// CHECK:STDOUT: %.loc11_33.3: type = ptr_type (i32, i32, f64), const +// CHECK:STDOUT: %.loc12_14: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc12_17: f64 = real_literal 34e-1, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Foo = %Foo} -// CHECK:STDOUT: %Foo: = fn_decl @Foo +// CHECK:STDOUT: %Foo: = fn_decl @Foo, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%n: i32) -> %return: (i32, i32, f64) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: i32 = name_ref n, %n -// CHECK:STDOUT: %.loc12_14: i32 = int_literal 2 -// CHECK:STDOUT: %.loc12_17: f64 = real_literal 34e-1 +// CHECK:STDOUT: %.loc12_14: i32 = int_literal 2, const = constants.%.loc12_14 +// CHECK:STDOUT: %.loc12_17: f64 = real_literal 34e-1, const = constants.%.loc12_17 // CHECK:STDOUT: %.loc12_20.1: (i32, i32, f64) = tuple_literal (%n.ref, %.loc12_14, %.loc12_17) // CHECK:STDOUT: %.loc12_20.2: ref i32 = tuple_access %return, element0 // CHECK:STDOUT: %.loc12_20.3: init i32 = initialize_from %n.ref to %.loc12_20.2 diff --git a/toolchain/check/testdata/basics/raw_identifier.carbon b/toolchain/check/testdata/basics/raw_identifier.carbon index f67d587bce01..e7ea0a4b61ef 100644 --- a/toolchain/check/testdata/basics/raw_identifier.carbon +++ b/toolchain/check/testdata/basics/raw_identifier.carbon @@ -24,9 +24,9 @@ fn C(r#if: i32) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %A, .B = %B, .C = %C} -// CHECK:STDOUT: %A: = fn_decl @A -// CHECK:STDOUT: %B: = fn_decl @B -// CHECK:STDOUT: %C: = fn_decl @C +// CHECK:STDOUT: %A: = fn_decl @A, const +// CHECK:STDOUT: %B: = fn_decl @B, const +// CHECK:STDOUT: %C: = fn_decl @C, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(%n: i32) -> i32 { diff --git a/toolchain/check/testdata/basics/raw_ir.carbon b/toolchain/check/testdata/basics/raw_ir.carbon index d6ad53f3f3d2..fe628607ecd7 100644 --- a/toolchain/check/testdata/basics/raw_ir.carbon +++ b/toolchain/check/testdata/basics/raw_ir.carbon @@ -53,17 +53,28 @@ fn Foo(n: i32) -> (i32, i32, f64) { // CHECK:STDOUT: inst+9: {kind: FunctionDecl, arg0: function0, type: type6} // CHECK:STDOUT: inst+10: {kind: NameRef, arg0: name1, arg1: inst+2, type: type1} // CHECK:STDOUT: inst+11: {kind: IntLiteral, arg0: int4, type: type1} -// CHECK:STDOUT: inst+12: {kind: RealLiteral, arg0: real0, type: type3} -// CHECK:STDOUT: inst+13: {kind: TupleLiteral, arg0: block6, type: type4} -// CHECK:STDOUT: inst+14: {kind: TupleAccess, arg0: inst+7, arg1: element0, type: type1} -// CHECK:STDOUT: inst+15: {kind: InitializeFrom, arg0: inst+10, arg1: inst+14, type: type1} -// CHECK:STDOUT: inst+16: {kind: TupleAccess, arg0: inst+7, arg1: element1, type: type1} -// CHECK:STDOUT: inst+17: {kind: InitializeFrom, arg0: inst+11, arg1: inst+16, type: type1} -// CHECK:STDOUT: inst+18: {kind: TupleAccess, arg0: inst+7, arg1: element2, type: type3} -// CHECK:STDOUT: inst+19: {kind: InitializeFrom, arg0: inst+12, arg1: inst+18, type: type3} -// CHECK:STDOUT: inst+20: {kind: TupleInit, arg0: block7, arg1: inst+7, type: type4} -// CHECK:STDOUT: inst+21: {kind: Converted, arg0: inst+13, arg1: inst+20, type: type4} -// CHECK:STDOUT: inst+22: {kind: ReturnExpr, arg0: inst+21} +// CHECK:STDOUT: inst+12: {kind: IntLiteral, arg0: int4, type: type1} +// CHECK:STDOUT: inst+13: {kind: RealLiteral, arg0: real0, type: type3} +// CHECK:STDOUT: inst+14: {kind: RealLiteral, arg0: real0, type: type3} +// CHECK:STDOUT: inst+15: {kind: TupleLiteral, arg0: block6, type: type4} +// CHECK:STDOUT: inst+16: {kind: TupleAccess, arg0: inst+7, arg1: element0, type: type1} +// CHECK:STDOUT: inst+17: {kind: InitializeFrom, arg0: inst+10, arg1: inst+16, type: type1} +// CHECK:STDOUT: inst+18: {kind: TupleAccess, arg0: inst+7, arg1: element1, type: type1} +// CHECK:STDOUT: inst+19: {kind: InitializeFrom, arg0: inst+11, arg1: inst+18, type: type1} +// CHECK:STDOUT: inst+20: {kind: TupleAccess, arg0: inst+7, arg1: element2, type: type3} +// CHECK:STDOUT: inst+21: {kind: InitializeFrom, arg0: inst+13, arg1: inst+20, type: type3} +// CHECK:STDOUT: inst+22: {kind: TupleInit, arg0: block7, arg1: inst+7, type: type4} +// CHECK:STDOUT: inst+23: {kind: Converted, arg0: inst+15, arg1: inst+22, type: type4} +// CHECK:STDOUT: inst+24: {kind: ReturnExpr, arg0: inst+23} +// CHECK:STDOUT: constant_values: +// CHECK:STDOUT: inst+3: inst+3 +// CHECK:STDOUT: inst+5: inst+5 +// CHECK:STDOUT: inst+8: inst+8 +// CHECK:STDOUT: inst+9: inst+9 +// CHECK:STDOUT: inst+11: inst+12 +// CHECK:STDOUT: inst+12: inst+12 +// CHECK:STDOUT: inst+13: inst+14 +// CHECK:STDOUT: inst+14: inst+14 // CHECK:STDOUT: inst_blocks: // CHECK:STDOUT: empty: {} // CHECK:STDOUT: exports: @@ -83,25 +94,25 @@ fn Foo(n: i32) -> (i32, i32, f64) { // CHECK:STDOUT: block5: // CHECK:STDOUT: 0: inst+10 // CHECK:STDOUT: 1: inst+11 -// CHECK:STDOUT: 2: inst+12 -// CHECK:STDOUT: 3: inst+13 -// CHECK:STDOUT: 4: inst+14 -// CHECK:STDOUT: 5: inst+15 -// CHECK:STDOUT: 6: inst+16 -// CHECK:STDOUT: 7: inst+17 -// CHECK:STDOUT: 8: inst+18 -// CHECK:STDOUT: 9: inst+19 -// CHECK:STDOUT: 10: inst+20 -// CHECK:STDOUT: 11: inst+21 -// CHECK:STDOUT: 12: inst+22 +// CHECK:STDOUT: 2: inst+13 +// CHECK:STDOUT: 3: inst+15 +// CHECK:STDOUT: 4: inst+16 +// CHECK:STDOUT: 5: inst+17 +// CHECK:STDOUT: 6: inst+18 +// CHECK:STDOUT: 7: inst+19 +// CHECK:STDOUT: 8: inst+20 +// CHECK:STDOUT: 9: inst+21 +// CHECK:STDOUT: 10: inst+22 +// CHECK:STDOUT: 11: inst+23 +// CHECK:STDOUT: 12: inst+24 // CHECK:STDOUT: block6: // CHECK:STDOUT: 0: inst+10 // CHECK:STDOUT: 1: inst+11 -// CHECK:STDOUT: 2: inst+12 +// CHECK:STDOUT: 2: inst+13 // CHECK:STDOUT: block7: -// CHECK:STDOUT: 0: inst+15 -// CHECK:STDOUT: 1: inst+17 -// CHECK:STDOUT: 2: inst+19 +// CHECK:STDOUT: 0: inst+17 +// CHECK:STDOUT: 1: inst+19 +// CHECK:STDOUT: 2: inst+21 // CHECK:STDOUT: block8: // CHECK:STDOUT: 0: inst+0 // CHECK:STDOUT: 1: inst+9 diff --git a/toolchain/check/testdata/basics/run.carbon b/toolchain/check/testdata/basics/run.carbon index 887483f78c28..2387eaf14c51 100644 --- a/toolchain/check/testdata/basics/run.carbon +++ b/toolchain/check/testdata/basics/run.carbon @@ -10,7 +10,7 @@ fn Run() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Run = %Run} -// CHECK:STDOUT: %Run: = fn_decl @Run +// CHECK:STDOUT: %Run: = fn_decl @Run, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { diff --git a/toolchain/check/testdata/basics/run_i32.carbon b/toolchain/check/testdata/basics/run_i32.carbon index a1342cf72493..a66857f4742f 100644 --- a/toolchain/check/testdata/basics/run_i32.carbon +++ b/toolchain/check/testdata/basics/run_i32.carbon @@ -8,14 +8,18 @@ fn Run() -> i32 { return 0; } // CHECK:STDOUT: --- run_i32.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc7: i32 = int_literal 0, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Run = %Run} -// CHECK:STDOUT: %Run: = fn_decl @Run +// CHECK:STDOUT: %Run: = fn_decl @Run, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: i32 = int_literal 0 +// CHECK:STDOUT: %.loc7: i32 = int_literal 0, const = constants.%.loc7 // CHECK:STDOUT: return %.loc7 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/basics/textual_ir.carbon b/toolchain/check/testdata/basics/textual_ir.carbon index ccc9a0820a2c..790b12ea1c10 100644 --- a/toolchain/check/testdata/basics/textual_ir.carbon +++ b/toolchain/check/testdata/basics/textual_ir.carbon @@ -15,21 +15,23 @@ fn Foo(n: i32) -> (i32, i32, f64) { // CHECK:STDOUT: --- textual_ir.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc11_33.1: type = tuple_type (type, type, type) -// CHECK:STDOUT: %.loc11_33.2: type = tuple_type (i32, i32, f64) -// CHECK:STDOUT: %.loc11_33.3: type = ptr_type (i32, i32, f64) +// CHECK:STDOUT: %.loc11_33.1: type = tuple_type (type, type, type), const +// CHECK:STDOUT: %.loc11_33.2: type = tuple_type (i32, i32, f64), const +// CHECK:STDOUT: %.loc11_33.3: type = ptr_type (i32, i32, f64), const +// CHECK:STDOUT: %.loc12_14: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc12_17: f64 = real_literal 34e-1, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Foo = %Foo} -// CHECK:STDOUT: %Foo: = fn_decl @Foo +// CHECK:STDOUT: %Foo: = fn_decl @Foo, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%n: i32) -> %return: (i32, i32, f64) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: i32 = name_ref n, %n -// CHECK:STDOUT: %.loc12_14: i32 = int_literal 2 -// CHECK:STDOUT: %.loc12_17: f64 = real_literal 34e-1 +// CHECK:STDOUT: %.loc12_14: i32 = int_literal 2, const = constants.%.loc12_14 +// CHECK:STDOUT: %.loc12_17: f64 = real_literal 34e-1, const = constants.%.loc12_17 // CHECK:STDOUT: %.loc12_20.1: (i32, i32, f64) = tuple_literal (%n.ref, %.loc12_14, %.loc12_17) // CHECK:STDOUT: %.loc12_20.2: ref i32 = tuple_access %return, element0 // CHECK:STDOUT: %.loc12_20.3: init i32 = initialize_from %n.ref to %.loc12_20.2 diff --git a/toolchain/check/testdata/class/base.carbon b/toolchain/check/testdata/class/base.carbon index af33729dae97..ba7a6d43059b 100644 --- a/toolchain/check/testdata/class/base.carbon +++ b/toolchain/check/testdata/class/base.carbon @@ -25,44 +25,46 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: --- base.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc9: type = struct_type {.b: i32} -// CHECK:STDOUT: %.loc7: type = ptr_type {.b: i32} -// CHECK:STDOUT: %.loc15_1.1: type = struct_type {.base: Base, .d: i32} -// CHECK:STDOUT: %.loc15_1.2: type = struct_type {.base: {.b: i32}*, .d: i32} -// CHECK:STDOUT: %.loc15_1.3: type = ptr_type {.base: {.b: i32}*, .d: i32} -// CHECK:STDOUT: %.loc11: type = ptr_type {.base: Base, .d: i32} -// CHECK:STDOUT: %.loc18: type = struct_type {.base: {.b: i32}, .d: i32} -// CHECK:STDOUT: %.loc21_35.1: type = tuple_type (type, type) -// CHECK:STDOUT: %.loc21_35.2: type = tuple_type (i32, i32) -// CHECK:STDOUT: %.loc21_35.3: type = ptr_type (i32, i32) +// CHECK:STDOUT: %.loc9: type = struct_type {.b: i32}, const +// CHECK:STDOUT: %.loc7: type = ptr_type {.b: i32}, const +// CHECK:STDOUT: %.loc15_1.1: type = struct_type {.base: Base, .d: i32}, const +// CHECK:STDOUT: %.loc15_1.2: type = struct_type {.base: {.b: i32}*, .d: i32}, const +// CHECK:STDOUT: %.loc15_1.3: type = ptr_type {.base: {.b: i32}*, .d: i32}, const +// CHECK:STDOUT: %.loc11: type = ptr_type {.base: Base, .d: i32}, const +// CHECK:STDOUT: %.loc18_25: i32 = int_literal 4, const +// CHECK:STDOUT: %.loc18_34: i32 = int_literal 7, const +// CHECK:STDOUT: %.loc18_35: type = struct_type {.base: {.b: i32}, .d: i32}, const +// CHECK:STDOUT: %.loc21_35.1: type = tuple_type (type, type), const +// CHECK:STDOUT: %.loc21_35.2: type = tuple_type (i32, i32), const +// CHECK:STDOUT: %.loc21_35.3: type = ptr_type (i32, i32), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Base = %Base.decl, .Derived = %Derived.decl, .Make = %Make, .Access = %Access} // CHECK:STDOUT: %Base.decl = class_decl @Base, () -// CHECK:STDOUT: %Base: type = class_type @Base +// CHECK:STDOUT: %Base: type = class_type @Base, const // CHECK:STDOUT: %Derived.decl = class_decl @Derived, () -// CHECK:STDOUT: %Derived: type = class_type @Derived -// CHECK:STDOUT: %Make: = fn_decl @Make -// CHECK:STDOUT: %Access: = fn_decl @Access +// CHECK:STDOUT: %Derived: type = class_type @Derived, const +// CHECK:STDOUT: %Make: = fn_decl @Make, const +// CHECK:STDOUT: %Access: = fn_decl @Access, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Base, i32 -// CHECK:STDOUT: %.loc8_8.2: = field_decl b, element0 -// CHECK:STDOUT: %b: = bind_name b, %.loc8_8.2 +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Base, i32, const +// CHECK:STDOUT: %.loc8_8.2: = field_decl b, element0, const +// CHECK:STDOUT: %b: = bind_name b, %.loc8_8.2, const = %.loc8_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .b = %b // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { -// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base -// CHECK:STDOUT: %.loc12_20.1: type = unbound_element_type Derived, Base -// CHECK:STDOUT: %.loc12_20.2: = base_decl Base, element0 -// CHECK:STDOUT: %.loc14_8.1: type = unbound_element_type Derived, i32 -// CHECK:STDOUT: %.loc14_8.2: = field_decl d, element1 -// CHECK:STDOUT: %d: = bind_name d, %.loc14_8.2 +// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base, const = file.%Base +// CHECK:STDOUT: %.loc12_20.1: type = unbound_element_type Derived, Base, const +// CHECK:STDOUT: %.loc12_20.2: = base_decl Base, element0, const +// CHECK:STDOUT: %.loc14_8.1: type = unbound_element_type Derived, i32, const +// CHECK:STDOUT: %.loc14_8.2: = field_decl d, element1, const +// CHECK:STDOUT: %d: = bind_name d, %.loc14_8.2, const = %.loc14_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc12_20.2 @@ -72,9 +74,9 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Make() -> %return: Derived { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc18_25: i32 = int_literal 4 +// CHECK:STDOUT: %.loc18_25: i32 = int_literal 4, const = constants.%.loc18_25 // CHECK:STDOUT: %.loc18_26.1: {.b: i32} = struct_literal (%.loc18_25) -// CHECK:STDOUT: %.loc18_34: i32 = int_literal 7 +// CHECK:STDOUT: %.loc18_34: i32 = int_literal 7, const = constants.%.loc18_34 // CHECK:STDOUT: %.loc18_35.1: {.base: {.b: i32}, .d: i32} = struct_literal (%.loc18_26.1, %.loc18_34) // CHECK:STDOUT: %.loc18_35.2: ref Base = class_element_access %return, element0 // CHECK:STDOUT: %.loc18_26.2: ref i32 = class_element_access %.loc18_35.2, element0 diff --git a/toolchain/check/testdata/class/base_field.carbon b/toolchain/check/testdata/class/base_field.carbon index 583a32cac4eb..70e3b00f5e67 100644 --- a/toolchain/check/testdata/class/base_field.carbon +++ b/toolchain/check/testdata/class/base_field.carbon @@ -24,33 +24,33 @@ fn Access(p: Derived*) -> i32* { // CHECK:STDOUT: --- base_field.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc11_1.1: type = struct_type {.a: i32, .b: i32, .c: i32} -// CHECK:STDOUT: %.loc11_1.2: type = ptr_type {.a: i32, .b: i32, .c: i32} -// CHECK:STDOUT: %.loc18_1.1: type = struct_type {.base: Base, .d: i32, .e: i32} -// CHECK:STDOUT: %.loc18_1.2: type = struct_type {.base: {.a: i32, .b: i32, .c: i32}*, .d: i32, .e: i32} -// CHECK:STDOUT: %.loc18_1.3: type = ptr_type {.base: {.a: i32, .b: i32, .c: i32}*, .d: i32, .e: i32} -// CHECK:STDOUT: %.loc13: type = ptr_type {.base: Base, .d: i32, .e: i32} +// CHECK:STDOUT: %.loc11_1.1: type = struct_type {.a: i32, .b: i32, .c: i32}, const +// CHECK:STDOUT: %.loc11_1.2: type = ptr_type {.a: i32, .b: i32, .c: i32}, const +// CHECK:STDOUT: %.loc18_1.1: type = struct_type {.base: Base, .d: i32, .e: i32}, const +// CHECK:STDOUT: %.loc18_1.2: type = struct_type {.base: {.a: i32, .b: i32, .c: i32}*, .d: i32, .e: i32}, const +// CHECK:STDOUT: %.loc18_1.3: type = ptr_type {.base: {.a: i32, .b: i32, .c: i32}*, .d: i32, .e: i32}, const +// CHECK:STDOUT: %.loc13: type = ptr_type {.base: Base, .d: i32, .e: i32}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Base = %Base.decl, .Derived = %Derived.decl, .Access = %Access} // CHECK:STDOUT: %Base.decl = class_decl @Base, () -// CHECK:STDOUT: %Base: type = class_type @Base +// CHECK:STDOUT: %Base: type = class_type @Base, const // CHECK:STDOUT: %Derived.decl = class_decl @Derived, () -// CHECK:STDOUT: %Derived: type = class_type @Derived -// CHECK:STDOUT: %Access: = fn_decl @Access +// CHECK:STDOUT: %Derived: type = class_type @Derived, const +// CHECK:STDOUT: %Access: = fn_decl @Access, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Base, i32 -// CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0 -// CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2 -// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Base, i32 -// CHECK:STDOUT: %.loc9_8.2: = field_decl b, element1 -// CHECK:STDOUT: %b: = bind_name b, %.loc9_8.2 -// CHECK:STDOUT: %.loc10_8.1: type = unbound_element_type Base, i32 -// CHECK:STDOUT: %.loc10_8.2: = field_decl c, element2 -// CHECK:STDOUT: %c: = bind_name c, %.loc10_8.2 +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Base, i32, const +// CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0, const +// CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2, const = %.loc8_8.2 +// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Base, i32, const +// CHECK:STDOUT: %.loc9_8.2: = field_decl b, element1, const +// CHECK:STDOUT: %b: = bind_name b, %.loc9_8.2, const = %.loc9_8.2 +// CHECK:STDOUT: %.loc10_8.1: type = unbound_element_type Base, i32, const +// CHECK:STDOUT: %.loc10_8.2: = field_decl c, element2, const +// CHECK:STDOUT: %c: = bind_name c, %.loc10_8.2, const = %.loc10_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .a = %a @@ -59,15 +59,15 @@ fn Access(p: Derived*) -> i32* { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { -// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base -// CHECK:STDOUT: %.loc14_20.1: type = unbound_element_type Derived, Base -// CHECK:STDOUT: %.loc14_20.2: = base_decl Base, element0 -// CHECK:STDOUT: %.loc16_8.1: type = unbound_element_type Derived, i32 -// CHECK:STDOUT: %.loc16_8.2: = field_decl d, element1 -// CHECK:STDOUT: %d: = bind_name d, %.loc16_8.2 -// CHECK:STDOUT: %.loc17_8.1: type = unbound_element_type Derived, i32 -// CHECK:STDOUT: %.loc17_8.2: = field_decl e, element2 -// CHECK:STDOUT: %e: = bind_name e, %.loc17_8.2 +// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base, const = file.%Base +// CHECK:STDOUT: %.loc14_20.1: type = unbound_element_type Derived, Base, const +// CHECK:STDOUT: %.loc14_20.2: = base_decl Base, element0, const +// CHECK:STDOUT: %.loc16_8.1: type = unbound_element_type Derived, i32, const +// CHECK:STDOUT: %.loc16_8.2: = field_decl d, element1, const +// CHECK:STDOUT: %d: = bind_name d, %.loc16_8.2, const = %.loc16_8.2 +// CHECK:STDOUT: %.loc17_8.1: type = unbound_element_type Derived, i32, const +// CHECK:STDOUT: %.loc17_8.2: = field_decl e, element2, const +// CHECK:STDOUT: %e: = bind_name e, %.loc17_8.2, const = %.loc17_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc14_20.2 diff --git a/toolchain/check/testdata/class/base_function_unqualified.carbon b/toolchain/check/testdata/class/base_function_unqualified.carbon index 9000387767c7..1e2e432a049c 100644 --- a/toolchain/check/testdata/class/base_function_unqualified.carbon +++ b/toolchain/check/testdata/class/base_function_unqualified.carbon @@ -22,34 +22,34 @@ fn Derived.H() { // CHECK:STDOUT: --- base_function_unqualified.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc9_1.1: type = struct_type {} -// CHECK:STDOUT: %.loc9_1.2: type = tuple_type () -// CHECK:STDOUT: %.loc7: type = ptr_type {} -// CHECK:STDOUT: %.loc16: type = struct_type {.base: Base} +// CHECK:STDOUT: %.loc9_1.1: type = struct_type {}, const +// CHECK:STDOUT: %.loc9_1.2: type = tuple_type (), const +// CHECK:STDOUT: %.loc7: type = ptr_type {}, const +// CHECK:STDOUT: %.loc16: type = struct_type {.base: Base}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Base = %Base.decl, .Derived = %Derived.decl} // CHECK:STDOUT: %Base.decl = class_decl @Base, () -// CHECK:STDOUT: %Base: type = class_type @Base +// CHECK:STDOUT: %Base: type = class_type @Base, const // CHECK:STDOUT: %Derived.decl = class_decl @Derived, () -// CHECK:STDOUT: %Derived: type = class_type @Derived -// CHECK:STDOUT: %H: = fn_decl @H +// CHECK:STDOUT: %Derived: type = class_type @Derived, const +// CHECK:STDOUT: %H: = fn_decl @H, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { -// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base -// CHECK:STDOUT: %.loc12_20.1: type = unbound_element_type Derived, Base -// CHECK:STDOUT: %.loc12_20.2: = base_decl Base, element0 -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %H: = fn_decl @H +// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base, const = file.%Base +// CHECK:STDOUT: %.loc12_20.1: type = unbound_element_type Derived, Base, const +// CHECK:STDOUT: %.loc12_20.2: = base_decl Base, element0, const +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %H: = fn_decl @H, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc12_20.2 @@ -62,14 +62,14 @@ fn Derived.H() { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, @Base.%F +// CHECK:STDOUT: %F.ref: = name_ref F, @Base.%F, const = @Base.%F // CHECK:STDOUT: %.loc14: init () = call %F.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @H() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, @Base.%F +// CHECK:STDOUT: %F.ref: = name_ref F, @Base.%F, const = @Base.%F // CHECK:STDOUT: %.loc19: init () = call %F.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/base_method.carbon b/toolchain/check/testdata/class/base_method.carbon index f17e03470f8a..9d508124df22 100644 --- a/toolchain/check/testdata/class/base_method.carbon +++ b/toolchain/check/testdata/class/base_method.carbon @@ -25,29 +25,30 @@ fn Call(p: Derived*) { // CHECK:STDOUT: --- base_method.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc11: type = struct_type {.a: i32} -// CHECK:STDOUT: %.loc7: type = ptr_type {.a: i32} -// CHECK:STDOUT: %.loc19_1.1: type = struct_type {.base: Base} -// CHECK:STDOUT: %.loc19_1.2: type = struct_type {.base: {.a: i32}*} -// CHECK:STDOUT: %.loc17: type = ptr_type {.base: Base} -// CHECK:STDOUT: %.loc22: type = tuple_type () +// CHECK:STDOUT: %.loc11: type = struct_type {.a: i32}, const +// CHECK:STDOUT: %.loc7: type = ptr_type {.a: i32}, const +// CHECK:STDOUT: %.loc14: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc19_1.1: type = struct_type {.base: Base}, const +// CHECK:STDOUT: %.loc19_1.2: type = struct_type {.base: {.a: i32}*}, const +// CHECK:STDOUT: %.loc17: type = ptr_type {.base: Base}, const +// CHECK:STDOUT: %.loc22: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Base = %Base.decl, .Derived = %Derived.decl, .Call = %Call} // CHECK:STDOUT: %Base.decl = class_decl @Base, () -// CHECK:STDOUT: %Base: type = class_type @Base -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %Base: type = class_type @Base, const +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: %Derived.decl = class_decl @Derived, () -// CHECK:STDOUT: %Derived: type = class_type @Derived -// CHECK:STDOUT: %Call: = fn_decl @Call +// CHECK:STDOUT: %Derived: type = class_type @Derived, const +// CHECK:STDOUT: %Call: = fn_decl @Call, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Base, i32 -// CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0 -// CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2 -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Base, i32, const +// CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0, const +// CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2, const = %.loc8_8.2 +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .a = %a @@ -55,9 +56,9 @@ fn Call(p: Derived*) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { -// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base -// CHECK:STDOUT: %.loc18_20.1: type = unbound_element_type Derived, Base -// CHECK:STDOUT: %.loc18_20.2: = base_decl Base, element0 +// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base, const = file.%Base +// CHECK:STDOUT: %.loc18_20.1: type = unbound_element_type Derived, Base, const +// CHECK:STDOUT: %.loc18_20.2: = base_decl Base, element0, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc18_20.2 @@ -69,7 +70,7 @@ fn Call(p: Derived*) { // CHECK:STDOUT: %self.ref: Base* = name_ref self, %self // CHECK:STDOUT: %.loc14_4: ref Base = deref %self.ref // CHECK:STDOUT: %.loc14_10: ref i32 = class_element_access %.loc14_4, element0 -// CHECK:STDOUT: %.loc14_15: i32 = int_literal 1 +// CHECK:STDOUT: %.loc14_15: i32 = int_literal 1, const = constants.%.loc14 // CHECK:STDOUT: assign %.loc14_10, %.loc14_15 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/base_method_shadow.carbon b/toolchain/check/testdata/class/base_method_shadow.carbon index bffcda3f8886..39747fd8869c 100644 --- a/toolchain/check/testdata/class/base_method_shadow.carbon +++ b/toolchain/check/testdata/class/base_method_shadow.carbon @@ -32,42 +32,42 @@ fn Call(a: A*, b: B*, c: C*, d: D*) { // CHECK:STDOUT: --- base_method_shadow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc9_1.1: type = struct_type {} -// CHECK:STDOUT: %.loc9_1.2: type = tuple_type () -// CHECK:STDOUT: %.loc7: type = ptr_type {} -// CHECK:STDOUT: %.loc14_1.1: type = struct_type {.base: A} -// CHECK:STDOUT: %.loc14_1.2: type = struct_type {.base: {}*} -// CHECK:STDOUT: %.loc11: type = ptr_type {.base: A} -// CHECK:STDOUT: %.loc19_1.1: type = struct_type {.base: B} -// CHECK:STDOUT: %.loc19_1.2: type = struct_type {.base: {.base: A}*} -// CHECK:STDOUT: %.loc16: type = ptr_type {.base: B} +// CHECK:STDOUT: %.loc9_1.1: type = struct_type {}, const +// CHECK:STDOUT: %.loc9_1.2: type = tuple_type (), const +// CHECK:STDOUT: %.loc7: type = ptr_type {}, const +// CHECK:STDOUT: %.loc14_1.1: type = struct_type {.base: A}, const +// CHECK:STDOUT: %.loc14_1.2: type = struct_type {.base: {}*}, const +// CHECK:STDOUT: %.loc11: type = ptr_type {.base: A}, const +// CHECK:STDOUT: %.loc19_1.1: type = struct_type {.base: B}, const +// CHECK:STDOUT: %.loc19_1.2: type = struct_type {.base: {.base: A}*}, const +// CHECK:STDOUT: %.loc16: type = ptr_type {.base: B}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %A.decl, .B = %B.decl, .C = %C.decl, .D = %D.decl, .Call = %Call} // CHECK:STDOUT: %A.decl = class_decl @A, () -// CHECK:STDOUT: %A: type = class_type @A +// CHECK:STDOUT: %A: type = class_type @A, const // CHECK:STDOUT: %B.decl = class_decl @B, () -// CHECK:STDOUT: %B: type = class_type @B +// CHECK:STDOUT: %B: type = class_type @B, const // CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C +// CHECK:STDOUT: %C: type = class_type @C, const // CHECK:STDOUT: %D.decl = class_decl @D, () -// CHECK:STDOUT: %D: type = class_type @D -// CHECK:STDOUT: %Call: = fn_decl @Call +// CHECK:STDOUT: %D: type = class_type @D, const +// CHECK:STDOUT: %Call: = fn_decl @Call, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { -// CHECK:STDOUT: %F: = fn_decl @F.1 +// CHECK:STDOUT: %F: = fn_decl @F.1, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { -// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A -// CHECK:STDOUT: %.loc12_17.1: type = unbound_element_type B, A -// CHECK:STDOUT: %.loc12_17.2: = base_decl A, element0 -// CHECK:STDOUT: %F: = fn_decl @F.2 +// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A, const = file.%A +// CHECK:STDOUT: %.loc12_17.1: type = unbound_element_type B, A, const +// CHECK:STDOUT: %.loc12_17.2: = base_decl A, element0, const +// CHECK:STDOUT: %F: = fn_decl @F.2, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc12_17.2 @@ -76,10 +76,10 @@ fn Call(a: A*, b: B*, c: C*, d: D*) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B -// CHECK:STDOUT: %.loc17_17.1: type = unbound_element_type C, B -// CHECK:STDOUT: %.loc17_17.2: = base_decl B, element0 -// CHECK:STDOUT: %F: = fn_decl @F.3 +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B, const = file.%B +// CHECK:STDOUT: %.loc17_17.1: type = unbound_element_type C, B, const +// CHECK:STDOUT: %.loc17_17.2: = base_decl B, element0, const +// CHECK:STDOUT: %F: = fn_decl @F.3, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc17_17.2 @@ -88,9 +88,9 @@ fn Call(a: A*, b: B*, c: C*, d: D*) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @D { -// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B -// CHECK:STDOUT: %.loc22_17.1: type = unbound_element_type D, B -// CHECK:STDOUT: %.loc22_17.2: = base_decl B, element0 +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B, const = file.%B +// CHECK:STDOUT: %.loc22_17.1: type = unbound_element_type D, B, const +// CHECK:STDOUT: %.loc22_17.2: = base_decl B, element0, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc22_17.2 diff --git a/toolchain/check/testdata/class/basic.carbon b/toolchain/check/testdata/class/basic.carbon index c8b43def6466..1c298f48cd0c 100644 --- a/toolchain/check/testdata/class/basic.carbon +++ b/toolchain/check/testdata/class/basic.carbon @@ -25,23 +25,24 @@ fn Run() -> i32 { // CHECK:STDOUT: --- basic.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc15: type = struct_type {.k: i32} +// CHECK:STDOUT: %.loc15: type = struct_type {.k: i32}, const +// CHECK:STDOUT: %.loc22: i32 = int_literal 4, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .Run = %Run} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %Run: = fn_decl @Run +// CHECK:STDOUT: %Class: type = class_type @Class, const +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %Run: = fn_decl @Run, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %.loc14_8.1: type = unbound_element_type Class, i32 -// CHECK:STDOUT: %.loc14_8.2: = field_decl k, element0 -// CHECK:STDOUT: %k: = bind_name k, %.loc14_8.2 +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %.loc14_8.1: type = unbound_element_type Class, i32, const +// CHECK:STDOUT: %.loc14_8.2: = field_decl k, element0, const +// CHECK:STDOUT: %k: = bind_name k, %.loc14_8.2, const = %.loc14_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F @@ -63,9 +64,9 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class -// CHECK:STDOUT: %F.ref: = name_ref F, @Class.%F -// CHECK:STDOUT: %.loc22_18: i32 = int_literal 4 +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class, const = file.%Class +// CHECK:STDOUT: %F.ref: = name_ref F, @Class.%F, const = @Class.%F +// CHECK:STDOUT: %.loc22_18: i32 = int_literal 4, const = constants.%.loc22 // CHECK:STDOUT: %.loc22_17: init i32 = call %F.ref(%.loc22_18) // CHECK:STDOUT: %.loc22_20.1: i32 = value_of_initializer %.loc22_17 // CHECK:STDOUT: %.loc22_20.2: i32 = converted %.loc22_17, %.loc22_20.1 diff --git a/toolchain/check/testdata/class/derived_to_base.carbon b/toolchain/check/testdata/class/derived_to_base.carbon index 47a5bfd6b402..245f5a6599a1 100644 --- a/toolchain/check/testdata/class/derived_to_base.carbon +++ b/toolchain/check/testdata/class/derived_to_base.carbon @@ -37,52 +37,55 @@ fn ConvertInit() { // CHECK:STDOUT: --- derived_to_base.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc9: type = struct_type {.a: i32} -// CHECK:STDOUT: %.loc7: type = ptr_type {.a: i32} -// CHECK:STDOUT: %.loc14_1.1: type = struct_type {.base: A, .b: i32} -// CHECK:STDOUT: %.loc14_1.2: type = struct_type {.base: {.a: i32}*, .b: i32} -// CHECK:STDOUT: %.loc14_1.3: type = ptr_type {.base: {.a: i32}*, .b: i32} -// CHECK:STDOUT: %.loc11: type = ptr_type {.base: A, .b: i32} -// CHECK:STDOUT: %.loc19_1.1: type = struct_type {.base: B, .c: i32} -// CHECK:STDOUT: %.loc19_1.2: type = struct_type {.base: {.base: A, .b: i32}*, .c: i32} -// CHECK:STDOUT: %.loc19_1.3: type = ptr_type {.base: {.base: A, .b: i32}*, .c: i32} -// CHECK:STDOUT: %.loc16: type = ptr_type {.base: B, .c: i32} -// CHECK:STDOUT: %.loc34_48: type = struct_type {.base: {.a: i32}, .b: i32} -// CHECK:STDOUT: %.loc34_57: type = struct_type {.base: {.base: {.a: i32}, .b: i32}, .c: i32} +// CHECK:STDOUT: %.loc9: type = struct_type {.a: i32}, const +// CHECK:STDOUT: %.loc7: type = ptr_type {.a: i32}, const +// CHECK:STDOUT: %.loc14_1.1: type = struct_type {.base: A, .b: i32}, const +// CHECK:STDOUT: %.loc14_1.2: type = struct_type {.base: {.a: i32}*, .b: i32}, const +// CHECK:STDOUT: %.loc14_1.3: type = ptr_type {.base: {.a: i32}*, .b: i32}, const +// CHECK:STDOUT: %.loc11: type = ptr_type {.base: A, .b: i32}, const +// CHECK:STDOUT: %.loc19_1.1: type = struct_type {.base: B, .c: i32}, const +// CHECK:STDOUT: %.loc19_1.2: type = struct_type {.base: {.base: A, .b: i32}*, .c: i32}, const +// CHECK:STDOUT: %.loc19_1.3: type = ptr_type {.base: {.base: A, .b: i32}*, .c: i32}, const +// CHECK:STDOUT: %.loc16: type = ptr_type {.base: B, .c: i32}, const +// CHECK:STDOUT: %.loc34_38: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc34_47: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc34_48: type = struct_type {.base: {.a: i32}, .b: i32}, const +// CHECK:STDOUT: %.loc34_56: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc34_57: type = struct_type {.base: {.base: {.a: i32}, .b: i32}, .c: i32}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %A.decl, .B = %B.decl, .C = %C.decl, .ConvertCToB = %ConvertCToB, .ConvertBToA = %ConvertBToA, .ConvertCToA = %ConvertCToA, .ConvertValue = %ConvertValue, .ConvertRef = %ConvertRef, .ConvertInit = %ConvertInit} // CHECK:STDOUT: %A.decl = class_decl @A, () -// CHECK:STDOUT: %A: type = class_type @A +// CHECK:STDOUT: %A: type = class_type @A, const // CHECK:STDOUT: %B.decl = class_decl @B, () -// CHECK:STDOUT: %B: type = class_type @B +// CHECK:STDOUT: %B: type = class_type @B, const // CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C -// CHECK:STDOUT: %ConvertCToB: = fn_decl @ConvertCToB -// CHECK:STDOUT: %ConvertBToA: = fn_decl @ConvertBToA -// CHECK:STDOUT: %ConvertCToA: = fn_decl @ConvertCToA -// CHECK:STDOUT: %ConvertValue: = fn_decl @ConvertValue -// CHECK:STDOUT: %ConvertRef: = fn_decl @ConvertRef -// CHECK:STDOUT: %ConvertInit: = fn_decl @ConvertInit +// CHECK:STDOUT: %C: type = class_type @C, const +// CHECK:STDOUT: %ConvertCToB: = fn_decl @ConvertCToB, const +// CHECK:STDOUT: %ConvertBToA: = fn_decl @ConvertBToA, const +// CHECK:STDOUT: %ConvertCToA: = fn_decl @ConvertCToA, const +// CHECK:STDOUT: %ConvertValue: = fn_decl @ConvertValue, const +// CHECK:STDOUT: %ConvertRef: = fn_decl @ConvertRef, const +// CHECK:STDOUT: %ConvertInit: = fn_decl @ConvertInit, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type A, i32 -// CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0 -// CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2 +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type A, i32, const +// CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0, const +// CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2, const = %.loc8_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .a = %a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { -// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A -// CHECK:STDOUT: %.loc12_17.1: type = unbound_element_type B, A -// CHECK:STDOUT: %.loc12_17.2: = base_decl A, element0 -// CHECK:STDOUT: %.loc13_8.1: type = unbound_element_type B, i32 -// CHECK:STDOUT: %.loc13_8.2: = field_decl b, element1 -// CHECK:STDOUT: %b: = bind_name b, %.loc13_8.2 +// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A, const = file.%A +// CHECK:STDOUT: %.loc12_17.1: type = unbound_element_type B, A, const +// CHECK:STDOUT: %.loc12_17.2: = base_decl A, element0, const +// CHECK:STDOUT: %.loc13_8.1: type = unbound_element_type B, i32, const +// CHECK:STDOUT: %.loc13_8.2: = field_decl b, element1, const +// CHECK:STDOUT: %b: = bind_name b, %.loc13_8.2, const = %.loc13_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc12_17.2 @@ -91,12 +94,12 @@ fn ConvertInit() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B -// CHECK:STDOUT: %.loc17_17.1: type = unbound_element_type C, B -// CHECK:STDOUT: %.loc17_17.2: = base_decl B, element0 -// CHECK:STDOUT: %.loc18_8.1: type = unbound_element_type C, i32 -// CHECK:STDOUT: %.loc18_8.2: = field_decl c, element1 -// CHECK:STDOUT: %c: = bind_name c, %.loc18_8.2 +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B, const = file.%B +// CHECK:STDOUT: %.loc17_17.1: type = unbound_element_type C, B, const +// CHECK:STDOUT: %.loc17_17.2: = base_decl B, element0, const +// CHECK:STDOUT: %.loc18_8.1: type = unbound_element_type C, i32, const +// CHECK:STDOUT: %.loc18_8.2: = field_decl c, element1, const +// CHECK:STDOUT: %c: = bind_name c, %.loc18_8.2, const = %.loc18_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc17_17.2 @@ -137,7 +140,7 @@ fn ConvertInit() { // CHECK:STDOUT: // CHECK:STDOUT: fn @ConvertValue(%c: C) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A +// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A, const = file.%A // CHECK:STDOUT: %c.ref: C = name_ref c, %c // CHECK:STDOUT: %.loc26_15.1: ref B = class_element_access %c.ref, element0 // CHECK:STDOUT: %.loc26_15.2: ref A = class_element_access %.loc26_15.1, element0 @@ -151,7 +154,7 @@ fn ConvertInit() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref: C* = name_ref c, %c // CHECK:STDOUT: %.loc30_12: ref C = deref %c.ref -// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A +// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A, const = file.%A // CHECK:STDOUT: %.loc30_15.1: ref B = class_element_access %.loc30_12, element0 // CHECK:STDOUT: %.loc30_15.2: ref A = class_element_access %.loc30_15.1, element0 // CHECK:STDOUT: %.loc30_15.3: ref A = converted %.loc30_12, %.loc30_15.2 @@ -161,14 +164,14 @@ fn ConvertInit() { // CHECK:STDOUT: // CHECK:STDOUT: fn @ConvertInit() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A -// CHECK:STDOUT: %.loc34_38: i32 = int_literal 1 +// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A, const = file.%A +// CHECK:STDOUT: %.loc34_38: i32 = int_literal 1, const = constants.%.loc34_38 // CHECK:STDOUT: %.loc34_39.1: {.a: i32} = struct_literal (%.loc34_38) -// CHECK:STDOUT: %.loc34_47: i32 = int_literal 2 +// CHECK:STDOUT: %.loc34_47: i32 = int_literal 2, const = constants.%.loc34_47 // CHECK:STDOUT: %.loc34_48.1: {.base: {.a: i32}, .b: i32} = struct_literal (%.loc34_39.1, %.loc34_47) -// CHECK:STDOUT: %.loc34_56: i32 = int_literal 3 +// CHECK:STDOUT: %.loc34_56: i32 = int_literal 3, const = constants.%.loc34_56 // CHECK:STDOUT: %.loc34_57.1: {.base: {.base: {.a: i32}, .b: i32}, .c: i32} = struct_literal (%.loc34_48.1, %.loc34_56) -// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C +// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C, const = file.%C // CHECK:STDOUT: %.loc34_57.2: ref C = temporary_storage // CHECK:STDOUT: %.loc34_57.3: ref B = class_element_access %.loc34_57.2, element0 // CHECK:STDOUT: %.loc34_48.2: ref A = class_element_access %.loc34_57.3, element0 diff --git a/toolchain/check/testdata/class/fail_abstract.carbon b/toolchain/check/testdata/class/fail_abstract.carbon index acbf95fdf35d..9e0cb9ae4325 100644 --- a/toolchain/check/testdata/class/fail_abstract.carbon +++ b/toolchain/check/testdata/class/fail_abstract.carbon @@ -29,44 +29,46 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: --- fail_abstract.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc9: type = struct_type {.a: i32} -// CHECK:STDOUT: %.loc7: type = ptr_type {.a: i32} -// CHECK:STDOUT: %.loc15_1.1: type = struct_type {.base: Abstract, .d: i32} -// CHECK:STDOUT: %.loc15_1.2: type = struct_type {.base: {.a: i32}*, .d: i32} -// CHECK:STDOUT: %.loc15_1.3: type = ptr_type {.base: {.a: i32}*, .d: i32} -// CHECK:STDOUT: %.loc11: type = ptr_type {.base: Abstract, .d: i32} -// CHECK:STDOUT: %.loc22: type = struct_type {.base: {.a: i32}, .d: i32} -// CHECK:STDOUT: %.loc25_35.1: type = tuple_type (type, type) -// CHECK:STDOUT: %.loc25_35.2: type = tuple_type (i32, i32) -// CHECK:STDOUT: %.loc25_35.3: type = ptr_type (i32, i32) +// CHECK:STDOUT: %.loc9: type = struct_type {.a: i32}, const +// CHECK:STDOUT: %.loc7: type = ptr_type {.a: i32}, const +// CHECK:STDOUT: %.loc15_1.1: type = struct_type {.base: Abstract, .d: i32}, const +// CHECK:STDOUT: %.loc15_1.2: type = struct_type {.base: {.a: i32}*, .d: i32}, const +// CHECK:STDOUT: %.loc15_1.3: type = ptr_type {.base: {.a: i32}*, .d: i32}, const +// CHECK:STDOUT: %.loc11: type = ptr_type {.base: Abstract, .d: i32}, const +// CHECK:STDOUT: %.loc22_25: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc22_34: i32 = int_literal 7, const +// CHECK:STDOUT: %.loc22_35: type = struct_type {.base: {.a: i32}, .d: i32}, const +// CHECK:STDOUT: %.loc25_35.1: type = tuple_type (type, type), const +// CHECK:STDOUT: %.loc25_35.2: type = tuple_type (i32, i32), const +// CHECK:STDOUT: %.loc25_35.3: type = ptr_type (i32, i32), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Abstract = %Abstract.decl, .Derived = %Derived.decl, .Make = %Make, .Access = %Access} // CHECK:STDOUT: %Abstract.decl = class_decl @Abstract, () -// CHECK:STDOUT: %Abstract: type = class_type @Abstract +// CHECK:STDOUT: %Abstract: type = class_type @Abstract, const // CHECK:STDOUT: %Derived.decl = class_decl @Derived, () -// CHECK:STDOUT: %Derived: type = class_type @Derived -// CHECK:STDOUT: %Make: = fn_decl @Make -// CHECK:STDOUT: %Access: = fn_decl @Access +// CHECK:STDOUT: %Derived: type = class_type @Derived, const +// CHECK:STDOUT: %Make: = fn_decl @Make, const +// CHECK:STDOUT: %Access: = fn_decl @Access, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Abstract { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Abstract, i32 -// CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0 -// CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2 +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Abstract, i32, const +// CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0, const +// CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2, const = %.loc8_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .a = %a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { -// CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract -// CHECK:STDOUT: %.loc12_24.1: type = unbound_element_type Derived, Abstract -// CHECK:STDOUT: %.loc12_24.2: = base_decl Abstract, element0 -// CHECK:STDOUT: %.loc14_8.1: type = unbound_element_type Derived, i32 -// CHECK:STDOUT: %.loc14_8.2: = field_decl d, element1 -// CHECK:STDOUT: %d: = bind_name d, %.loc14_8.2 +// CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract, const = file.%Abstract +// CHECK:STDOUT: %.loc12_24.1: type = unbound_element_type Derived, Abstract, const +// CHECK:STDOUT: %.loc12_24.2: = base_decl Abstract, element0, const +// CHECK:STDOUT: %.loc14_8.1: type = unbound_element_type Derived, i32, const +// CHECK:STDOUT: %.loc14_8.2: = field_decl d, element1, const +// CHECK:STDOUT: %d: = bind_name d, %.loc14_8.2, const = %.loc14_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc12_24.2 @@ -76,9 +78,9 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Make() -> %return: Derived { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc22_25: i32 = int_literal 1 +// CHECK:STDOUT: %.loc22_25: i32 = int_literal 1, const = constants.%.loc22_25 // CHECK:STDOUT: %.loc22_26: {.a: i32} = struct_literal (%.loc22_25) -// CHECK:STDOUT: %.loc22_34: i32 = int_literal 7 +// CHECK:STDOUT: %.loc22_34: i32 = int_literal 7, const = constants.%.loc22_34 // CHECK:STDOUT: %.loc22_35: {.base: {.a: i32}, .d: i32} = struct_literal (%.loc22_26, %.loc22_34) // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_addr_not_self.carbon b/toolchain/check/testdata/class/fail_addr_not_self.carbon index f2f11a85cf95..6444f836b7db 100644 --- a/toolchain/check/testdata/class/fail_addr_not_self.carbon +++ b/toolchain/check/testdata/class/fail_addr_not_self.carbon @@ -19,18 +19,18 @@ class Class { // CHECK:STDOUT: --- fail_addr_not_self.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc17: type = struct_type {} +// CHECK:STDOUT: %.loc17: type = struct_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class +// CHECK:STDOUT: %Class: type = class_type @Class, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F diff --git a/toolchain/check/testdata/class/fail_addr_self.carbon b/toolchain/check/testdata/class/fail_addr_self.carbon index 9f277b00e210..aafe24e8ee36 100644 --- a/toolchain/check/testdata/class/fail_addr_self.carbon +++ b/toolchain/check/testdata/class/fail_addr_self.carbon @@ -41,21 +41,21 @@ fn F(c: Class, p: Class*) { // CHECK:STDOUT: --- fail_addr_self.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10_1.1: type = struct_type {} -// CHECK:STDOUT: %.loc10_1.2: type = tuple_type () -// CHECK:STDOUT: %.loc7: type = ptr_type {} +// CHECK:STDOUT: %.loc10_1.1: type = struct_type {}, const +// CHECK:STDOUT: %.loc10_1.2: type = tuple_type (), const +// CHECK:STDOUT: %.loc7: type = ptr_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .F = %F} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class -// CHECK:STDOUT: %F: = fn_decl @F.2 +// CHECK:STDOUT: %Class: type = class_type @Class, const +// CHECK:STDOUT: %F: = fn_decl @F.2, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F.1 -// CHECK:STDOUT: %G: = fn_decl @G +// CHECK:STDOUT: %F: = fn_decl @F.1, const +// CHECK:STDOUT: %G: = fn_decl @G, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F diff --git a/toolchain/check/testdata/class/fail_base_bad_type.carbon b/toolchain/check/testdata/class/fail_base_bad_type.carbon index 35ff30dbbcd4..8ec99642371d 100644 --- a/toolchain/check/testdata/class/fail_base_bad_type.carbon +++ b/toolchain/check/testdata/class/fail_base_bad_type.carbon @@ -120,57 +120,58 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: --- fail_base_bad_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_18.1: type = struct_type {} -// CHECK:STDOUT: %.loc10: type = struct_type {.a: i32} -// CHECK:STDOUT: %.loc17: type = struct_type {.base: } -// CHECK:STDOUT: %.loc12: type = ptr_type {.base: } -// CHECK:STDOUT: %.loc51_22: type = tuple_type (type) -// CHECK:STDOUT: %.loc51_23.1: type = tuple_type (Base) -// CHECK:STDOUT: %.loc7_18.2: type = tuple_type () -// CHECK:STDOUT: %.loc7_17: type = ptr_type {} -// CHECK:STDOUT: %.loc51_23.2: type = tuple_type ({}*) -// CHECK:STDOUT: %.loc67: type = ptr_type {.a: i32, .b: i32} -// CHECK:STDOUT: %.loc8: type = ptr_type {.a: i32} -// CHECK:STDOUT: %.loc102_1.1: type = struct_type {.base: Final} -// CHECK:STDOUT: %.loc102_1.2: type = struct_type {.base: {.a: i32}*} -// CHECK:STDOUT: %.loc97: type = ptr_type {.base: Final} +// CHECK:STDOUT: %.loc7_18.1: type = struct_type {}, const +// CHECK:STDOUT: %.loc10: type = struct_type {.a: i32}, const +// CHECK:STDOUT: %.loc17: type = struct_type {.base: }, const +// CHECK:STDOUT: %.loc12: type = ptr_type {.base: }, const +// CHECK:STDOUT: %.loc26: i32 = int_literal 32, const +// CHECK:STDOUT: %.loc51_22: type = tuple_type (type), const +// CHECK:STDOUT: %.loc51_23.1: type = tuple_type (Base), const +// CHECK:STDOUT: %.loc7_18.2: type = tuple_type (), const +// CHECK:STDOUT: %.loc7_17: type = ptr_type {}, const +// CHECK:STDOUT: %.loc51_23.2: type = tuple_type ({}*), const +// CHECK:STDOUT: %.loc67: type = ptr_type {.a: i32, .b: i32}, const +// CHECK:STDOUT: %.loc8: type = ptr_type {.a: i32}, const +// CHECK:STDOUT: %.loc102_1.1: type = struct_type {.base: Final}, const +// CHECK:STDOUT: %.loc102_1.2: type = struct_type {.base: {.a: i32}*}, const +// CHECK:STDOUT: %.loc97: type = ptr_type {.base: Final}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Base = %Base.decl, .Final = %Final.decl, .DeriveFromError = %DeriveFromError.decl, .AccessMemberWithInvalidBaseError = %AccessMemberWithInvalidBaseError, .DeriveFromNonType = %DeriveFromNonType.decl, .AccessMemberWithInvalidBasNonType = %AccessMemberWithInvalidBasNonType, .DeriveFromi32 = %DeriveFromi32.decl, .ConvertToBadBasei32 = %ConvertToBadBasei32, .AccessMemberWithInvalidBasei32 = %AccessMemberWithInvalidBasei32, .DeriveFromTuple = %DeriveFromTuple.decl, .ConvertToBadBaseTuple = %ConvertToBadBaseTuple, .AccessMemberWithInvalidBaseTuple = %AccessMemberWithInvalidBaseTuple, .DeriveFromStruct = %DeriveFromStruct.decl, .ConvertToBadBaseStruct = %ConvertToBadBaseStruct, .AccessMemberWithInvalidBaseStruct = %AccessMemberWithInvalidBaseStruct, .Incomplete = %Incomplete.decl, .DeriveFromIncomplete = %DeriveFromIncomplete.decl, .ConvertToBadBaseIncomplete = %ConvertToBadBaseIncomplete, .AccessMemberWithInvalidBaseIncomplete = %AccessMemberWithInvalidBaseIncomplete, .DeriveFromFinal = %DeriveFromFinal.decl, .ConvertToBadBaseFinal = %ConvertToBadBaseFinal, .AccessMemberWithInvalidBaseFinal_WithMember = %AccessMemberWithInvalidBaseFinal_WithMember, .AccessMemberWithInvalidBaseFinal_NoMember = %AccessMemberWithInvalidBaseFinal_NoMember} // CHECK:STDOUT: %Base.decl = class_decl @Base, () -// CHECK:STDOUT: %Base: type = class_type @Base +// CHECK:STDOUT: %Base: type = class_type @Base, const // CHECK:STDOUT: %Final.decl = class_decl @Final, () -// CHECK:STDOUT: %Final: type = class_type @Final +// CHECK:STDOUT: %Final: type = class_type @Final, const // CHECK:STDOUT: %DeriveFromError.decl = class_decl @DeriveFromError, () -// CHECK:STDOUT: %DeriveFromError: type = class_type @DeriveFromError -// CHECK:STDOUT: %AccessMemberWithInvalidBaseError: = fn_decl @AccessMemberWithInvalidBaseError +// CHECK:STDOUT: %DeriveFromError: type = class_type @DeriveFromError, const +// CHECK:STDOUT: %AccessMemberWithInvalidBaseError: = fn_decl @AccessMemberWithInvalidBaseError, const // CHECK:STDOUT: %DeriveFromNonType.decl = class_decl @DeriveFromNonType, () -// CHECK:STDOUT: %DeriveFromNonType: type = class_type @DeriveFromNonType -// CHECK:STDOUT: %AccessMemberWithInvalidBasNonType: = fn_decl @AccessMemberWithInvalidBasNonType +// CHECK:STDOUT: %DeriveFromNonType: type = class_type @DeriveFromNonType, const +// CHECK:STDOUT: %AccessMemberWithInvalidBasNonType: = fn_decl @AccessMemberWithInvalidBasNonType, const // CHECK:STDOUT: %DeriveFromi32.decl = class_decl @DeriveFromi32, () -// CHECK:STDOUT: %DeriveFromi32: type = class_type @DeriveFromi32 -// CHECK:STDOUT: %ConvertToBadBasei32: = fn_decl @ConvertToBadBasei32 -// CHECK:STDOUT: %AccessMemberWithInvalidBasei32: = fn_decl @AccessMemberWithInvalidBasei32 +// CHECK:STDOUT: %DeriveFromi32: type = class_type @DeriveFromi32, const +// CHECK:STDOUT: %ConvertToBadBasei32: = fn_decl @ConvertToBadBasei32, const +// CHECK:STDOUT: %AccessMemberWithInvalidBasei32: = fn_decl @AccessMemberWithInvalidBasei32, const // CHECK:STDOUT: %DeriveFromTuple.decl = class_decl @DeriveFromTuple, () -// CHECK:STDOUT: %DeriveFromTuple: type = class_type @DeriveFromTuple -// CHECK:STDOUT: %ConvertToBadBaseTuple: = fn_decl @ConvertToBadBaseTuple -// CHECK:STDOUT: %AccessMemberWithInvalidBaseTuple: = fn_decl @AccessMemberWithInvalidBaseTuple +// CHECK:STDOUT: %DeriveFromTuple: type = class_type @DeriveFromTuple, const +// CHECK:STDOUT: %ConvertToBadBaseTuple: = fn_decl @ConvertToBadBaseTuple, const +// CHECK:STDOUT: %AccessMemberWithInvalidBaseTuple: = fn_decl @AccessMemberWithInvalidBaseTuple, const // CHECK:STDOUT: %DeriveFromStruct.decl = class_decl @DeriveFromStruct, () -// CHECK:STDOUT: %DeriveFromStruct: type = class_type @DeriveFromStruct -// CHECK:STDOUT: %ConvertToBadBaseStruct: = fn_decl @ConvertToBadBaseStruct -// CHECK:STDOUT: %AccessMemberWithInvalidBaseStruct: = fn_decl @AccessMemberWithInvalidBaseStruct +// CHECK:STDOUT: %DeriveFromStruct: type = class_type @DeriveFromStruct, const +// CHECK:STDOUT: %ConvertToBadBaseStruct: = fn_decl @ConvertToBadBaseStruct, const +// CHECK:STDOUT: %AccessMemberWithInvalidBaseStruct: = fn_decl @AccessMemberWithInvalidBaseStruct, const // CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () -// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete +// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete, const // CHECK:STDOUT: %DeriveFromIncomplete.decl = class_decl @DeriveFromIncomplete, () -// CHECK:STDOUT: %DeriveFromIncomplete: type = class_type @DeriveFromIncomplete -// CHECK:STDOUT: %ConvertToBadBaseIncomplete: = fn_decl @ConvertToBadBaseIncomplete -// CHECK:STDOUT: %AccessMemberWithInvalidBaseIncomplete: = fn_decl @AccessMemberWithInvalidBaseIncomplete +// CHECK:STDOUT: %DeriveFromIncomplete: type = class_type @DeriveFromIncomplete, const +// CHECK:STDOUT: %ConvertToBadBaseIncomplete: = fn_decl @ConvertToBadBaseIncomplete, const +// CHECK:STDOUT: %AccessMemberWithInvalidBaseIncomplete: = fn_decl @AccessMemberWithInvalidBaseIncomplete, const // CHECK:STDOUT: %DeriveFromFinal.decl = class_decl @DeriveFromFinal, () -// CHECK:STDOUT: %DeriveFromFinal: type = class_type @DeriveFromFinal -// CHECK:STDOUT: %ConvertToBadBaseFinal: = fn_decl @ConvertToBadBaseFinal -// CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_WithMember: = fn_decl @AccessMemberWithInvalidBaseFinal_WithMember -// CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_NoMember: = fn_decl @AccessMemberWithInvalidBaseFinal_NoMember +// CHECK:STDOUT: %DeriveFromFinal: type = class_type @DeriveFromFinal, const +// CHECK:STDOUT: %ConvertToBadBaseFinal: = fn_decl @ConvertToBadBaseFinal, const +// CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_WithMember: = fn_decl @AccessMemberWithInvalidBaseFinal_WithMember, const +// CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_NoMember: = fn_decl @AccessMemberWithInvalidBaseFinal_NoMember, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { @@ -179,9 +180,9 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Final { -// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Final, i32 -// CHECK:STDOUT: %.loc9_8.2: = field_decl a, element0 -// CHECK:STDOUT: %a: = bind_name a, %.loc9_8.2 +// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Final, i32, const +// CHECK:STDOUT: %.loc9_8.2: = field_decl a, element0, const +// CHECK:STDOUT: %a: = bind_name a, %.loc9_8.2, const = %.loc9_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .a = %a @@ -189,8 +190,8 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromError { // CHECK:STDOUT: %error.ref: = name_ref error, -// CHECK:STDOUT: %.loc16_21.1: type = unbound_element_type DeriveFromError, -// CHECK:STDOUT: %.loc16_21.2: = base_decl , element0 +// CHECK:STDOUT: %.loc16_21.1: type = unbound_element_type DeriveFromError, , const +// CHECK:STDOUT: %.loc16_21.2: = base_decl , element0, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc16_21.2 @@ -198,9 +199,9 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromNonType { -// CHECK:STDOUT: %.loc26_16: i32 = int_literal 32 -// CHECK:STDOUT: %.loc26_18.1: type = unbound_element_type DeriveFromNonType, -// CHECK:STDOUT: %.loc26_18.2: = base_decl , element0 +// CHECK:STDOUT: %.loc26_16: i32 = int_literal 32, const = constants.%.loc26 +// CHECK:STDOUT: %.loc26_18.1: type = unbound_element_type DeriveFromNonType, , const +// CHECK:STDOUT: %.loc26_18.2: = base_decl , element0, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc26_18.2 @@ -208,8 +209,8 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromi32 { -// CHECK:STDOUT: %.loc35_19.1: type = unbound_element_type DeriveFromi32, -// CHECK:STDOUT: %.loc35_19.2: = base_decl , element0 +// CHECK:STDOUT: %.loc35_19.1: type = unbound_element_type DeriveFromi32, , const +// CHECK:STDOUT: %.loc35_19.2: = base_decl , element0, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc35_19.2 @@ -217,11 +218,11 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromTuple { -// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base +// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base, const = file.%Base // CHECK:STDOUT: %.loc51_22: (type,) = tuple_literal (%Base.ref) // CHECK:STDOUT: %.loc51_23.1: type = converted %.loc51_22, constants.%.loc51_23.1 -// CHECK:STDOUT: %.loc51_23.2: type = unbound_element_type DeriveFromTuple, -// CHECK:STDOUT: %.loc51_23.3: = base_decl , element0 +// CHECK:STDOUT: %.loc51_23.2: type = unbound_element_type DeriveFromTuple, , const +// CHECK:STDOUT: %.loc51_23.3: = base_decl , element0, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc51_23.3 @@ -229,9 +230,9 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromStruct { -// CHECK:STDOUT: %.loc67_33: type = struct_type {.a: i32, .b: i32} -// CHECK:STDOUT: %.loc67_34.1: type = unbound_element_type DeriveFromStruct, -// CHECK:STDOUT: %.loc67_34.2: = base_decl , element0 +// CHECK:STDOUT: %.loc67_33: type = struct_type {.a: i32, .b: i32}, const +// CHECK:STDOUT: %.loc67_34.1: type = unbound_element_type DeriveFromStruct, , const +// CHECK:STDOUT: %.loc67_34.2: = base_decl , element0, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc67_34.2 @@ -241,9 +242,9 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: class @Incomplete; // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromIncomplete { -// CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, file.%Incomplete -// CHECK:STDOUT: %.loc87_26.1: type = unbound_element_type DeriveFromIncomplete, -// CHECK:STDOUT: %.loc87_26.2: = base_decl , element0 +// CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, file.%Incomplete, const = file.%Incomplete +// CHECK:STDOUT: %.loc87_26.1: type = unbound_element_type DeriveFromIncomplete, , const +// CHECK:STDOUT: %.loc87_26.2: = base_decl , element0, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc87_26.2 @@ -251,9 +252,9 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromFinal { -// CHECK:STDOUT: %Final.ref: type = name_ref Final, file.%Final -// CHECK:STDOUT: %.loc101_21.1: type = unbound_element_type DeriveFromFinal, Final -// CHECK:STDOUT: %.loc101_21.2: = base_decl Final, element0 +// CHECK:STDOUT: %Final.ref: type = name_ref Final, file.%Final, const = file.%Final +// CHECK:STDOUT: %.loc101_21.1: type = unbound_element_type DeriveFromFinal, Final, const +// CHECK:STDOUT: %.loc101_21.2: = base_decl Final, element0, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc101_21.2 diff --git a/toolchain/check/testdata/class/fail_base_method_define.carbon b/toolchain/check/testdata/class/fail_base_method_define.carbon index 77a82bae6040..0605f876d4dd 100644 --- a/toolchain/check/testdata/class/fail_base_method_define.carbon +++ b/toolchain/check/testdata/class/fail_base_method_define.carbon @@ -29,26 +29,26 @@ fn D.C.F() {} // CHECK:STDOUT: --- fail_base_method_define.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc12_3.1: type = struct_type {} -// CHECK:STDOUT: %.loc12_3.2: type = tuple_type () -// CHECK:STDOUT: %.loc7: type = ptr_type {} -// CHECK:STDOUT: %.loc17: type = struct_type {.base: B} +// CHECK:STDOUT: %.loc12_3.1: type = struct_type {}, const +// CHECK:STDOUT: %.loc12_3.2: type = tuple_type (), const +// CHECK:STDOUT: %.loc7: type = ptr_type {}, const +// CHECK:STDOUT: %.loc17: type = struct_type {.base: B}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.B = %B.decl, .D = %D.decl} // CHECK:STDOUT: %B.decl = class_decl @B, () -// CHECK:STDOUT: %B: type = class_type @B +// CHECK:STDOUT: %B: type = class_type @B, const // CHECK:STDOUT: %D.decl = class_decl @D, () -// CHECK:STDOUT: %D: type = class_type @D -// CHECK:STDOUT: %F: = fn_decl @F.3 -// CHECK:STDOUT: %.loc27: = fn_decl @.1 +// CHECK:STDOUT: %D: type = class_type @D, const +// CHECK:STDOUT: %F: = fn_decl @F.3, const +// CHECK:STDOUT: %.loc27: = fn_decl @.1, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { -// CHECK:STDOUT: %F: = fn_decl @F.1 +// CHECK:STDOUT: %F: = fn_decl @F.1, const // CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C +// CHECK:STDOUT: %C: type = class_type @C, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F @@ -56,16 +56,16 @@ fn D.C.F() {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %F: = fn_decl @F.2 +// CHECK:STDOUT: %F: = fn_decl @F.2, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @D { -// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B -// CHECK:STDOUT: %.loc16_17.1: type = unbound_element_type D, B -// CHECK:STDOUT: %.loc16_17.2: = base_decl B, element0 +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B, const = file.%B +// CHECK:STDOUT: %.loc16_17.1: type = unbound_element_type D, B, const +// CHECK:STDOUT: %.loc16_17.2: = base_decl B, element0, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc16_17.2 diff --git a/toolchain/check/testdata/class/fail_base_misplaced.carbon b/toolchain/check/testdata/class/fail_base_misplaced.carbon index 9c7e44b21398..92106fb14056 100644 --- a/toolchain/check/testdata/class/fail_base_misplaced.carbon +++ b/toolchain/check/testdata/class/fail_base_misplaced.carbon @@ -24,7 +24,7 @@ fn F() { // CHECK:STDOUT: --- fail_base_misplaced.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7: type = struct_type {} +// CHECK:STDOUT: %.loc7: type = struct_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { diff --git a/toolchain/check/testdata/class/fail_base_modifiers.carbon b/toolchain/check/testdata/class/fail_base_modifiers.carbon index 81cd0a487bbf..57ec3f53564d 100644 --- a/toolchain/check/testdata/class/fail_base_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_base_modifiers.carbon @@ -46,24 +46,24 @@ class C4 { // CHECK:STDOUT: --- fail_base_modifiers.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_15.1: type = struct_type {} -// CHECK:STDOUT: %.loc7_15.2: type = tuple_type () -// CHECK:STDOUT: %.loc7_14: type = ptr_type {} -// CHECK:STDOUT: %.loc14: type = struct_type {.base: B} +// CHECK:STDOUT: %.loc7_15.1: type = struct_type {}, const +// CHECK:STDOUT: %.loc7_15.2: type = tuple_type (), const +// CHECK:STDOUT: %.loc7_14: type = ptr_type {}, const +// CHECK:STDOUT: %.loc14: type = struct_type {.base: B}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.B = %B.decl, .C1 = %C1.decl, .C2 = %C2.decl, .C3 = %C3.decl, .C4 = %C4.decl} // CHECK:STDOUT: %B.decl = class_decl @B, () -// CHECK:STDOUT: %B: type = class_type @B +// CHECK:STDOUT: %B: type = class_type @B, const // CHECK:STDOUT: %C1.decl = class_decl @C1, () -// CHECK:STDOUT: %C1: type = class_type @C1 +// CHECK:STDOUT: %C1: type = class_type @C1, const // CHECK:STDOUT: %C2.decl = class_decl @C2, () -// CHECK:STDOUT: %C2: type = class_type @C2 +// CHECK:STDOUT: %C2: type = class_type @C2, const // CHECK:STDOUT: %C3.decl = class_decl @C3, () -// CHECK:STDOUT: %C3: type = class_type @C3 +// CHECK:STDOUT: %C3: type = class_type @C3, const // CHECK:STDOUT: %C4.decl = class_decl @C4, () -// CHECK:STDOUT: %C4: type = class_type @C4 +// CHECK:STDOUT: %C4: type = class_type @C4, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { @@ -72,9 +72,9 @@ class C4 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C1 { -// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B -// CHECK:STDOUT: %.loc13_25.1: type = unbound_element_type C1, B -// CHECK:STDOUT: %.loc13_25.2: = base_decl B, element0 +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B, const = file.%B +// CHECK:STDOUT: %.loc13_25.1: type = unbound_element_type C1, B, const +// CHECK:STDOUT: %.loc13_25.2: = base_decl B, element0, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc13_25.2 @@ -82,18 +82,18 @@ class C4 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C2 { -// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B -// CHECK:STDOUT: %.loc23_19.1: type = unbound_element_type C2, B -// CHECK:STDOUT: %.loc23_19.2: = base_decl B, element0 +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B, const = file.%B +// CHECK:STDOUT: %.loc23_19.1: type = unbound_element_type C2, B, const +// CHECK:STDOUT: %.loc23_19.2: = base_decl B, element0, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc23_19.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C3 { -// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B -// CHECK:STDOUT: %.loc33_25.1: type = unbound_element_type C3, B -// CHECK:STDOUT: %.loc33_25.2: = base_decl B, element0 +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B, const = file.%B +// CHECK:STDOUT: %.loc33_25.1: type = unbound_element_type C3, B, const +// CHECK:STDOUT: %.loc33_25.2: = base_decl B, element0, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc33_25.2 @@ -101,9 +101,9 @@ class C4 { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C4 { -// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B -// CHECK:STDOUT: %.loc43_24.1: type = unbound_element_type C4, B -// CHECK:STDOUT: %.loc43_24.2: = base_decl B, element0 +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B, const = file.%B +// CHECK:STDOUT: %.loc43_24.1: type = unbound_element_type C4, B, const +// CHECK:STDOUT: %.loc43_24.2: = base_decl B, element0, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc43_24.2 diff --git a/toolchain/check/testdata/class/fail_base_no_extend.carbon b/toolchain/check/testdata/class/fail_base_no_extend.carbon index 6cfe9470b50a..0aaf99cbf82c 100644 --- a/toolchain/check/testdata/class/fail_base_no_extend.carbon +++ b/toolchain/check/testdata/class/fail_base_no_extend.carbon @@ -16,18 +16,18 @@ class C { // CHECK:STDOUT: --- fail_base_no_extend.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_15.1: type = struct_type {} -// CHECK:STDOUT: %.loc7_15.2: type = tuple_type () -// CHECK:STDOUT: %.loc7_14: type = ptr_type {} -// CHECK:STDOUT: %.loc14: type = struct_type {.base: B} +// CHECK:STDOUT: %.loc7_15.1: type = struct_type {}, const +// CHECK:STDOUT: %.loc7_15.2: type = tuple_type (), const +// CHECK:STDOUT: %.loc7_14: type = ptr_type {}, const +// CHECK:STDOUT: %.loc14: type = struct_type {.base: B}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.B = %B.decl, .C = %C.decl} // CHECK:STDOUT: %B.decl = class_decl @B, () -// CHECK:STDOUT: %B: type = class_type @B +// CHECK:STDOUT: %B: type = class_type @B, const // CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C +// CHECK:STDOUT: %C: type = class_type @C, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { @@ -36,9 +36,9 @@ class C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B -// CHECK:STDOUT: %.loc13_10.1: type = unbound_element_type C, B -// CHECK:STDOUT: %.loc13_10.2: = base_decl B, element0 +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B, const = file.%B +// CHECK:STDOUT: %.loc13_10.1: type = unbound_element_type C, B, const +// CHECK:STDOUT: %.loc13_10.2: = base_decl B, element0, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc13_10.2 diff --git a/toolchain/check/testdata/class/fail_base_repeated.carbon b/toolchain/check/testdata/class/fail_base_repeated.carbon index a54f26b95df0..e20a2a346b23 100644 --- a/toolchain/check/testdata/class/fail_base_repeated.carbon +++ b/toolchain/check/testdata/class/fail_base_repeated.carbon @@ -33,22 +33,22 @@ class D { // CHECK:STDOUT: --- fail_base_repeated.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_16.1: type = struct_type {} -// CHECK:STDOUT: %.loc7_16.2: type = tuple_type () -// CHECK:STDOUT: %.loc7_15: type = ptr_type {} -// CHECK:STDOUT: %.loc19: type = struct_type {.base: B1} +// CHECK:STDOUT: %.loc7_16.1: type = struct_type {}, const +// CHECK:STDOUT: %.loc7_16.2: type = tuple_type (), const +// CHECK:STDOUT: %.loc7_15: type = ptr_type {}, const +// CHECK:STDOUT: %.loc19: type = struct_type {.base: B1}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.B1 = %B1.decl, .B2 = %B2.decl, .C = %C.decl, .D = %D.decl} // CHECK:STDOUT: %B1.decl = class_decl @B1, () -// CHECK:STDOUT: %B1: type = class_type @B1 +// CHECK:STDOUT: %B1: type = class_type @B1, const // CHECK:STDOUT: %B2.decl = class_decl @B2, () -// CHECK:STDOUT: %B2: type = class_type @B2 +// CHECK:STDOUT: %B2: type = class_type @B2, const // CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C +// CHECK:STDOUT: %C: type = class_type @C, const // CHECK:STDOUT: %D.decl = class_decl @D, () -// CHECK:STDOUT: %D: type = class_type @D +// CHECK:STDOUT: %D: type = class_type @D, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B1 { @@ -62,10 +62,10 @@ class D { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %B1.ref: type = name_ref B1, file.%B1 -// CHECK:STDOUT: %.loc11_18.1: type = unbound_element_type C, B1 -// CHECK:STDOUT: %.loc11_18.2: = base_decl B1, element0 -// CHECK:STDOUT: %B2.ref: type = name_ref B2, file.%B2 +// CHECK:STDOUT: %B1.ref: type = name_ref B1, file.%B1, const = file.%B1 +// CHECK:STDOUT: %.loc11_18.1: type = unbound_element_type C, B1, const +// CHECK:STDOUT: %.loc11_18.2: = base_decl B1, element0, const +// CHECK:STDOUT: %B2.ref: type = name_ref B2, file.%B2, const = file.%B2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc11_18.2 @@ -73,10 +73,10 @@ class D { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @D { -// CHECK:STDOUT: %B1.ref.loc23: type = name_ref B1, file.%B1 -// CHECK:STDOUT: %.loc23_18.1: type = unbound_element_type D, B1 -// CHECK:STDOUT: %.loc23_18.2: = base_decl B1, element0 -// CHECK:STDOUT: %B1.ref.loc30: type = name_ref B1, file.%B1 +// CHECK:STDOUT: %B1.ref.loc23: type = name_ref B1, file.%B1, const = file.%B1 +// CHECK:STDOUT: %.loc23_18.1: type = unbound_element_type D, B1, const +// CHECK:STDOUT: %.loc23_18.2: = base_decl B1, element0, const +// CHECK:STDOUT: %B1.ref.loc30: type = name_ref B1, file.%B1, const = file.%B1 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc23_18.2 diff --git a/toolchain/check/testdata/class/fail_base_unbound.carbon b/toolchain/check/testdata/class/fail_base_unbound.carbon index 120dd7e17b99..6746242141ad 100644 --- a/toolchain/check/testdata/class/fail_base_unbound.carbon +++ b/toolchain/check/testdata/class/fail_base_unbound.carbon @@ -18,21 +18,21 @@ let b: B = C.base; // CHECK:STDOUT: --- fail_base_unbound.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_15.1: type = struct_type {} -// CHECK:STDOUT: %.loc7_15.2: type = tuple_type () -// CHECK:STDOUT: %.loc7_14: type = ptr_type {} -// CHECK:STDOUT: %.loc11: type = struct_type {.base: B} +// CHECK:STDOUT: %.loc7_15.1: type = struct_type {}, const +// CHECK:STDOUT: %.loc7_15.2: type = tuple_type (), const +// CHECK:STDOUT: %.loc7_14: type = ptr_type {}, const +// CHECK:STDOUT: %.loc11: type = struct_type {.base: B}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.B = %B.decl, .C = %C.decl} // CHECK:STDOUT: %B.decl = class_decl @B, () -// CHECK:STDOUT: %B: type = class_type @B +// CHECK:STDOUT: %B: type = class_type @B, const // CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C -// CHECK:STDOUT: %B.ref: type = name_ref B, %B -// CHECK:STDOUT: %C.ref: type = name_ref C, %C -// CHECK:STDOUT: %base.ref: = name_ref base, @C.%.loc10_17.2 +// CHECK:STDOUT: %C: type = class_type @C, const +// CHECK:STDOUT: %B.ref: type = name_ref B, %B, const = %B +// CHECK:STDOUT: %C.ref: type = name_ref C, %C, const = %C +// CHECK:STDOUT: %base.ref: = name_ref base, @C.%.loc10_17.2, const = @C.%.loc10_17.2 // CHECK:STDOUT: %b: B = bind_name b, // CHECK:STDOUT: } // CHECK:STDOUT: @@ -42,9 +42,9 @@ let b: B = C.base; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B -// CHECK:STDOUT: %.loc10_17.1: type = unbound_element_type C, B -// CHECK:STDOUT: %.loc10_17.2: = base_decl B, element0 +// CHECK:STDOUT: %B.ref: type = name_ref B, file.%B, const = file.%B +// CHECK:STDOUT: %.loc10_17.1: type = unbound_element_type C, B, const +// CHECK:STDOUT: %.loc10_17.2: = base_decl B, element0, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc10_17.2 diff --git a/toolchain/check/testdata/class/fail_derived_to_base.carbon b/toolchain/check/testdata/class/fail_derived_to_base.carbon index f30a7ca0e009..3c04e03eb1bd 100644 --- a/toolchain/check/testdata/class/fail_derived_to_base.carbon +++ b/toolchain/check/testdata/class/fail_derived_to_base.carbon @@ -32,53 +32,53 @@ fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; } // CHECK:STDOUT: --- fail_derived_to_base.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc9: type = struct_type {.a: i32} -// CHECK:STDOUT: %.loc11: type = ptr_type {.a: i32} -// CHECK:STDOUT: %.loc18_1.1: type = struct_type {.base: A2, .b: i32} -// CHECK:STDOUT: %.loc18_1.2: type = struct_type {.base: {.a: i32}*, .b: i32} -// CHECK:STDOUT: %.loc18_1.3: type = ptr_type {.base: {.a: i32}*, .b: i32} -// CHECK:STDOUT: %.loc15: type = ptr_type {.base: A2, .b: i32} +// CHECK:STDOUT: %.loc9: type = struct_type {.a: i32}, const +// CHECK:STDOUT: %.loc11: type = ptr_type {.a: i32}, const +// CHECK:STDOUT: %.loc18_1.1: type = struct_type {.base: A2, .b: i32}, const +// CHECK:STDOUT: %.loc18_1.2: type = struct_type {.base: {.a: i32}*, .b: i32}, const +// CHECK:STDOUT: %.loc18_1.3: type = ptr_type {.base: {.a: i32}*, .b: i32}, const +// CHECK:STDOUT: %.loc15: type = ptr_type {.base: A2, .b: i32}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A1 = %A1.decl, .A2 = %A2.decl, .B2 = %B2.decl, .ConvertUnrelated = %ConvertUnrelated, .Incomplete = %Incomplete.decl, .ConvertIncomplete = %ConvertIncomplete} // CHECK:STDOUT: %A1.decl = class_decl @A1, () -// CHECK:STDOUT: %A1: type = class_type @A1 +// CHECK:STDOUT: %A1: type = class_type @A1, const // CHECK:STDOUT: %A2.decl = class_decl @A2, () -// CHECK:STDOUT: %A2: type = class_type @A2 +// CHECK:STDOUT: %A2: type = class_type @A2, const // CHECK:STDOUT: %B2.decl = class_decl @B2, () -// CHECK:STDOUT: %B2: type = class_type @B2 -// CHECK:STDOUT: %ConvertUnrelated: = fn_decl @ConvertUnrelated +// CHECK:STDOUT: %B2: type = class_type @B2, const +// CHECK:STDOUT: %ConvertUnrelated: = fn_decl @ConvertUnrelated, const // CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () -// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete -// CHECK:STDOUT: %ConvertIncomplete: = fn_decl @ConvertIncomplete +// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete, const +// CHECK:STDOUT: %ConvertIncomplete: = fn_decl @ConvertIncomplete, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A1 { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type A1, i32 -// CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0 -// CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2 +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type A1, i32, const +// CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0, const +// CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2, const = %.loc8_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .a = %a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A2 { -// CHECK:STDOUT: %.loc12_8.1: type = unbound_element_type A2, i32 -// CHECK:STDOUT: %.loc12_8.2: = field_decl a, element0 -// CHECK:STDOUT: %a: = bind_name a, %.loc12_8.2 +// CHECK:STDOUT: %.loc12_8.1: type = unbound_element_type A2, i32, const +// CHECK:STDOUT: %.loc12_8.2: = field_decl a, element0, const +// CHECK:STDOUT: %a: = bind_name a, %.loc12_8.2, const = %.loc12_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .a = %a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B2 { -// CHECK:STDOUT: %A2.ref: type = name_ref A2, file.%A2 -// CHECK:STDOUT: %.loc16_18.1: type = unbound_element_type B2, A2 -// CHECK:STDOUT: %.loc16_18.2: = base_decl A2, element0 -// CHECK:STDOUT: %.loc17_8.1: type = unbound_element_type B2, i32 -// CHECK:STDOUT: %.loc17_8.2: = field_decl b, element1 -// CHECK:STDOUT: %b: = bind_name b, %.loc17_8.2 +// CHECK:STDOUT: %A2.ref: type = name_ref A2, file.%A2, const = file.%A2 +// CHECK:STDOUT: %.loc16_18.1: type = unbound_element_type B2, A2, const +// CHECK:STDOUT: %.loc16_18.2: = base_decl A2, element0, const +// CHECK:STDOUT: %.loc17_8.1: type = unbound_element_type B2, i32, const +// CHECK:STDOUT: %.loc17_8.2: = field_decl b, element1, const +// CHECK:STDOUT: %b: = bind_name b, %.loc17_8.2, const = %.loc17_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc16_18.2 diff --git a/toolchain/check/testdata/class/fail_field_modifiers.carbon b/toolchain/check/testdata/class/fail_field_modifiers.carbon index ce222eaae15d..5a40c8aa3026 100644 --- a/toolchain/check/testdata/class/fail_field_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_field_modifiers.carbon @@ -30,25 +30,27 @@ class Class { // CHECK:STDOUT: --- fail_field_modifiers.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc28: type = struct_type {.j: i32, .k: i32} +// CHECK:STDOUT: %.loc22: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc27: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc28: type = struct_type {.j: i32, .k: i32}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class +// CHECK:STDOUT: %Class: type = class_type @Class, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc12_16.1: type = unbound_element_type Class, i32 -// CHECK:STDOUT: %.loc12_16.2: = field_decl j, element0 -// CHECK:STDOUT: %j: = bind_name j, %.loc12_16.2 -// CHECK:STDOUT: %.loc17_14.1: type = unbound_element_type Class, i32 -// CHECK:STDOUT: %.loc17_14.2: = field_decl k, element1 -// CHECK:STDOUT: %k: = bind_name k, %.loc17_14.2 -// CHECK:STDOUT: %.loc22: i32 = int_literal 0 +// CHECK:STDOUT: %.loc12_16.1: type = unbound_element_type Class, i32, const +// CHECK:STDOUT: %.loc12_16.2: = field_decl j, element0, const +// CHECK:STDOUT: %j: = bind_name j, %.loc12_16.2, const = %.loc12_16.2 +// CHECK:STDOUT: %.loc17_14.1: type = unbound_element_type Class, i32, const +// CHECK:STDOUT: %.loc17_14.2: = field_decl k, element1, const +// CHECK:STDOUT: %k: = bind_name k, %.loc17_14.2, const = %.loc17_14.2 +// CHECK:STDOUT: %.loc22: i32 = int_literal 0, const = constants.%.loc22 // CHECK:STDOUT: %l: i32 = bind_name l, %.loc22 -// CHECK:STDOUT: %.loc27: i32 = int_literal 1 +// CHECK:STDOUT: %.loc27: i32 = int_literal 1, const = constants.%.loc27 // CHECK:STDOUT: %m: i32 = bind_name m, %.loc27 // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/class/fail_incomplete.carbon b/toolchain/check/testdata/class/fail_incomplete.carbon index 644cfddc6f16..8a7df5ce1f01 100644 --- a/toolchain/check/testdata/class/fail_incomplete.carbon +++ b/toolchain/check/testdata/class/fail_incomplete.carbon @@ -118,27 +118,27 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: --- fail_incomplete.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc41: type = struct_type {} -// CHECK:STDOUT: %.loc100: type = tuple_type () +// CHECK:STDOUT: %.loc41: type = struct_type {}, const +// CHECK:STDOUT: %.loc100: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .CallClassFunction = %CallClassFunction, .global_var = %global_var, .ConvertFromStruct = %ConvertFromStruct, .MemberAccess = %MemberAccess, .Copy = %Copy, .Let = %Let, .TakeIncomplete = %TakeIncomplete, .ReturnIncomplete = %ReturnIncomplete, .CallTakeIncomplete = %CallTakeIncomplete, .CallReturnIncomplete = %CallReturnIncomplete} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class -// CHECK:STDOUT: %.loc15: = fn_decl @.1 -// CHECK:STDOUT: %CallClassFunction: = fn_decl @CallClassFunction -// CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class +// CHECK:STDOUT: %Class: type = class_type @Class, const +// CHECK:STDOUT: %.loc15: = fn_decl @.1, const +// CHECK:STDOUT: %CallClassFunction: = fn_decl @CallClassFunction, const +// CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class, const = %Class // CHECK:STDOUT: %global_var.var: ref = var global_var // CHECK:STDOUT: %global_var: ref = bind_name global_var, %global_var.var -// CHECK:STDOUT: %ConvertFromStruct: = fn_decl @ConvertFromStruct -// CHECK:STDOUT: %MemberAccess: = fn_decl @MemberAccess -// CHECK:STDOUT: %Copy: = fn_decl @Copy -// CHECK:STDOUT: %Let: = fn_decl @Let -// CHECK:STDOUT: %TakeIncomplete: = fn_decl @TakeIncomplete -// CHECK:STDOUT: %ReturnIncomplete: = fn_decl @ReturnIncomplete -// CHECK:STDOUT: %CallTakeIncomplete: = fn_decl @CallTakeIncomplete -// CHECK:STDOUT: %CallReturnIncomplete: = fn_decl @CallReturnIncomplete +// CHECK:STDOUT: %ConvertFromStruct: = fn_decl @ConvertFromStruct, const +// CHECK:STDOUT: %MemberAccess: = fn_decl @MemberAccess, const +// CHECK:STDOUT: %Copy: = fn_decl @Copy, const +// CHECK:STDOUT: %Let: = fn_decl @Let, const +// CHECK:STDOUT: %TakeIncomplete: = fn_decl @TakeIncomplete, const +// CHECK:STDOUT: %ReturnIncomplete: = fn_decl @ReturnIncomplete, const +// CHECK:STDOUT: %CallTakeIncomplete: = fn_decl @CallTakeIncomplete, const +// CHECK:STDOUT: %CallReturnIncomplete: = fn_decl @CallReturnIncomplete, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class; @@ -150,7 +150,7 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: // CHECK:STDOUT: fn @CallClassFunction() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class, const = file.%Class // CHECK:STDOUT: %Function.ref: = name_ref Function, // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -177,7 +177,7 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Let(%p: Class*) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class, const = file.%Class // CHECK:STDOUT: %p.ref: Class* = name_ref p, %p // CHECK:STDOUT: %.loc75: ref Class = deref %p.ref // CHECK:STDOUT: %c: = bind_name c, @@ -190,11 +190,11 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: // CHECK:STDOUT: fn @CallTakeIncomplete(%p: Class*) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TakeIncomplete.ref.loc100: = name_ref TakeIncomplete, file.%TakeIncomplete +// CHECK:STDOUT: %TakeIncomplete.ref.loc100: = name_ref TakeIncomplete, file.%TakeIncomplete, const = file.%TakeIncomplete // CHECK:STDOUT: %p.ref: Class* = name_ref p, %p // CHECK:STDOUT: %.loc100_18: ref Class = deref %p.ref // CHECK:STDOUT: %.loc100_17: init () = call %TakeIncomplete.ref.loc100() -// CHECK:STDOUT: %TakeIncomplete.ref.loc111: = name_ref TakeIncomplete, file.%TakeIncomplete +// CHECK:STDOUT: %TakeIncomplete.ref.loc111: = name_ref TakeIncomplete, file.%TakeIncomplete, const = file.%TakeIncomplete // CHECK:STDOUT: %.loc111_19: {} = struct_literal () // CHECK:STDOUT: %.loc111_17: init () = call %TakeIncomplete.ref.loc111() // CHECK:STDOUT: return @@ -202,7 +202,7 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: // CHECK:STDOUT: fn @CallReturnIncomplete() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %ReturnIncomplete.ref: = name_ref ReturnIncomplete, file.%ReturnIncomplete +// CHECK:STDOUT: %ReturnIncomplete.ref: = name_ref ReturnIncomplete, file.%ReturnIncomplete, const = file.%ReturnIncomplete // CHECK:STDOUT: %.loc115: init = call %ReturnIncomplete.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_init.carbon b/toolchain/check/testdata/class/fail_init.carbon index abce10965ee4..ca23a03d9f30 100644 --- a/toolchain/check/testdata/class/fail_init.carbon +++ b/toolchain/check/testdata/class/fail_init.carbon @@ -27,27 +27,33 @@ fn F() { // CHECK:STDOUT: --- fail_init.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10_1.1: type = struct_type {.a: i32, .b: i32} -// CHECK:STDOUT: %.loc16: type = struct_type {.a: i32} -// CHECK:STDOUT: %.loc10_1.2: type = ptr_type {.a: i32, .b: i32} -// CHECK:STDOUT: %.loc20: type = struct_type {.a: i32, .c: i32} -// CHECK:STDOUT: %.loc24: type = struct_type {.a: i32, .b: i32, .c: i32} +// CHECK:STDOUT: %.loc10_1.1: type = struct_type {.a: i32, .b: i32}, const +// CHECK:STDOUT: %.loc16_9: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc16_10: type = struct_type {.a: i32}, const +// CHECK:STDOUT: %.loc10_1.2: type = ptr_type {.a: i32, .b: i32}, const +// CHECK:STDOUT: %.loc20_9: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc20_17: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc20_18: type = struct_type {.a: i32, .c: i32}, const +// CHECK:STDOUT: %.loc24_9: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc24_17: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc24_25: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc24_26: type = struct_type {.a: i32, .b: i32, .c: i32}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .F = %F} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %Class: type = class_type @Class, const +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32 -// CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0 -// CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2 -// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, i32 -// CHECK:STDOUT: %.loc9_8.2: = field_decl b, element1 -// CHECK:STDOUT: %b: = bind_name b, %.loc9_8.2 +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32, const +// CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0, const +// CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2, const = %.loc8_8.2 +// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, i32, const +// CHECK:STDOUT: %.loc9_8.2: = field_decl b, element1, const +// CHECK:STDOUT: %b: = bind_name b, %.loc9_8.2, const = %.loc9_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .a = %a @@ -56,26 +62,26 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc16_9: i32 = int_literal 1 +// CHECK:STDOUT: %.loc16_9: i32 = int_literal 1, const = constants.%.loc16_9 // CHECK:STDOUT: %.loc16_10.1: {.a: i32} = struct_literal (%.loc16_9) -// CHECK:STDOUT: %Class.ref.loc16: type = name_ref Class, file.%Class +// CHECK:STDOUT: %Class.ref.loc16: type = name_ref Class, file.%Class, const = file.%Class // CHECK:STDOUT: %.loc16_10.2: ref Class = temporary_storage // CHECK:STDOUT: %.loc16_10.3: ref Class = temporary %.loc16_10.2, // CHECK:STDOUT: %.loc16_10.4: ref Class = converted %.loc16_10.1, %.loc16_10.3 -// CHECK:STDOUT: %.loc20_9: i32 = int_literal 1 -// CHECK:STDOUT: %.loc20_17: i32 = int_literal 2 +// CHECK:STDOUT: %.loc20_9: i32 = int_literal 1, const = constants.%.loc20_9 +// CHECK:STDOUT: %.loc20_17: i32 = int_literal 2, const = constants.%.loc20_17 // CHECK:STDOUT: %.loc20_18.1: {.a: i32, .c: i32} = struct_literal (%.loc20_9, %.loc20_17) -// CHECK:STDOUT: %Class.ref.loc20: type = name_ref Class, file.%Class +// CHECK:STDOUT: %Class.ref.loc20: type = name_ref Class, file.%Class, const = file.%Class // CHECK:STDOUT: %.loc20_18.2: ref Class = temporary_storage // CHECK:STDOUT: %.loc20_18.3: ref i32 = class_element_access %.loc20_18.2, element0 // CHECK:STDOUT: %.loc20_18.4: init i32 = initialize_from %.loc20_9 to %.loc20_18.3 // CHECK:STDOUT: %.loc20_18.5: ref Class = temporary %.loc20_18.2, // CHECK:STDOUT: %.loc20_18.6: ref Class = converted %.loc20_18.1, %.loc20_18.5 -// CHECK:STDOUT: %.loc24_9: i32 = int_literal 1 -// CHECK:STDOUT: %.loc24_17: i32 = int_literal 2 -// CHECK:STDOUT: %.loc24_25: i32 = int_literal 3 +// CHECK:STDOUT: %.loc24_9: i32 = int_literal 1, const = constants.%.loc24_9 +// CHECK:STDOUT: %.loc24_17: i32 = int_literal 2, const = constants.%.loc24_17 +// CHECK:STDOUT: %.loc24_25: i32 = int_literal 3, const = constants.%.loc24_25 // CHECK:STDOUT: %.loc24_26.1: {.a: i32, .b: i32, .c: i32} = struct_literal (%.loc24_9, %.loc24_17, %.loc24_25) -// CHECK:STDOUT: %Class.ref.loc24: type = name_ref Class, file.%Class +// CHECK:STDOUT: %Class.ref.loc24: type = name_ref Class, file.%Class, const = file.%Class // CHECK:STDOUT: %.loc24_26.2: ref Class = temporary_storage // CHECK:STDOUT: %.loc24_26.3: ref Class = temporary %.loc24_26.2, // CHECK:STDOUT: %.loc24_26.4: ref Class = converted %.loc24_26.1, %.loc24_26.3 diff --git a/toolchain/check/testdata/class/fail_init_as_inplace.carbon b/toolchain/check/testdata/class/fail_init_as_inplace.carbon index 046387ef7a3f..f816e059a0b0 100644 --- a/toolchain/check/testdata/class/fail_init_as_inplace.carbon +++ b/toolchain/check/testdata/class/fail_init_as_inplace.carbon @@ -25,26 +25,28 @@ fn F() { // CHECK:STDOUT: --- fail_init_as_inplace.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10_1.1: type = struct_type {.a: i32, .b: i32} -// CHECK:STDOUT: %.loc10_1.2: type = ptr_type {.a: i32, .b: i32} -// CHECK:STDOUT: %.loc22: type = tuple_type () +// CHECK:STDOUT: %.loc10_1.1: type = struct_type {.a: i32, .b: i32}, const +// CHECK:STDOUT: %.loc10_1.2: type = ptr_type {.a: i32, .b: i32}, const +// CHECK:STDOUT: %.loc21_24: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc21_32: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc22: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .G = %G, .F = %F} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %Class: type = class_type @Class, const +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32 -// CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0 -// CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2 -// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, i32 -// CHECK:STDOUT: %.loc9_8.2: = field_decl b, element1 -// CHECK:STDOUT: %b: = bind_name b, %.loc9_8.2 +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32, const +// CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0, const +// CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2, const = %.loc8_8.2 +// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, i32, const +// CHECK:STDOUT: %.loc9_8.2: = field_decl b, element1, const +// CHECK:STDOUT: %b: = bind_name b, %.loc9_8.2, const = %.loc9_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .a = %a @@ -55,13 +57,13 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref.loc21_10: type = name_ref Class, file.%Class +// CHECK:STDOUT: %Class.ref.loc21_10: type = name_ref Class, file.%Class, const = file.%Class // CHECK:STDOUT: %c.var: ref Class = var c // CHECK:STDOUT: %c: ref Class = bind_name c, %c.var -// CHECK:STDOUT: %.loc21_24: i32 = int_literal 1 -// CHECK:STDOUT: %.loc21_32: i32 = int_literal 2 +// CHECK:STDOUT: %.loc21_24: i32 = int_literal 1, const = constants.%.loc21_24 +// CHECK:STDOUT: %.loc21_32: i32 = int_literal 2, const = constants.%.loc21_32 // CHECK:STDOUT: %.loc21_33.1: {.a: i32, .b: i32} = struct_literal (%.loc21_24, %.loc21_32) -// CHECK:STDOUT: %Class.ref.loc21_38: type = name_ref Class, file.%Class +// CHECK:STDOUT: %Class.ref.loc21_38: type = name_ref Class, file.%Class, const = file.%Class // CHECK:STDOUT: %.loc21_33.2: ref Class = temporary_storage // CHECK:STDOUT: %.loc21_33.3: ref i32 = class_element_access %.loc21_33.2, element0 // CHECK:STDOUT: %.loc21_33.4: init i32 = initialize_from %.loc21_24 to %.loc21_33.3 @@ -72,7 +74,7 @@ fn F() { // CHECK:STDOUT: %.loc21_33.9: ref Class = converted %.loc21_33.1, %.loc21_33.8 // CHECK:STDOUT: %.loc21_33.10: Class = bind_value %.loc21_33.9 // CHECK:STDOUT: assign %c.var, -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G +// CHECK:STDOUT: %G.ref: = name_ref G, file.%G, const = file.%G // CHECK:STDOUT: %c.ref: ref Class = name_ref c, %c // CHECK:STDOUT: %.loc22_5: Class* = addr_of %c.ref // CHECK:STDOUT: %.loc22_4: init () = call %G.ref(%.loc22_5) diff --git a/toolchain/check/testdata/class/fail_memaccess_category.carbon b/toolchain/check/testdata/class/fail_memaccess_category.carbon index b2cd44f45ae4..98f24e434be9 100644 --- a/toolchain/check/testdata/class/fail_memaccess_category.carbon +++ b/toolchain/check/testdata/class/fail_memaccess_category.carbon @@ -36,35 +36,35 @@ fn F(s: {.a: A}, b: B) { // CHECK:STDOUT: --- fail_memaccess_category.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc9_1.1: type = struct_type {} -// CHECK:STDOUT: %.loc9_1.2: type = tuple_type () -// CHECK:STDOUT: %.loc7: type = ptr_type {} -// CHECK:STDOUT: %.loc13_1.1: type = struct_type {.a: A} -// CHECK:STDOUT: %.loc13_1.2: type = struct_type {.a: {}*} -// CHECK:STDOUT: %.loc11: type = ptr_type {.a: A} +// CHECK:STDOUT: %.loc9_1.1: type = struct_type {}, const +// CHECK:STDOUT: %.loc9_1.2: type = tuple_type (), const +// CHECK:STDOUT: %.loc7: type = ptr_type {}, const +// CHECK:STDOUT: %.loc13_1.1: type = struct_type {.a: A}, const +// CHECK:STDOUT: %.loc13_1.2: type = struct_type {.a: {}*}, const +// CHECK:STDOUT: %.loc11: type = ptr_type {.a: A}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %A.decl, .B = %B.decl, .F = %F} // CHECK:STDOUT: %A.decl = class_decl @A, () -// CHECK:STDOUT: %A: type = class_type @A +// CHECK:STDOUT: %A: type = class_type @A, const // CHECK:STDOUT: %B.decl = class_decl @B, () -// CHECK:STDOUT: %B: type = class_type @B -// CHECK:STDOUT: %F: = fn_decl @F.2 +// CHECK:STDOUT: %B: type = class_type @B, const +// CHECK:STDOUT: %F: = fn_decl @F.2, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { -// CHECK:STDOUT: %F: = fn_decl @F.1 +// CHECK:STDOUT: %F: = fn_decl @F.1, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { -// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A -// CHECK:STDOUT: %.loc12_8.1: type = unbound_element_type B, A -// CHECK:STDOUT: %.loc12_8.2: = field_decl a, element0 -// CHECK:STDOUT: %a: = bind_name a, %.loc12_8.2 +// CHECK:STDOUT: %A.ref: type = name_ref A, file.%A, const = file.%A +// CHECK:STDOUT: %.loc12_8.1: type = unbound_element_type B, A, const +// CHECK:STDOUT: %.loc12_8.2: = field_decl a, element0, const +// CHECK:STDOUT: %a: = bind_name a, %.loc12_8.2, const = %.loc12_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .a = %a diff --git a/toolchain/check/testdata/class/fail_member_of_let.carbon b/toolchain/check/testdata/class/fail_member_of_let.carbon index 325bb55a84ed..01eda9edabb3 100644 --- a/toolchain/check/testdata/class/fail_member_of_let.carbon +++ b/toolchain/check/testdata/class/fail_member_of_let.carbon @@ -21,20 +21,20 @@ fn T.F() {} // CHECK:STDOUT: --- fail_member_of_let.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc9: type = struct_type {} +// CHECK:STDOUT: %.loc9: type = struct_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class -// CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class +// CHECK:STDOUT: %Class: type = class_type @Class, const +// CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class, const = %Class // CHECK:STDOUT: %T: type = bind_name T, %Class.ref -// CHECK:STDOUT: %.loc19: = fn_decl @.1 +// CHECK:STDOUT: %.loc19: = fn_decl @.1, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F diff --git a/toolchain/check/testdata/class/fail_method.carbon b/toolchain/check/testdata/class/fail_method.carbon index afb9b74018e9..d9d858caf492 100644 --- a/toolchain/check/testdata/class/fail_method.carbon +++ b/toolchain/check/testdata/class/fail_method.carbon @@ -33,21 +33,21 @@ fn F(c: Class) { // CHECK:STDOUT: --- fail_method.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10_1.1: type = struct_type {} -// CHECK:STDOUT: %.loc10_1.2: type = tuple_type () -// CHECK:STDOUT: %.loc7: type = ptr_type {} +// CHECK:STDOUT: %.loc10_1.1: type = struct_type {}, const +// CHECK:STDOUT: %.loc10_1.2: type = tuple_type (), const +// CHECK:STDOUT: %.loc7: type = ptr_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .F = %F} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %Class: type = class_type @Class, const +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %NoSelf: = fn_decl @NoSelf -// CHECK:STDOUT: %WithSelf: = fn_decl @WithSelf +// CHECK:STDOUT: %NoSelf: = fn_decl @NoSelf, const +// CHECK:STDOUT: %WithSelf: = fn_decl @WithSelf, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .NoSelf = %NoSelf @@ -61,19 +61,19 @@ fn F(c: Class) { // CHECK:STDOUT: fn @F(%c: Class) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref.loc13: Class = name_ref c, %c -// CHECK:STDOUT: %NoSelf.ref.loc13: = name_ref NoSelf, @Class.%NoSelf +// CHECK:STDOUT: %NoSelf.ref.loc13: = name_ref NoSelf, @Class.%NoSelf, const = @Class.%NoSelf // CHECK:STDOUT: %.loc13: init () = call %NoSelf.ref.loc13() // CHECK:STDOUT: %c.ref.loc14: Class = name_ref c, %c // CHECK:STDOUT: %.loc14_4: = bound_method %c.ref.loc14, @Class.%WithSelf // CHECK:STDOUT: %.loc14_13: init () = call %.loc14_4(%c.ref.loc14) -// CHECK:STDOUT: %Class.ref.loc16: type = name_ref Class, file.%Class -// CHECK:STDOUT: %NoSelf.ref.loc16: = name_ref NoSelf, @Class.%NoSelf +// CHECK:STDOUT: %Class.ref.loc16: type = name_ref Class, file.%Class, const = file.%Class +// CHECK:STDOUT: %NoSelf.ref.loc16: = name_ref NoSelf, @Class.%NoSelf, const = @Class.%NoSelf // CHECK:STDOUT: %.loc16: init () = call %NoSelf.ref.loc16() -// CHECK:STDOUT: %Class.ref.loc23: type = name_ref Class, file.%Class -// CHECK:STDOUT: %WithSelf.ref.loc23: = name_ref WithSelf, @Class.%WithSelf +// CHECK:STDOUT: %Class.ref.loc23: type = name_ref Class, file.%Class, const = file.%Class +// CHECK:STDOUT: %WithSelf.ref.loc23: = name_ref WithSelf, @Class.%WithSelf, const = @Class.%WithSelf // CHECK:STDOUT: %.loc23: init () = call %WithSelf.ref.loc23() -// CHECK:STDOUT: %Class.ref.loc30: type = name_ref Class, file.%Class -// CHECK:STDOUT: %WithSelf.ref.loc30: = name_ref WithSelf, @Class.%WithSelf +// CHECK:STDOUT: %Class.ref.loc30: type = name_ref Class, file.%Class, const = file.%Class +// CHECK:STDOUT: %WithSelf.ref.loc30: = name_ref WithSelf, @Class.%WithSelf, const = @Class.%WithSelf // CHECK:STDOUT: %c.ref.loc30: Class = name_ref c, %c // CHECK:STDOUT: %.loc30: init () = call %WithSelf.ref.loc30() // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/class/fail_method_modifiers.carbon b/toolchain/check/testdata/class/fail_method_modifiers.carbon index b82098ef5ac4..726fab20e5f2 100644 --- a/toolchain/check/testdata/class/fail_method_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_method_modifiers.carbon @@ -50,22 +50,22 @@ base class BaseClass { // CHECK:STDOUT: --- fail_method_modifiers.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc24: type = struct_type {} +// CHECK:STDOUT: %.loc24: type = struct_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.FinalClass = %FinalClass.decl, .AbstractClass = %AbstractClass.decl, .BaseClass = %BaseClass.decl} // CHECK:STDOUT: %FinalClass.decl = class_decl @FinalClass, () -// CHECK:STDOUT: %FinalClass: type = class_type @FinalClass +// CHECK:STDOUT: %FinalClass: type = class_type @FinalClass, const // CHECK:STDOUT: %AbstractClass.decl = class_decl @AbstractClass, () -// CHECK:STDOUT: %AbstractClass: type = class_type @AbstractClass +// CHECK:STDOUT: %AbstractClass: type = class_type @AbstractClass, const // CHECK:STDOUT: %BaseClass.decl = class_decl @BaseClass, () -// CHECK:STDOUT: %BaseClass: type = class_type @BaseClass +// CHECK:STDOUT: %BaseClass: type = class_type @BaseClass, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @FinalClass { -// CHECK:STDOUT: %Abstract: = fn_decl @Abstract.1 -// CHECK:STDOUT: %Virtual: = fn_decl @Virtual +// CHECK:STDOUT: %Abstract: = fn_decl @Abstract.1, const +// CHECK:STDOUT: %Virtual: = fn_decl @Virtual, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Abstract = %Abstract @@ -73,8 +73,8 @@ base class BaseClass { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @AbstractClass { -// CHECK:STDOUT: %Default: = fn_decl @Default -// CHECK:STDOUT: %Final: = fn_decl @Final +// CHECK:STDOUT: %Default: = fn_decl @Default, const +// CHECK:STDOUT: %Final: = fn_decl @Final, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Default = %Default @@ -82,7 +82,7 @@ base class BaseClass { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @BaseClass { -// CHECK:STDOUT: %Abstract: = fn_decl @Abstract.2 +// CHECK:STDOUT: %Abstract: = fn_decl @Abstract.2, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Abstract = %Abstract diff --git a/toolchain/check/testdata/class/fail_modifiers.carbon b/toolchain/check/testdata/class/fail_modifiers.carbon index dc067c14052c..49e9b88441ae 100644 --- a/toolchain/check/testdata/class/fail_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_modifiers.carbon @@ -67,23 +67,23 @@ abstract base class AbstractAndBase {} // CHECK:STDOUT: --- fail_modifiers.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc27: type = struct_type {} +// CHECK:STDOUT: %.loc27: type = struct_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.DuplicatePrivate = %DuplicatePrivate.decl, .TwoAccess = %TwoAccess.decl, .TwoAbstract = %TwoAbstract.decl, .Virtual = %Virtual.decl, .WrongOrder = %WrongOrder.decl, .AbstractAndBase = %AbstractAndBase.decl} // CHECK:STDOUT: %DuplicatePrivate.decl = class_decl @DuplicatePrivate, () -// CHECK:STDOUT: %DuplicatePrivate: type = class_type @DuplicatePrivate +// CHECK:STDOUT: %DuplicatePrivate: type = class_type @DuplicatePrivate, const // CHECK:STDOUT: %TwoAccess.decl = class_decl @TwoAccess, () -// CHECK:STDOUT: %TwoAccess: type = class_type @TwoAccess +// CHECK:STDOUT: %TwoAccess: type = class_type @TwoAccess, const // CHECK:STDOUT: %TwoAbstract.decl = class_decl @TwoAbstract, () -// CHECK:STDOUT: %TwoAbstract: type = class_type @TwoAbstract +// CHECK:STDOUT: %TwoAbstract: type = class_type @TwoAbstract, const // CHECK:STDOUT: %Virtual.decl = class_decl @Virtual, () -// CHECK:STDOUT: %Virtual: type = class_type @Virtual +// CHECK:STDOUT: %Virtual: type = class_type @Virtual, const // CHECK:STDOUT: %WrongOrder.decl = class_decl @WrongOrder, () -// CHECK:STDOUT: %WrongOrder: type = class_type @WrongOrder +// CHECK:STDOUT: %WrongOrder: type = class_type @WrongOrder, const // CHECK:STDOUT: %AbstractAndBase.decl = class_decl @AbstractAndBase, () -// CHECK:STDOUT: %AbstractAndBase: type = class_type @AbstractAndBase +// CHECK:STDOUT: %AbstractAndBase: type = class_type @AbstractAndBase, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DuplicatePrivate; diff --git a/toolchain/check/testdata/class/fail_out_of_line_decl.carbon b/toolchain/check/testdata/class/fail_out_of_line_decl.carbon index 9272f8f293da..25deee9044f1 100644 --- a/toolchain/check/testdata/class/fail_out_of_line_decl.carbon +++ b/toolchain/check/testdata/class/fail_out_of_line_decl.carbon @@ -14,14 +14,14 @@ fn C.F() {} // CHECK:STDOUT: --- fail_out_of_line_decl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7: type = struct_type {} +// CHECK:STDOUT: %.loc7: type = struct_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.C = %C.decl} // CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %C: type = class_type @C, const +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { diff --git a/toolchain/check/testdata/class/fail_redeclaration_introducer.carbon b/toolchain/check/testdata/class/fail_redeclaration_introducer.carbon index 4ea1f2543b94..961f4c7a0fab 100644 --- a/toolchain/check/testdata/class/fail_redeclaration_introducer.carbon +++ b/toolchain/check/testdata/class/fail_redeclaration_introducer.carbon @@ -77,31 +77,31 @@ base class G; // CHECK:STDOUT: --- fail_redeclaration_introducer.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc14: type = struct_type {} +// CHECK:STDOUT: %.loc14: type = struct_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %A.decl.loc7, .B = %B.decl.loc16, .C = %C.decl.loc25, .D = %D.decl.loc34, .E = %E.decl.loc43, .F = %F.decl.loc52, .G = %G.decl.loc61} // CHECK:STDOUT: %A.decl.loc7 = class_decl @A, () -// CHECK:STDOUT: %A: type = class_type @A +// CHECK:STDOUT: %A: type = class_type @A, const // CHECK:STDOUT: %A.decl.loc14 = class_decl @A, () // CHECK:STDOUT: %B.decl.loc16 = class_decl @B, () -// CHECK:STDOUT: %B: type = class_type @B +// CHECK:STDOUT: %B: type = class_type @B, const // CHECK:STDOUT: %B.decl.loc23 = class_decl @B, () // CHECK:STDOUT: %C.decl.loc25 = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C +// CHECK:STDOUT: %C: type = class_type @C, const // CHECK:STDOUT: %C.decl.loc32 = class_decl @C, () // CHECK:STDOUT: %D.decl.loc34 = class_decl @D, () -// CHECK:STDOUT: %D: type = class_type @D +// CHECK:STDOUT: %D: type = class_type @D, const // CHECK:STDOUT: %D.decl.loc41 = class_decl @D, () // CHECK:STDOUT: %E.decl.loc43 = class_decl @E, () -// CHECK:STDOUT: %E: type = class_type @E +// CHECK:STDOUT: %E: type = class_type @E, const // CHECK:STDOUT: %E.decl.loc50 = class_decl @E, () // CHECK:STDOUT: %F.decl.loc52 = class_decl @F, () -// CHECK:STDOUT: %F: type = class_type @F +// CHECK:STDOUT: %F: type = class_type @F, const // CHECK:STDOUT: %F.decl.loc59 = class_decl @F, () // CHECK:STDOUT: %G.decl.loc61 = class_decl @G, () -// CHECK:STDOUT: %G: type = class_type @G +// CHECK:STDOUT: %G: type = class_type @G, const // CHECK:STDOUT: %G.decl.loc68 = class_decl @G, () // CHECK:STDOUT: %G.decl.loc75 = class_decl @G, () // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_redeclaration_scope.carbon b/toolchain/check/testdata/class/fail_redeclaration_scope.carbon index 349dc141f3fa..b7f4dfa383f2 100644 --- a/toolchain/check/testdata/class/fail_redeclaration_scope.carbon +++ b/toolchain/check/testdata/class/fail_redeclaration_scope.carbon @@ -24,23 +24,23 @@ class Y { // CHECK:STDOUT: --- fail_redeclaration_scope.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc11: type = struct_type {} +// CHECK:STDOUT: %.loc11: type = struct_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %A.decl.loc7, .X = %X.decl, .Y = %Y.decl} // CHECK:STDOUT: %A.decl.loc7 = class_decl @A.1, () -// CHECK:STDOUT: %A: type = class_type @A.1 +// CHECK:STDOUT: %A: type = class_type @A.1, const // CHECK:STDOUT: %X.decl = class_decl @X, () -// CHECK:STDOUT: %X: type = class_type @X +// CHECK:STDOUT: %X: type = class_type @X, const // CHECK:STDOUT: %A.decl.loc15 = class_decl @A.1, () // CHECK:STDOUT: %Y.decl = class_decl @Y, () -// CHECK:STDOUT: %Y: type = class_type @Y +// CHECK:STDOUT: %Y: type = class_type @Y, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A.1 { // CHECK:STDOUT: %B.decl = class_decl @B.2, () -// CHECK:STDOUT: %B: type = class_type @B.2 +// CHECK:STDOUT: %B: type = class_type @B.2, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .B = %B.decl @@ -48,7 +48,7 @@ class Y { // CHECK:STDOUT: // CHECK:STDOUT: class @X { // CHECK:STDOUT: %A.decl = class_decl @A.2, () -// CHECK:STDOUT: %A: type = class_type @A.2 +// CHECK:STDOUT: %A: type = class_type @A.2, const // CHECK:STDOUT: %B.decl = class_decl @B.1, () // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -57,7 +57,7 @@ class Y { // CHECK:STDOUT: // CHECK:STDOUT: class @A.2 { // CHECK:STDOUT: %B.decl = class_decl @B.1, () -// CHECK:STDOUT: %B: type = class_type @B.1 +// CHECK:STDOUT: %B: type = class_type @B.1, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .B = %B.decl @@ -72,7 +72,7 @@ class Y { // CHECK:STDOUT: // CHECK:STDOUT: class @Y { // CHECK:STDOUT: %.decl = class_decl @.1, () -// CHECK:STDOUT: %.loc21: type = class_type @.1 +// CHECK:STDOUT: %.loc21: type = class_type @.1, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_redefinition.carbon b/toolchain/check/testdata/class/fail_redefinition.carbon index ff26a20e94f2..b2fe8f96e597 100644 --- a/toolchain/check/testdata/class/fail_redefinition.carbon +++ b/toolchain/check/testdata/class/fail_redefinition.carbon @@ -27,22 +27,22 @@ fn Class.H() {} // CHECK:STDOUT: --- fail_redefinition.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10: type = struct_type {} +// CHECK:STDOUT: %.loc10: type = struct_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl.loc7} // CHECK:STDOUT: %Class.decl.loc7 = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class +// CHECK:STDOUT: %Class: type = class_type @Class, const // CHECK:STDOUT: %Class.decl.loc18 = class_decl @Class, () -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %H: = fn_decl @H +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %H: = fn_decl @H, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %H: = fn_decl @H +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %H: = fn_decl @H, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = diff --git a/toolchain/check/testdata/class/fail_reorder.carbon b/toolchain/check/testdata/class/fail_reorder.carbon index beb9258d2059..ae6439c47976 100644 --- a/toolchain/check/testdata/class/fail_reorder.carbon +++ b/toolchain/check/testdata/class/fail_reorder.carbon @@ -28,18 +28,19 @@ class Class { // CHECK:STDOUT: --- fail_reorder.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc26: type = struct_type {} +// CHECK:STDOUT: %.loc24: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc26: type = struct_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class +// CHECK:STDOUT: %Class: type = class_type @Class, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .G = %G @@ -48,14 +49,14 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class, const = file.%Class // CHECK:STDOUT: %F.ref: = name_ref F, // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc24: i32 = int_literal 1 +// CHECK:STDOUT: %.loc24: i32 = int_literal 1, const = constants.%.loc24 // CHECK:STDOUT: return %.loc24 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_scope.carbon b/toolchain/check/testdata/class/fail_scope.carbon index cf57d3336552..cb6d5d812810 100644 --- a/toolchain/check/testdata/class/fail_scope.carbon +++ b/toolchain/check/testdata/class/fail_scope.carbon @@ -20,18 +20,19 @@ fn G() -> i32 { // CHECK:STDOUT: --- fail_scope.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc11: type = struct_type {} +// CHECK:STDOUT: %.loc9: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc11: type = struct_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .G = %G} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class -// CHECK:STDOUT: %G: = fn_decl @G +// CHECK:STDOUT: %Class: type = class_type @Class, const +// CHECK:STDOUT: %G: = fn_decl @G, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F @@ -39,7 +40,7 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9: i32 = int_literal 1 +// CHECK:STDOUT: %.loc9: i32 = int_literal 1, const = constants.%.loc9 // CHECK:STDOUT: return %.loc9 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_self.carbon b/toolchain/check/testdata/class/fail_self.carbon index e9b2736874af..a7cecaa3de2b 100644 --- a/toolchain/check/testdata/class/fail_self.carbon +++ b/toolchain/check/testdata/class/fail_self.carbon @@ -53,25 +53,25 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDOUT: --- fail_self.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc20_1.1: type = struct_type {} -// CHECK:STDOUT: %.loc20_1.2: type = tuple_type () -// CHECK:STDOUT: %.loc7: type = ptr_type {} +// CHECK:STDOUT: %.loc20_1.1: type = struct_type {}, const +// CHECK:STDOUT: %.loc20_1.2: type = tuple_type (), const +// CHECK:STDOUT: %.loc7: type = ptr_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .WrongSelf = %WrongSelf.decl, .CallWrongSelf = %CallWrongSelf} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class -// CHECK:STDOUT: %F: = fn_decl @F.1 -// CHECK:STDOUT: %G: = fn_decl @G +// CHECK:STDOUT: %Class: type = class_type @Class, const +// CHECK:STDOUT: %F: = fn_decl @F.1, const +// CHECK:STDOUT: %G: = fn_decl @G, const // CHECK:STDOUT: %WrongSelf.decl = class_decl @WrongSelf, () -// CHECK:STDOUT: %WrongSelf: type = class_type @WrongSelf -// CHECK:STDOUT: %CallWrongSelf: = fn_decl @CallWrongSelf +// CHECK:STDOUT: %WrongSelf: type = class_type @WrongSelf, const +// CHECK:STDOUT: %CallWrongSelf: = fn_decl @CallWrongSelf, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F.1 -// CHECK:STDOUT: %G: = fn_decl @G +// CHECK:STDOUT: %F: = fn_decl @F.1, const +// CHECK:STDOUT: %G: = fn_decl @G, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F @@ -79,7 +79,7 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @WrongSelf { -// CHECK:STDOUT: %F: = fn_decl @F.2 +// CHECK:STDOUT: %F: = fn_decl @F.2, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F @@ -92,7 +92,7 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> %return: Class { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class, const = file.%Class // CHECK:STDOUT: %self.var: ref Class = var self // CHECK:STDOUT: %self: ref Class = bind_name self, %self.var // CHECK:STDOUT: %self.ref: ref Class = name_ref self, %self diff --git a/toolchain/check/testdata/class/fail_todo_modifiers.carbon b/toolchain/check/testdata/class/fail_todo_modifiers.carbon index 95e9670cf404..6aff4469b112 100644 --- a/toolchain/check/testdata/class/fail_todo_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_todo_modifiers.carbon @@ -61,29 +61,29 @@ abstract class Abstract { // CHECK:STDOUT: --- fail_todo_modifiers.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc28: type = struct_type {.k: i32, .l: i32} -// CHECK:STDOUT: %.loc41: type = struct_type {} +// CHECK:STDOUT: %.loc28: type = struct_type {.k: i32, .l: i32}, const +// CHECK:STDOUT: %.loc41: type = struct_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Access = %Access.decl, .Base = %Base.decl, .Abstract = %Abstract.decl} // CHECK:STDOUT: %Access.decl = class_decl @Access, () -// CHECK:STDOUT: %Access: type = class_type @Access +// CHECK:STDOUT: %Access: type = class_type @Access, const // CHECK:STDOUT: %Base.decl = class_decl @Base, () -// CHECK:STDOUT: %Base: type = class_type @Base +// CHECK:STDOUT: %Base: type = class_type @Base, const // CHECK:STDOUT: %Abstract.decl = class_decl @Abstract, () -// CHECK:STDOUT: %Abstract: type = class_type @Abstract +// CHECK:STDOUT: %Abstract: type = class_type @Abstract, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Access { -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %.loc22_16.1: type = unbound_element_type Access, i32 -// CHECK:STDOUT: %.loc22_16.2: = field_decl k, element0 -// CHECK:STDOUT: %k: = bind_name k, %.loc22_16.2 -// CHECK:STDOUT: %.loc27_18.1: type = unbound_element_type Access, i32 -// CHECK:STDOUT: %.loc27_18.2: = field_decl l, element1 -// CHECK:STDOUT: %l: = bind_name l, %.loc27_18.2 +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %.loc22_16.1: type = unbound_element_type Access, i32, const +// CHECK:STDOUT: %.loc22_16.2: = field_decl k, element0, const +// CHECK:STDOUT: %k: = bind_name k, %.loc22_16.2, const = %.loc22_16.2 +// CHECK:STDOUT: %.loc27_18.1: type = unbound_element_type Access, i32, const +// CHECK:STDOUT: %.loc27_18.2: = field_decl l, element1, const +// CHECK:STDOUT: %l: = bind_name l, %.loc27_18.2, const = %.loc27_18.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F @@ -93,8 +93,8 @@ abstract class Abstract { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %H: = fn_decl @H -// CHECK:STDOUT: %I: = fn_decl @I +// CHECK:STDOUT: %H: = fn_decl @H, const +// CHECK:STDOUT: %I: = fn_decl @I, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .H = %H @@ -102,9 +102,9 @@ abstract class Abstract { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Abstract { -// CHECK:STDOUT: %J: = fn_decl @J -// CHECK:STDOUT: %K: = fn_decl @K -// CHECK:STDOUT: %L: = fn_decl @L +// CHECK:STDOUT: %J: = fn_decl @J, const +// CHECK:STDOUT: %K: = fn_decl @K, const +// CHECK:STDOUT: %L: = fn_decl @L, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .J = %J diff --git a/toolchain/check/testdata/class/fail_unbound_field.carbon b/toolchain/check/testdata/class/fail_unbound_field.carbon index 9817fc7e1ad0..f012d1d0f902 100644 --- a/toolchain/check/testdata/class/fail_unbound_field.carbon +++ b/toolchain/check/testdata/class/fail_unbound_field.carbon @@ -24,21 +24,21 @@ fn G() -> i32 { // CHECK:STDOUT: --- fail_unbound_field.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc15: type = struct_type {.field: i32} +// CHECK:STDOUT: %.loc15: type = struct_type {.field: i32}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .G = %G} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class -// CHECK:STDOUT: %G: = fn_decl @G +// CHECK:STDOUT: %Class: type = class_type @Class, const +// CHECK:STDOUT: %G: = fn_decl @G, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8_12.1: type = unbound_element_type Class, i32 -// CHECK:STDOUT: %.loc8_12.2: = field_decl field, element0 -// CHECK:STDOUT: %field: = bind_name field, %.loc8_12.2 -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %.loc8_12.1: type = unbound_element_type Class, i32, const +// CHECK:STDOUT: %.loc8_12.2: = field_decl field, element0, const +// CHECK:STDOUT: %field: = bind_name field, %.loc8_12.2, const = %.loc8_12.2 +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .field = %field @@ -47,14 +47,14 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %field.ref: = name_ref field, @Class.%field +// CHECK:STDOUT: %field.ref: = name_ref field, @Class.%field, const = @Class.%.loc8_12.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class -// CHECK:STDOUT: %field.ref: = name_ref field, @Class.%field +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class, const = file.%Class +// CHECK:STDOUT: %field.ref: = name_ref field, @Class.%field, const = @Class.%.loc8_12.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_unknown_member.carbon b/toolchain/check/testdata/class/fail_unknown_member.carbon index 9d916e80bf04..713c5dc9949a 100644 --- a/toolchain/check/testdata/class/fail_unknown_member.carbon +++ b/toolchain/check/testdata/class/fail_unknown_member.carbon @@ -19,21 +19,21 @@ fn G(c: Class) -> i32 { // CHECK:STDOUT: --- fail_unknown_member.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc9: type = struct_type {.n: i32} -// CHECK:STDOUT: %.loc7: type = ptr_type {.n: i32} +// CHECK:STDOUT: %.loc9: type = struct_type {.n: i32}, const +// CHECK:STDOUT: %.loc7: type = ptr_type {.n: i32}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .G = %G} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class -// CHECK:STDOUT: %G: = fn_decl @G +// CHECK:STDOUT: %Class: type = class_type @Class, const +// CHECK:STDOUT: %G: = fn_decl @G, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32 -// CHECK:STDOUT: %.loc8_8.2: = field_decl n, element0 -// CHECK:STDOUT: %n: = bind_name n, %.loc8_8.2 +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32, const +// CHECK:STDOUT: %.loc8_8.2: = field_decl n, element0, const +// CHECK:STDOUT: %n: = bind_name n, %.loc8_8.2, const = %.loc8_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .n = %n diff --git a/toolchain/check/testdata/class/field_access.carbon b/toolchain/check/testdata/class/field_access.carbon index 32662d9bdb74..e81f5fad905e 100644 --- a/toolchain/check/testdata/class/field_access.carbon +++ b/toolchain/check/testdata/class/field_access.carbon @@ -20,24 +20,26 @@ fn Run() { // CHECK:STDOUT: --- field_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10_1.1: type = struct_type {.j: i32, .k: i32} -// CHECK:STDOUT: %.loc10_1.2: type = ptr_type {.j: i32, .k: i32} +// CHECK:STDOUT: %.loc10_1.1: type = struct_type {.j: i32, .k: i32}, const +// CHECK:STDOUT: %.loc10_1.2: type = ptr_type {.j: i32, .k: i32}, const +// CHECK:STDOUT: %.loc14: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc15: i32 = int_literal 2, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .Run = %Run} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class -// CHECK:STDOUT: %Run: = fn_decl @Run +// CHECK:STDOUT: %Class: type = class_type @Class, const +// CHECK:STDOUT: %Run: = fn_decl @Run, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32 -// CHECK:STDOUT: %.loc8_8.2: = field_decl j, element0 -// CHECK:STDOUT: %j: = bind_name j, %.loc8_8.2 -// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, i32 -// CHECK:STDOUT: %.loc9_8.2: = field_decl k, element1 -// CHECK:STDOUT: %k: = bind_name k, %.loc9_8.2 +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32, const +// CHECK:STDOUT: %.loc8_8.2: = field_decl j, element0, const +// CHECK:STDOUT: %j: = bind_name j, %.loc8_8.2, const = %.loc8_8.2 +// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, i32, const +// CHECK:STDOUT: %.loc9_8.2: = field_decl k, element1, const +// CHECK:STDOUT: %k: = bind_name k, %.loc9_8.2, const = %.loc9_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .j = %j @@ -46,16 +48,16 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class, const = file.%Class // CHECK:STDOUT: %c.var: ref Class = var c // CHECK:STDOUT: %c: ref Class = bind_name c, %c.var // CHECK:STDOUT: %c.ref.loc14: ref Class = name_ref c, %c // CHECK:STDOUT: %.loc14_4: ref i32 = class_element_access %c.ref.loc14, element0 -// CHECK:STDOUT: %.loc14_9: i32 = int_literal 1 +// CHECK:STDOUT: %.loc14_9: i32 = int_literal 1, const = constants.%.loc14 // CHECK:STDOUT: assign %.loc14_4, %.loc14_9 // CHECK:STDOUT: %c.ref.loc15: ref Class = name_ref c, %c // CHECK:STDOUT: %.loc15_4: ref i32 = class_element_access %c.ref.loc15, element1 -// CHECK:STDOUT: %.loc15_9: i32 = int_literal 2 +// CHECK:STDOUT: %.loc15_9: i32 = int_literal 2, const = constants.%.loc15 // CHECK:STDOUT: assign %.loc15_4, %.loc15_9 // CHECK:STDOUT: %cj.var: ref i32 = var cj // CHECK:STDOUT: %cj: ref i32 = bind_name cj, %cj.var diff --git a/toolchain/check/testdata/class/field_access_in_value.carbon b/toolchain/check/testdata/class/field_access_in_value.carbon index 7cfa7c23bbce..79c4b8cee6c2 100644 --- a/toolchain/check/testdata/class/field_access_in_value.carbon +++ b/toolchain/check/testdata/class/field_access_in_value.carbon @@ -21,24 +21,26 @@ fn Test() { // CHECK:STDOUT: --- field_access_in_value.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10_1.1: type = struct_type {.j: i32, .k: i32} -// CHECK:STDOUT: %.loc10_1.2: type = ptr_type {.j: i32, .k: i32} +// CHECK:STDOUT: %.loc10_1.1: type = struct_type {.j: i32, .k: i32}, const +// CHECK:STDOUT: %.loc10_1.2: type = ptr_type {.j: i32, .k: i32}, const +// CHECK:STDOUT: %.loc14: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc15: i32 = int_literal 2, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .Test = %Test} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class -// CHECK:STDOUT: %Test: = fn_decl @Test +// CHECK:STDOUT: %Class: type = class_type @Class, const +// CHECK:STDOUT: %Test: = fn_decl @Test, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32 -// CHECK:STDOUT: %.loc8_8.2: = field_decl j, element0 -// CHECK:STDOUT: %j: = bind_name j, %.loc8_8.2 -// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, i32 -// CHECK:STDOUT: %.loc9_8.2: = field_decl k, element1 -// CHECK:STDOUT: %k: = bind_name k, %.loc9_8.2 +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32, const +// CHECK:STDOUT: %.loc8_8.2: = field_decl j, element0, const +// CHECK:STDOUT: %j: = bind_name j, %.loc8_8.2, const = %.loc8_8.2 +// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, i32, const +// CHECK:STDOUT: %.loc9_8.2: = field_decl k, element1, const +// CHECK:STDOUT: %k: = bind_name k, %.loc9_8.2, const = %.loc9_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .j = %j @@ -47,18 +49,18 @@ fn Test() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Test() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref.loc13: type = name_ref Class, file.%Class +// CHECK:STDOUT: %Class.ref.loc13: type = name_ref Class, file.%Class, const = file.%Class // CHECK:STDOUT: %cv.var: ref Class = var cv // CHECK:STDOUT: %cv: ref Class = bind_name cv, %cv.var // CHECK:STDOUT: %cv.ref.loc14: ref Class = name_ref cv, %cv // CHECK:STDOUT: %.loc14_5: ref i32 = class_element_access %cv.ref.loc14, element0 -// CHECK:STDOUT: %.loc14_10: i32 = int_literal 1 +// CHECK:STDOUT: %.loc14_10: i32 = int_literal 1, const = constants.%.loc14 // CHECK:STDOUT: assign %.loc14_5, %.loc14_10 // CHECK:STDOUT: %cv.ref.loc15: ref Class = name_ref cv, %cv // CHECK:STDOUT: %.loc15_5: ref i32 = class_element_access %cv.ref.loc15, element1 -// CHECK:STDOUT: %.loc15_10: i32 = int_literal 2 +// CHECK:STDOUT: %.loc15_10: i32 = int_literal 2, const = constants.%.loc15 // CHECK:STDOUT: assign %.loc15_5, %.loc15_10 -// CHECK:STDOUT: %Class.ref.loc16: type = name_ref Class, file.%Class +// CHECK:STDOUT: %Class.ref.loc16: type = name_ref Class, file.%Class, const = file.%Class // CHECK:STDOUT: %cv.ref.loc16: ref Class = name_ref cv, %cv // CHECK:STDOUT: %.loc16: Class = bind_value %cv.ref.loc16 // CHECK:STDOUT: %c: Class = bind_name c, %.loc16 diff --git a/toolchain/check/testdata/class/forward_declared.carbon b/toolchain/check/testdata/class/forward_declared.carbon index eec8a579e135..dc141b6b0f4a 100644 --- a/toolchain/check/testdata/class/forward_declared.carbon +++ b/toolchain/check/testdata/class/forward_declared.carbon @@ -13,8 +13,8 @@ fn F(p: Class*) -> Class* { return p; } // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .F = %F} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %Class: type = class_type @Class, const +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class; diff --git a/toolchain/check/testdata/class/init.carbon b/toolchain/check/testdata/class/init.carbon index f25340762a86..734cbb675451 100644 --- a/toolchain/check/testdata/class/init.carbon +++ b/toolchain/check/testdata/class/init.carbon @@ -20,28 +20,28 @@ fn MakeReorder(n: i32, next: Class*) -> Class { // CHECK:STDOUT: --- init.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10_1.1: type = struct_type {.n: i32, .next: Class*} -// CHECK:STDOUT: %.loc10_1.2: type = ptr_type {.n: i32, .next: Class*} -// CHECK:STDOUT: %.loc17: type = struct_type {.next: Class*, .n: i32} +// CHECK:STDOUT: %.loc10_1.1: type = struct_type {.n: i32, .next: Class*}, const +// CHECK:STDOUT: %.loc10_1.2: type = ptr_type {.n: i32, .next: Class*}, const +// CHECK:STDOUT: %.loc17: type = struct_type {.next: Class*, .n: i32}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .Make = %Make, .MakeReorder = %MakeReorder} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class -// CHECK:STDOUT: %Make: = fn_decl @Make -// CHECK:STDOUT: %MakeReorder: = fn_decl @MakeReorder +// CHECK:STDOUT: %Class: type = class_type @Class, const +// CHECK:STDOUT: %Make: = fn_decl @Make, const +// CHECK:STDOUT: %MakeReorder: = fn_decl @MakeReorder, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32 -// CHECK:STDOUT: %.loc8_8.2: = field_decl n, element0 -// CHECK:STDOUT: %n: = bind_name n, %.loc8_8.2 -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class -// CHECK:STDOUT: %.loc9_18: type = ptr_type Class -// CHECK:STDOUT: %.loc9_11.1: type = unbound_element_type Class, Class* -// CHECK:STDOUT: %.loc9_11.2: = field_decl next, element1 -// CHECK:STDOUT: %next: = bind_name next, %.loc9_11.2 +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32, const +// CHECK:STDOUT: %.loc8_8.2: = field_decl n, element0, const +// CHECK:STDOUT: %n: = bind_name n, %.loc8_8.2, const = %.loc8_8.2 +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class, const = file.%Class +// CHECK:STDOUT: %.loc9_18: type = ptr_type Class, const +// CHECK:STDOUT: %.loc9_11.1: type = unbound_element_type Class, Class*, const +// CHECK:STDOUT: %.loc9_11.2: = field_decl next, element1, const +// CHECK:STDOUT: %next: = bind_name next, %.loc9_11.2, const = %.loc9_11.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .n = %n diff --git a/toolchain/check/testdata/class/init_as.carbon b/toolchain/check/testdata/class/init_as.carbon index d1c59bb1dc3b..1995c14945b8 100644 --- a/toolchain/check/testdata/class/init_as.carbon +++ b/toolchain/check/testdata/class/init_as.carbon @@ -16,24 +16,26 @@ fn F() -> i32 { // CHECK:STDOUT: --- init_as.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10_1.1: type = struct_type {.a: i32, .b: i32} -// CHECK:STDOUT: %.loc10_1.2: type = ptr_type {.a: i32, .b: i32} +// CHECK:STDOUT: %.loc10_1.1: type = struct_type {.a: i32, .b: i32}, const +// CHECK:STDOUT: %.loc13_17: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc13_25: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc10_1.2: type = ptr_type {.a: i32, .b: i32}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .F = %F} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %Class: type = class_type @Class, const +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32 -// CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0 -// CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2 -// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, i32 -// CHECK:STDOUT: %.loc9_8.2: = field_decl b, element1 -// CHECK:STDOUT: %b: = bind_name b, %.loc9_8.2 +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Class, i32, const +// CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0, const +// CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2, const = %.loc8_8.2 +// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, i32, const +// CHECK:STDOUT: %.loc9_8.2: = field_decl b, element1, const +// CHECK:STDOUT: %b: = bind_name b, %.loc9_8.2, const = %.loc9_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .a = %a @@ -42,10 +44,10 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc13_17: i32 = int_literal 1 -// CHECK:STDOUT: %.loc13_25: i32 = int_literal 2 +// CHECK:STDOUT: %.loc13_17: i32 = int_literal 1, const = constants.%.loc13_17 +// CHECK:STDOUT: %.loc13_25: i32 = int_literal 2, const = constants.%.loc13_25 // CHECK:STDOUT: %.loc13_26.1: {.a: i32, .b: i32} = struct_literal (%.loc13_17, %.loc13_25) -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class, const = file.%Class // CHECK:STDOUT: %.loc13_26.2: ref Class = temporary_storage // CHECK:STDOUT: %.loc13_26.3: ref i32 = class_element_access %.loc13_26.2, element0 // CHECK:STDOUT: %.loc13_26.4: init i32 = initialize_from %.loc13_17 to %.loc13_26.3 diff --git a/toolchain/check/testdata/class/init_nested.carbon b/toolchain/check/testdata/class/init_nested.carbon index 985eb3facc17..7532256f144b 100644 --- a/toolchain/check/testdata/class/init_nested.carbon +++ b/toolchain/check/testdata/class/init_nested.carbon @@ -23,31 +23,31 @@ fn MakeOuter() -> Outer { // CHECK:STDOUT: --- init_nested.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10_1.1: type = struct_type {.a: i32, .b: i32} -// CHECK:STDOUT: %.loc10_1.2: type = ptr_type {.a: i32, .b: i32} -// CHECK:STDOUT: %.loc17_1.1: type = struct_type {.c: Inner, .d: Inner} -// CHECK:STDOUT: %.loc17_1.2: type = struct_type {.c: {.a: i32, .b: i32}*, .d: {.a: i32, .b: i32}*} -// CHECK:STDOUT: %.loc17_1.3: type = ptr_type {.c: {.a: i32, .b: i32}*, .d: {.a: i32, .b: i32}*} -// CHECK:STDOUT: %.loc14: type = ptr_type {.c: Inner, .d: Inner} +// CHECK:STDOUT: %.loc10_1.1: type = struct_type {.a: i32, .b: i32}, const +// CHECK:STDOUT: %.loc10_1.2: type = ptr_type {.a: i32, .b: i32}, const +// CHECK:STDOUT: %.loc17_1.1: type = struct_type {.c: Inner, .d: Inner}, const +// CHECK:STDOUT: %.loc17_1.2: type = struct_type {.c: {.a: i32, .b: i32}*, .d: {.a: i32, .b: i32}*}, const +// CHECK:STDOUT: %.loc17_1.3: type = ptr_type {.c: {.a: i32, .b: i32}*, .d: {.a: i32, .b: i32}*}, const +// CHECK:STDOUT: %.loc14: type = ptr_type {.c: Inner, .d: Inner}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Inner = %Inner.decl, .MakeInner = %MakeInner, .Outer = %Outer.decl, .MakeOuter = %MakeOuter} // CHECK:STDOUT: %Inner.decl = class_decl @Inner, () -// CHECK:STDOUT: %Inner: type = class_type @Inner -// CHECK:STDOUT: %MakeInner: = fn_decl @MakeInner +// CHECK:STDOUT: %Inner: type = class_type @Inner, const +// CHECK:STDOUT: %MakeInner: = fn_decl @MakeInner, const // CHECK:STDOUT: %Outer.decl = class_decl @Outer, () -// CHECK:STDOUT: %Outer: type = class_type @Outer -// CHECK:STDOUT: %MakeOuter: = fn_decl @MakeOuter +// CHECK:STDOUT: %Outer: type = class_type @Outer, const +// CHECK:STDOUT: %MakeOuter: = fn_decl @MakeOuter, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Inner { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Inner, i32 -// CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0 -// CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2 -// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Inner, i32 -// CHECK:STDOUT: %.loc9_8.2: = field_decl b, element1 -// CHECK:STDOUT: %b: = bind_name b, %.loc9_8.2 +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Inner, i32, const +// CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0, const +// CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2, const = %.loc8_8.2 +// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Inner, i32, const +// CHECK:STDOUT: %.loc9_8.2: = field_decl b, element1, const +// CHECK:STDOUT: %b: = bind_name b, %.loc9_8.2, const = %.loc9_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .a = %a @@ -55,14 +55,14 @@ fn MakeOuter() -> Outer { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Outer { -// CHECK:STDOUT: %Inner.ref.loc15: type = name_ref Inner, file.%Inner -// CHECK:STDOUT: %.loc15_8.1: type = unbound_element_type Outer, Inner -// CHECK:STDOUT: %.loc15_8.2: = field_decl c, element0 -// CHECK:STDOUT: %c: = bind_name c, %.loc15_8.2 -// CHECK:STDOUT: %Inner.ref.loc16: type = name_ref Inner, file.%Inner -// CHECK:STDOUT: %.loc16_8.1: type = unbound_element_type Outer, Inner -// CHECK:STDOUT: %.loc16_8.2: = field_decl d, element1 -// CHECK:STDOUT: %d: = bind_name d, %.loc16_8.2 +// CHECK:STDOUT: %Inner.ref.loc15: type = name_ref Inner, file.%Inner, const = file.%Inner +// CHECK:STDOUT: %.loc15_8.1: type = unbound_element_type Outer, Inner, const +// CHECK:STDOUT: %.loc15_8.2: = field_decl c, element0, const +// CHECK:STDOUT: %c: = bind_name c, %.loc15_8.2, const = %.loc15_8.2 +// CHECK:STDOUT: %Inner.ref.loc16: type = name_ref Inner, file.%Inner, const = file.%Inner +// CHECK:STDOUT: %.loc16_8.1: type = unbound_element_type Outer, Inner, const +// CHECK:STDOUT: %.loc16_8.2: = field_decl d, element1, const +// CHECK:STDOUT: %d: = bind_name d, %.loc16_8.2, const = %.loc16_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .c = %c @@ -73,10 +73,10 @@ fn MakeOuter() -> Outer { // CHECK:STDOUT: // CHECK:STDOUT: fn @MakeOuter() -> %return: Outer { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %MakeInner.ref.loc20_16: = name_ref MakeInner, file.%MakeInner +// CHECK:STDOUT: %MakeInner.ref.loc20_16: = name_ref MakeInner, file.%MakeInner, const = file.%MakeInner // CHECK:STDOUT: %.loc20_45.1: ref Inner = class_element_access %return, element0 // CHECK:STDOUT: %.loc20_25: init Inner = call %MakeInner.ref.loc20_16() to %.loc20_45.1 -// CHECK:STDOUT: %MakeInner.ref.loc20_34: = name_ref MakeInner, file.%MakeInner +// CHECK:STDOUT: %MakeInner.ref.loc20_34: = name_ref MakeInner, file.%MakeInner, const = file.%MakeInner // CHECK:STDOUT: %.loc20_45.2: ref Inner = class_element_access %return, element1 // CHECK:STDOUT: %.loc20_43: init Inner = call %MakeInner.ref.loc20_34() to %.loc20_45.2 // CHECK:STDOUT: %.loc20_45.3: {.c: Inner, .d: Inner} = struct_literal (%.loc20_25, %.loc20_43) diff --git a/toolchain/check/testdata/class/method.carbon b/toolchain/check/testdata/class/method.carbon index 722db48969fb..8adb13827003 100644 --- a/toolchain/check/testdata/class/method.carbon +++ b/toolchain/check/testdata/class/method.carbon @@ -47,30 +47,30 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: --- method.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc12: type = struct_type {.k: i32} -// CHECK:STDOUT: %.loc7: type = ptr_type {.k: i32} +// CHECK:STDOUT: %.loc12: type = struct_type {.k: i32}, const +// CHECK:STDOUT: %.loc7: type = ptr_type {.k: i32}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .Call = %Call, .CallWithAddr = %CallWithAddr, .CallFThroughPointer = %CallFThroughPointer, .CallGThroughPointer = %CallGThroughPointer, .Make = %Make, .CallFOnInitializingExpr = %CallFOnInitializingExpr, .CallGOnInitializingExpr = %CallGOnInitializingExpr} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %Call: = fn_decl @Call -// CHECK:STDOUT: %CallWithAddr: = fn_decl @CallWithAddr -// CHECK:STDOUT: %CallFThroughPointer: = fn_decl @CallFThroughPointer -// CHECK:STDOUT: %CallGThroughPointer: = fn_decl @CallGThroughPointer -// CHECK:STDOUT: %Make: = fn_decl @Make -// CHECK:STDOUT: %CallFOnInitializingExpr: = fn_decl @CallFOnInitializingExpr -// CHECK:STDOUT: %CallGOnInitializingExpr: = fn_decl @CallGOnInitializingExpr +// CHECK:STDOUT: %Class: type = class_type @Class, const +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %Call: = fn_decl @Call, const +// CHECK:STDOUT: %CallWithAddr: = fn_decl @CallWithAddr, const +// CHECK:STDOUT: %CallFThroughPointer: = fn_decl @CallFThroughPointer, const +// CHECK:STDOUT: %CallGThroughPointer: = fn_decl @CallGThroughPointer, const +// CHECK:STDOUT: %Make: = fn_decl @Make, const +// CHECK:STDOUT: %CallFOnInitializingExpr: = fn_decl @CallFOnInitializingExpr, const +// CHECK:STDOUT: %CallGOnInitializingExpr: = fn_decl @CallGOnInitializingExpr, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %.loc11_8.1: type = unbound_element_type Class, i32 -// CHECK:STDOUT: %.loc11_8.2: = field_decl k, element0 -// CHECK:STDOUT: %k: = bind_name k, %.loc11_8.2 +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %.loc11_8.1: type = unbound_element_type Class, i32, const +// CHECK:STDOUT: %.loc11_8.2: = field_decl k, element0, const +// CHECK:STDOUT: %k: = bind_name k, %.loc11_8.2, const = %.loc11_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F @@ -100,7 +100,7 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @CallWithAddr() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class, const = file.%Class // CHECK:STDOUT: %c.var: ref Class = var c // CHECK:STDOUT: %c: ref Class = bind_name c, %c.var // CHECK:STDOUT: %c.ref: ref Class = name_ref c, %c @@ -140,7 +140,7 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @CallFOnInitializingExpr() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Make.ref: = name_ref Make, file.%Make +// CHECK:STDOUT: %Make.ref: = name_ref Make, file.%Make, const = file.%Make // CHECK:STDOUT: %.loc40_14.1: ref Class = temporary_storage // CHECK:STDOUT: %.loc40_14.2: init Class = call %Make.ref() to %.loc40_14.1 // CHECK:STDOUT: %.loc40_14.3: ref Class = temporary %.loc40_14.1, %.loc40_14.2 @@ -154,7 +154,7 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Make.ref: = name_ref Make, file.%Make +// CHECK:STDOUT: %Make.ref: = name_ref Make, file.%Make, const = file.%Make // CHECK:STDOUT: %.loc44_14.1: ref Class = temporary_storage // CHECK:STDOUT: %.loc44_14.2: init Class = call %Make.ref() to %.loc44_14.1 // CHECK:STDOUT: %.loc44_14.3: ref Class = temporary %.loc44_14.1, %.loc44_14.2 diff --git a/toolchain/check/testdata/class/nested.carbon b/toolchain/check/testdata/class/nested.carbon index aab1ac76653b..3d7f01a3e7e9 100644 --- a/toolchain/check/testdata/class/nested.carbon +++ b/toolchain/check/testdata/class/nested.carbon @@ -31,37 +31,37 @@ fn F(a: Outer*) { // CHECK:STDOUT: --- nested.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc12_3.1: type = struct_type {.pi: Inner*, .po: Outer*, .qi: Inner*} -// CHECK:STDOUT: %.loc17_1.1: type = struct_type {.po: Outer*, .qo: Outer*, .pi: Inner*} -// CHECK:STDOUT: %.loc17_1.2: type = ptr_type {.po: Outer*, .qo: Outer*, .pi: Inner*} -// CHECK:STDOUT: %.loc12_3.2: type = ptr_type {.pi: Inner*, .po: Outer*, .qi: Inner*} +// CHECK:STDOUT: %.loc12_3.1: type = struct_type {.pi: Inner*, .po: Outer*, .qi: Inner*}, const +// CHECK:STDOUT: %.loc17_1.1: type = struct_type {.po: Outer*, .qo: Outer*, .pi: Inner*}, const +// CHECK:STDOUT: %.loc17_1.2: type = ptr_type {.po: Outer*, .qo: Outer*, .pi: Inner*}, const +// CHECK:STDOUT: %.loc12_3.2: type = ptr_type {.pi: Inner*, .po: Outer*, .qi: Inner*}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Outer = %Outer.decl, .F = %F} // CHECK:STDOUT: %Outer.decl = class_decl @Outer, () -// CHECK:STDOUT: %Outer: type = class_type @Outer -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %Outer: type = class_type @Outer, const +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Outer { // CHECK:STDOUT: %Inner.decl = class_decl @Inner, () -// CHECK:STDOUT: %Inner: type = class_type @Inner -// CHECK:STDOUT: %Self.ref: type = name_ref Self, file.%Outer -// CHECK:STDOUT: %.loc14_15: type = ptr_type Outer -// CHECK:STDOUT: %.loc14_9.1: type = unbound_element_type Outer, Outer* -// CHECK:STDOUT: %.loc14_9.2: = field_decl po, element0 -// CHECK:STDOUT: %po: = bind_name po, %.loc14_9.2 -// CHECK:STDOUT: %Outer.ref: type = name_ref Outer, file.%Outer -// CHECK:STDOUT: %.loc15_16: type = ptr_type Outer -// CHECK:STDOUT: %.loc15_9.1: type = unbound_element_type Outer, Outer* -// CHECK:STDOUT: %.loc15_9.2: = field_decl qo, element1 -// CHECK:STDOUT: %qo: = bind_name qo, %.loc15_9.2 -// CHECK:STDOUT: %Inner.ref: type = name_ref Inner, %Inner -// CHECK:STDOUT: %.loc16_16: type = ptr_type Inner -// CHECK:STDOUT: %.loc16_9.1: type = unbound_element_type Outer, Inner* -// CHECK:STDOUT: %.loc16_9.2: = field_decl pi, element2 -// CHECK:STDOUT: %pi: = bind_name pi, %.loc16_9.2 +// CHECK:STDOUT: %Inner: type = class_type @Inner, const +// CHECK:STDOUT: %Self.ref: type = name_ref Self, file.%Outer, const = file.%Outer +// CHECK:STDOUT: %.loc14_15: type = ptr_type Outer, const +// CHECK:STDOUT: %.loc14_9.1: type = unbound_element_type Outer, Outer*, const +// CHECK:STDOUT: %.loc14_9.2: = field_decl po, element0, const +// CHECK:STDOUT: %po: = bind_name po, %.loc14_9.2, const = %.loc14_9.2 +// CHECK:STDOUT: %Outer.ref: type = name_ref Outer, file.%Outer, const = file.%Outer +// CHECK:STDOUT: %.loc15_16: type = ptr_type Outer, const +// CHECK:STDOUT: %.loc15_9.1: type = unbound_element_type Outer, Outer*, const +// CHECK:STDOUT: %.loc15_9.2: = field_decl qo, element1, const +// CHECK:STDOUT: %qo: = bind_name qo, %.loc15_9.2, const = %.loc15_9.2 +// CHECK:STDOUT: %Inner.ref: type = name_ref Inner, %Inner, const = %Inner +// CHECK:STDOUT: %.loc16_16: type = ptr_type Inner, const +// CHECK:STDOUT: %.loc16_9.1: type = unbound_element_type Outer, Inner*, const +// CHECK:STDOUT: %.loc16_9.2: = field_decl pi, element2, const +// CHECK:STDOUT: %pi: = bind_name pi, %.loc16_9.2, const = %.loc16_9.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Inner = %Inner.decl @@ -71,21 +71,21 @@ fn F(a: Outer*) { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Inner { -// CHECK:STDOUT: %Self.ref: type = name_ref Self, @Outer.%Inner -// CHECK:STDOUT: %.loc9_17: type = ptr_type Inner -// CHECK:STDOUT: %.loc9_11.1: type = unbound_element_type Inner, Inner* -// CHECK:STDOUT: %.loc9_11.2: = field_decl pi, element0 -// CHECK:STDOUT: %pi: = bind_name pi, %.loc9_11.2 -// CHECK:STDOUT: %Outer.ref: type = name_ref Outer, file.%Outer -// CHECK:STDOUT: %.loc10_18: type = ptr_type Outer -// CHECK:STDOUT: %.loc10_11.1: type = unbound_element_type Inner, Outer* -// CHECK:STDOUT: %.loc10_11.2: = field_decl po, element1 -// CHECK:STDOUT: %po: = bind_name po, %.loc10_11.2 -// CHECK:STDOUT: %Inner.ref: type = name_ref Inner, @Outer.%Inner -// CHECK:STDOUT: %.loc11_18: type = ptr_type Inner -// CHECK:STDOUT: %.loc11_11.1: type = unbound_element_type Inner, Inner* -// CHECK:STDOUT: %.loc11_11.2: = field_decl qi, element2 -// CHECK:STDOUT: %qi: = bind_name qi, %.loc11_11.2 +// CHECK:STDOUT: %Self.ref: type = name_ref Self, @Outer.%Inner, const = @Outer.%Inner +// CHECK:STDOUT: %.loc9_17: type = ptr_type Inner, const +// CHECK:STDOUT: %.loc9_11.1: type = unbound_element_type Inner, Inner*, const +// CHECK:STDOUT: %.loc9_11.2: = field_decl pi, element0, const +// CHECK:STDOUT: %pi: = bind_name pi, %.loc9_11.2, const = %.loc9_11.2 +// CHECK:STDOUT: %Outer.ref: type = name_ref Outer, file.%Outer, const = file.%Outer +// CHECK:STDOUT: %.loc10_18: type = ptr_type Outer, const +// CHECK:STDOUT: %.loc10_11.1: type = unbound_element_type Inner, Outer*, const +// CHECK:STDOUT: %.loc10_11.2: = field_decl po, element1, const +// CHECK:STDOUT: %po: = bind_name po, %.loc10_11.2, const = %.loc10_11.2 +// CHECK:STDOUT: %Inner.ref: type = name_ref Inner, @Outer.%Inner, const = @Outer.%Inner +// CHECK:STDOUT: %.loc11_18: type = ptr_type Inner, const +// CHECK:STDOUT: %.loc11_11.1: type = unbound_element_type Inner, Inner*, const +// CHECK:STDOUT: %.loc11_11.2: = field_decl qi, element2, const +// CHECK:STDOUT: %qi: = bind_name qi, %.loc11_11.2, const = %.loc11_11.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .pi = %pi diff --git a/toolchain/check/testdata/class/nested_name.carbon b/toolchain/check/testdata/class/nested_name.carbon index 5f519c1b3d84..fc415790d998 100644 --- a/toolchain/check/testdata/class/nested_name.carbon +++ b/toolchain/check/testdata/class/nested_name.carbon @@ -21,33 +21,33 @@ fn G(o: Outer) { // CHECK:STDOUT: --- nested_name.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10: type = struct_type {.n: i32} -// CHECK:STDOUT: %.loc11_1.1: type = struct_type {} -// CHECK:STDOUT: %.loc8: type = ptr_type {.n: i32} -// CHECK:STDOUT: %.loc11_1.2: type = tuple_type () -// CHECK:STDOUT: %.loc7: type = ptr_type {} +// CHECK:STDOUT: %.loc10: type = struct_type {.n: i32}, const +// CHECK:STDOUT: %.loc11_1.1: type = struct_type {}, const +// CHECK:STDOUT: %.loc8: type = ptr_type {.n: i32}, const +// CHECK:STDOUT: %.loc11_1.2: type = tuple_type (), const +// CHECK:STDOUT: %.loc7: type = ptr_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Outer = %Outer.decl, .F = %F, .G = %G} // CHECK:STDOUT: %Outer.decl = class_decl @Outer, () -// CHECK:STDOUT: %Outer: type = class_type @Outer -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G +// CHECK:STDOUT: %Outer: type = class_type @Outer, const +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Outer { // CHECK:STDOUT: %Inner.decl = class_decl @Inner, () -// CHECK:STDOUT: %Inner: type = class_type @Inner +// CHECK:STDOUT: %Inner: type = class_type @Inner, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Inner = %Inner.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Inner { -// CHECK:STDOUT: %.loc9_10.1: type = unbound_element_type Inner, i32 -// CHECK:STDOUT: %.loc9_10.2: = field_decl n, element0 -// CHECK:STDOUT: %n: = bind_name n, %.loc9_10.2 +// CHECK:STDOUT: %.loc9_10.1: type = unbound_element_type Inner, i32, const +// CHECK:STDOUT: %.loc9_10.2: = field_decl n, element0, const +// CHECK:STDOUT: %n: = bind_name n, %.loc9_10.2, const = %.loc9_10.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .n = %n @@ -64,7 +64,7 @@ fn G(o: Outer) { // CHECK:STDOUT: fn @G(%o: Outer) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %o.ref: Outer = name_ref o, %o -// CHECK:STDOUT: %Inner.ref: type = name_ref Inner, @Outer.%Inner +// CHECK:STDOUT: %Inner.ref: type = name_ref Inner, @Outer.%Inner, const = @Outer.%Inner // CHECK:STDOUT: %i.var: ref Inner = var i // CHECK:STDOUT: %i: ref Inner = bind_name i, %i.var // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/class/raw_self.carbon b/toolchain/check/testdata/class/raw_self.carbon index 338316fd652e..67acb89dfd7c 100644 --- a/toolchain/check/testdata/class/raw_self.carbon +++ b/toolchain/check/testdata/class/raw_self.carbon @@ -21,27 +21,27 @@ fn Class.G[self: Class](r#self: i32) -> (i32, i32) { // CHECK:STDOUT: --- raw_self.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc9_46.1: type = tuple_type (type, type) -// CHECK:STDOUT: %.loc9_46.2: type = tuple_type (i32, i32) -// CHECK:STDOUT: %.loc9_46.3: type = ptr_type (i32, i32) -// CHECK:STDOUT: %.loc11: type = struct_type {.n: i32} -// CHECK:STDOUT: %.loc7: type = ptr_type {.n: i32} +// CHECK:STDOUT: %.loc9_46.1: type = tuple_type (type, type), const +// CHECK:STDOUT: %.loc9_46.2: type = tuple_type (i32, i32), const +// CHECK:STDOUT: %.loc9_46.3: type = ptr_type (i32, i32), const +// CHECK:STDOUT: %.loc11: type = struct_type {.n: i32}, const +// CHECK:STDOUT: %.loc7: type = ptr_type {.n: i32}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G +// CHECK:STDOUT: %Class: type = class_type @Class, const +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %.loc10_8.1: type = unbound_element_type Class, i32 -// CHECK:STDOUT: %.loc10_8.2: = field_decl n, element0 -// CHECK:STDOUT: %n: = bind_name n, %.loc10_8.2 +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %.loc10_8.1: type = unbound_element_type Class, i32, const +// CHECK:STDOUT: %.loc10_8.2: = field_decl n, element0, const +// CHECK:STDOUT: %n: = bind_name n, %.loc10_8.2, const = %.loc10_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F diff --git a/toolchain/check/testdata/class/raw_self_type.carbon b/toolchain/check/testdata/class/raw_self_type.carbon index afd70f95a5a5..faac4ce49939 100644 --- a/toolchain/check/testdata/class/raw_self_type.carbon +++ b/toolchain/check/testdata/class/raw_self_type.carbon @@ -14,17 +14,17 @@ class Class { // CHECK:STDOUT: --- raw_self_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc12: type = struct_type {} +// CHECK:STDOUT: %.loc12: type = struct_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class +// CHECK:STDOUT: %Class: type = class_type @Class, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F @@ -32,12 +32,12 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Self.ref.loc9: type = name_ref Self, file.%Class -// CHECK:STDOUT: %.loc9: type = ptr_type Class +// CHECK:STDOUT: %Self.ref.loc9: type = name_ref Self, file.%Class, const = file.%Class +// CHECK:STDOUT: %.loc9: type = ptr_type Class, const // CHECK:STDOUT: %Self.var: ref Class* = var r#Self // CHECK:STDOUT: %Self: ref Class* = bind_name r#Self, %Self.var -// CHECK:STDOUT: %Self.ref.loc10_12: type = name_ref Self, file.%Class -// CHECK:STDOUT: %.loc10_16: type = ptr_type Class +// CHECK:STDOUT: %Self.ref.loc10_12: type = name_ref Self, file.%Class, const = file.%Class +// CHECK:STDOUT: %.loc10_16: type = ptr_type Class, const // CHECK:STDOUT: %p.var: ref Class* = var p // CHECK:STDOUT: %p: ref Class* = bind_name p, %p.var // CHECK:STDOUT: %Self.ref.loc10_20: ref Class* = name_ref r#Self, %Self diff --git a/toolchain/check/testdata/class/redeclaration.carbon b/toolchain/check/testdata/class/redeclaration.carbon index 81b30d003c0f..67452dfb0ce3 100644 --- a/toolchain/check/testdata/class/redeclaration.carbon +++ b/toolchain/check/testdata/class/redeclaration.carbon @@ -15,19 +15,19 @@ fn Class.F() {} // CHECK:STDOUT: --- redeclaration.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc11: type = struct_type {} +// CHECK:STDOUT: %.loc11: type = struct_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl.loc7} // CHECK:STDOUT: %Class.decl.loc7 = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class +// CHECK:STDOUT: %Class: type = class_type @Class, const // CHECK:STDOUT: %Class.decl.loc9 = class_decl @Class, () -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F diff --git a/toolchain/check/testdata/class/redeclaration_introducer.carbon b/toolchain/check/testdata/class/redeclaration_introducer.carbon index fb1966229299..a889056898e9 100644 --- a/toolchain/check/testdata/class/redeclaration_introducer.carbon +++ b/toolchain/check/testdata/class/redeclaration_introducer.carbon @@ -15,17 +15,17 @@ abstract class C {} // CHECK:STDOUT: --- redeclaration_introducer.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc11: type = struct_type {} +// CHECK:STDOUT: %.loc11: type = struct_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %A.decl.loc7, .B = %B.decl.loc8, .C = %C.decl.loc9} // CHECK:STDOUT: %A.decl.loc7 = class_decl @A, () -// CHECK:STDOUT: %A: type = class_type @A +// CHECK:STDOUT: %A: type = class_type @A, const // CHECK:STDOUT: %B.decl.loc8 = class_decl @B, () -// CHECK:STDOUT: %B: type = class_type @B +// CHECK:STDOUT: %B: type = class_type @B, const // CHECK:STDOUT: %C.decl.loc9 = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C +// CHECK:STDOUT: %C: type = class_type @C, const // CHECK:STDOUT: %A.decl.loc11 = class_decl @A, () // CHECK:STDOUT: %B.decl.loc12 = class_decl @B, () // CHECK:STDOUT: %C.decl.loc13 = class_decl @C, () diff --git a/toolchain/check/testdata/class/reenter_scope.carbon b/toolchain/check/testdata/class/reenter_scope.carbon index 0175de322183..c2fb1876b821 100644 --- a/toolchain/check/testdata/class/reenter_scope.carbon +++ b/toolchain/check/testdata/class/reenter_scope.carbon @@ -16,19 +16,19 @@ fn Class.F() -> i32 { // CHECK:STDOUT: --- reenter_scope.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10: type = struct_type {} +// CHECK:STDOUT: %.loc10: type = struct_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %Class: type = class_type @Class, const +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F @@ -37,7 +37,7 @@ fn Class.F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %G.ref: = name_ref G, @Class.%G +// CHECK:STDOUT: %G.ref: = name_ref G, @Class.%G, const = @Class.%G // CHECK:STDOUT: %.loc13_11: init i32 = call %G.ref() // CHECK:STDOUT: %.loc13_13.1: i32 = value_of_initializer %.loc13_11 // CHECK:STDOUT: %.loc13_13.2: i32 = converted %.loc13_11, %.loc13_13.1 diff --git a/toolchain/check/testdata/class/scope.carbon b/toolchain/check/testdata/class/scope.carbon index d5fd095631e9..be924e9bbce9 100644 --- a/toolchain/check/testdata/class/scope.carbon +++ b/toolchain/check/testdata/class/scope.carbon @@ -26,20 +26,22 @@ fn Run() { // CHECK:STDOUT: --- scope.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc15: type = struct_type {} +// CHECK:STDOUT: %.loc9: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc15: type = struct_type {}, const +// CHECK:STDOUT: %.loc18: i32 = int_literal 2, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .F = %F, .Run = %Run} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class -// CHECK:STDOUT: %F: = fn_decl @F.2 -// CHECK:STDOUT: %Run: = fn_decl @Run +// CHECK:STDOUT: %Class: type = class_type @Class, const +// CHECK:STDOUT: %F: = fn_decl @F.2, const +// CHECK:STDOUT: %Run: = fn_decl @Run, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F.1 -// CHECK:STDOUT: %G: = fn_decl @G +// CHECK:STDOUT: %F: = fn_decl @F.1, const +// CHECK:STDOUT: %G: = fn_decl @G, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F @@ -48,13 +50,13 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F.1() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9: i32 = int_literal 1 +// CHECK:STDOUT: %.loc9: i32 = int_literal 1, const = constants.%.loc9 // CHECK:STDOUT: return %.loc9 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, @Class.%F +// CHECK:STDOUT: %F.ref: = name_ref F, @Class.%F, const = @Class.%F // CHECK:STDOUT: %.loc13_13: init i32 = call %F.ref() // CHECK:STDOUT: %.loc13_15.1: i32 = value_of_initializer %.loc13_13 // CHECK:STDOUT: %.loc13_15.2: i32 = converted %.loc13_13, %.loc13_15.1 @@ -63,7 +65,7 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F.2() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc18: i32 = int_literal 2 +// CHECK:STDOUT: %.loc18: i32 = int_literal 2, const = constants.%.loc18 // CHECK:STDOUT: return %.loc18 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -71,13 +73,13 @@ fn Run() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %F.ref.loc22: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref.loc22: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc22: init i32 = call %F.ref.loc22() // CHECK:STDOUT: assign %a.var, %.loc22 // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class -// CHECK:STDOUT: %F.ref.loc23: = name_ref F, @Class.%F +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class, const = file.%Class +// CHECK:STDOUT: %F.ref.loc23: = name_ref F, @Class.%F, const = @Class.%F // CHECK:STDOUT: %.loc23: init i32 = call %F.ref.loc23() // CHECK:STDOUT: assign %b.var, %.loc23 // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/class/self.carbon b/toolchain/check/testdata/class/self.carbon index d9239452f332..3ee0347e809e 100644 --- a/toolchain/check/testdata/class/self.carbon +++ b/toolchain/check/testdata/class/self.carbon @@ -22,24 +22,24 @@ fn Class.G[addr self: Class*]() -> i32 { // CHECK:STDOUT: --- self.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc12: type = struct_type {.n: i32} -// CHECK:STDOUT: %.loc7: type = ptr_type {.n: i32} +// CHECK:STDOUT: %.loc12: type = struct_type {.n: i32}, const +// CHECK:STDOUT: %.loc7: type = ptr_type {.n: i32}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G +// CHECK:STDOUT: %Class: type = class_type @Class, const +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %.loc11_8.1: type = unbound_element_type Class, i32 -// CHECK:STDOUT: %.loc11_8.2: = field_decl n, element0 -// CHECK:STDOUT: %n: = bind_name n, %.loc11_8.2 +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %.loc11_8.1: type = unbound_element_type Class, i32, const +// CHECK:STDOUT: %.loc11_8.2: = field_decl n, element0, const +// CHECK:STDOUT: %n: = bind_name n, %.loc11_8.2, const = %.loc11_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F diff --git a/toolchain/check/testdata/class/self_conversion.carbon b/toolchain/check/testdata/class/self_conversion.carbon index 9e5f34d3d96b..bf63fe00dd5c 100644 --- a/toolchain/check/testdata/class/self_conversion.carbon +++ b/toolchain/check/testdata/class/self_conversion.carbon @@ -31,40 +31,41 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: --- self_conversion.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc9: type = struct_type {.a: i32} -// CHECK:STDOUT: %.loc7: type = ptr_type {.a: i32} -// CHECK:STDOUT: %.loc16_1.1: type = struct_type {.base: Base} -// CHECK:STDOUT: %.loc16_1.2: type = struct_type {.base: {.a: i32}*} -// CHECK:STDOUT: %.loc11: type = ptr_type {.base: Base} -// CHECK:STDOUT: %.loc27: type = tuple_type () +// CHECK:STDOUT: %.loc9: type = struct_type {.a: i32}, const +// CHECK:STDOUT: %.loc7: type = ptr_type {.a: i32}, const +// CHECK:STDOUT: %.loc16_1.1: type = struct_type {.base: Base}, const +// CHECK:STDOUT: %.loc23: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc16_1.2: type = struct_type {.base: {.a: i32}*}, const +// CHECK:STDOUT: %.loc11: type = ptr_type {.base: Base}, const +// CHECK:STDOUT: %.loc27: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Base = %Base.decl, .Derived = %Derived.decl, .Call = %Call} // CHECK:STDOUT: %Base.decl = class_decl @Base, () -// CHECK:STDOUT: %Base: type = class_type @Base +// CHECK:STDOUT: %Base: type = class_type @Base, const // CHECK:STDOUT: %Derived.decl = class_decl @Derived, () -// CHECK:STDOUT: %Derived: type = class_type @Derived -// CHECK:STDOUT: %SelfBase: = fn_decl @SelfBase -// CHECK:STDOUT: %AddrSelfBase: = fn_decl @AddrSelfBase -// CHECK:STDOUT: %Call: = fn_decl @Call +// CHECK:STDOUT: %Derived: type = class_type @Derived, const +// CHECK:STDOUT: %SelfBase: = fn_decl @SelfBase, const +// CHECK:STDOUT: %AddrSelfBase: = fn_decl @AddrSelfBase, const +// CHECK:STDOUT: %Call: = fn_decl @Call, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Base, i32 -// CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0 -// CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2 +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type Base, i32, const +// CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0, const +// CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2, const = %.loc8_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .a = %a // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { -// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base -// CHECK:STDOUT: %.loc12_20.1: type = unbound_element_type Derived, Base -// CHECK:STDOUT: %.loc12_20.2: = base_decl Base, element0 -// CHECK:STDOUT: %SelfBase: = fn_decl @SelfBase -// CHECK:STDOUT: %AddrSelfBase: = fn_decl @AddrSelfBase +// CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base, const = file.%Base +// CHECK:STDOUT: %.loc12_20.1: type = unbound_element_type Derived, Base, const +// CHECK:STDOUT: %.loc12_20.2: = base_decl Base, element0, const +// CHECK:STDOUT: %SelfBase: = fn_decl @SelfBase, const +// CHECK:STDOUT: %AddrSelfBase: = fn_decl @AddrSelfBase, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .base = %.loc12_20.2 @@ -86,7 +87,7 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: %self.ref: Base* = name_ref self, %self // CHECK:STDOUT: %.loc23_4: ref Base = deref %self.ref // CHECK:STDOUT: %.loc23_10: ref i32 = class_element_access %.loc23_4, element0 -// CHECK:STDOUT: %.loc23_15: i32 = int_literal 1 +// CHECK:STDOUT: %.loc23_15: i32 = int_literal 1, const = constants.%.loc23 // CHECK:STDOUT: assign %.loc23_10, %.loc23_15 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/self_type.carbon b/toolchain/check/testdata/class/self_type.carbon index 9a42a6c67001..565e9a91c349 100644 --- a/toolchain/check/testdata/class/self_type.carbon +++ b/toolchain/check/testdata/class/self_type.carbon @@ -19,24 +19,24 @@ fn Class.F[self: Class]() -> i32 { // CHECK:STDOUT: --- self_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10: type = struct_type {.p: Class*} -// CHECK:STDOUT: %.loc7: type = ptr_type {.p: Class*} +// CHECK:STDOUT: %.loc10: type = struct_type {.p: Class*}, const +// CHECK:STDOUT: %.loc7: type = ptr_type {.p: Class*}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %Class: type = class_type @Class, const +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %Self.ref: type = name_ref Self, file.%Class -// CHECK:STDOUT: %.loc9_14: type = ptr_type Class -// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, Class* -// CHECK:STDOUT: %.loc9_8.2: = field_decl p, element0 -// CHECK:STDOUT: %p: = bind_name p, %.loc9_8.2 +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %Self.ref: type = name_ref Self, file.%Class, const = file.%Class +// CHECK:STDOUT: %.loc9_14: type = ptr_type Class, const +// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type Class, Class*, const +// CHECK:STDOUT: %.loc9_8.2: = field_decl p, element0, const +// CHECK:STDOUT: %p: = bind_name p, %.loc9_8.2, const = %.loc9_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F diff --git a/toolchain/check/testdata/class/static_method.carbon b/toolchain/check/testdata/class/static_method.carbon index 8b9b6462e8a1..0ecb1f18db8a 100644 --- a/toolchain/check/testdata/class/static_method.carbon +++ b/toolchain/check/testdata/class/static_method.carbon @@ -16,20 +16,20 @@ fn Run() -> i32 { // CHECK:STDOUT: --- static_method.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc9_1.1: type = struct_type {} -// CHECK:STDOUT: %.loc9_1.2: type = tuple_type () -// CHECK:STDOUT: %.loc7: type = ptr_type {} +// CHECK:STDOUT: %.loc9_1.1: type = struct_type {}, const +// CHECK:STDOUT: %.loc9_1.2: type = tuple_type (), const +// CHECK:STDOUT: %.loc7: type = ptr_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Class = %Class.decl, .Run = %Run} // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class -// CHECK:STDOUT: %Run: = fn_decl @Run +// CHECK:STDOUT: %Class: type = class_type @Class, const +// CHECK:STDOUT: %Run: = fn_decl @Run, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F @@ -39,11 +39,11 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class +// CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class, const = file.%Class // CHECK:STDOUT: %c.var: ref Class = var c // CHECK:STDOUT: %c: ref Class = bind_name c, %c.var // CHECK:STDOUT: %c.ref: ref Class = name_ref c, %c -// CHECK:STDOUT: %F.ref: = name_ref F, @Class.%F +// CHECK:STDOUT: %F.ref: = name_ref F, @Class.%F, const = @Class.%F // CHECK:STDOUT: %.loc13_13: init i32 = call %F.ref() // CHECK:STDOUT: %.loc13_15.1: i32 = value_of_initializer %.loc13_13 // CHECK:STDOUT: %.loc13_15.2: i32 = converted %.loc13_13, %.loc13_15.1 diff --git a/toolchain/check/testdata/const/collapse.carbon b/toolchain/check/testdata/const/collapse.carbon index 626d58cdb4da..ad58f03ca44d 100644 --- a/toolchain/check/testdata/const/collapse.carbon +++ b/toolchain/check/testdata/const/collapse.carbon @@ -16,7 +16,7 @@ fn F(p: const i32**) -> const (const i32)** { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%p: const i32**) -> const i32** { diff --git a/toolchain/check/testdata/const/fail_collapse.carbon b/toolchain/check/testdata/const/fail_collapse.carbon index 262344cb65ca..ea330010844e 100644 --- a/toolchain/check/testdata/const/fail_collapse.carbon +++ b/toolchain/check/testdata/const/fail_collapse.carbon @@ -18,7 +18,7 @@ fn G(p: const (const i32)**) -> i32** { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.G = %G} -// CHECK:STDOUT: %G: = fn_decl @G +// CHECK:STDOUT: %G: = fn_decl @G, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%p: const i32**) -> i32** { diff --git a/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon b/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon index 6b46e03364a3..980c7c9aa41d 100644 --- a/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon +++ b/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon @@ -19,16 +19,17 @@ fn H() -> i32 { // CHECK:STDOUT: --- in_place_tuple_init.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_20.1: type = tuple_type (type, type) -// CHECK:STDOUT: %.loc7_20.2: type = tuple_type (i32, i32) -// CHECK:STDOUT: %.loc7_20.3: type = ptr_type (i32, i32) +// CHECK:STDOUT: %.loc7_20.1: type = tuple_type (type, type), const +// CHECK:STDOUT: %.loc7_20.2: type = tuple_type (i32, i32), const +// CHECK:STDOUT: %.loc7_20.3: type = ptr_type (i32, i32), const +// CHECK:STDOUT: %.loc16: i32 = int_literal 0, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F, .G = %G, .H = %H} -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %H: = fn_decl @H +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %H: = fn_decl @H, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %return: (i32, i32); @@ -39,16 +40,16 @@ fn H() -> i32 { // CHECK:STDOUT: %.loc7: type = converted %.loc10_19, constants.%.loc7_20.2 // CHECK:STDOUT: %v.var: ref (i32, i32) = var v // CHECK:STDOUT: %v: ref (i32, i32) = bind_name v, %v.var -// CHECK:STDOUT: %F.ref.loc10: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref.loc10: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc10_7: ref (i32, i32) = splice_block %v.var {} // CHECK:STDOUT: %.loc10_24: init (i32, i32) = call %F.ref.loc10() to %.loc10_7 // CHECK:STDOUT: assign %v.var, %.loc10_24 // CHECK:STDOUT: %v.ref: ref (i32, i32) = name_ref v, %v -// CHECK:STDOUT: %F.ref.loc11: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref.loc11: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc11_3: ref (i32, i32) = splice_block %v.ref {} // CHECK:STDOUT: %.loc11_8: init (i32, i32) = call %F.ref.loc11() to %.loc11_3 // CHECK:STDOUT: assign %v.ref, %.loc11_8 -// CHECK:STDOUT: %F.ref.loc12: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref.loc12: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc9: ref (i32, i32) = splice_block %return {} // CHECK:STDOUT: %.loc12: init (i32, i32) = call %F.ref.loc12() to %.loc9 // CHECK:STDOUT: return %.loc12 @@ -56,10 +57,10 @@ fn H() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @H() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G +// CHECK:STDOUT: %G.ref: = name_ref G, file.%G, const = file.%G // CHECK:STDOUT: %.loc16_11.1: ref (i32, i32) = temporary_storage // CHECK:STDOUT: %.loc16_11.2: init (i32, i32) = call %G.ref() to %.loc16_11.1 -// CHECK:STDOUT: %.loc16_14: i32 = int_literal 0 +// CHECK:STDOUT: %.loc16_14: i32 = int_literal 0, const = constants.%.loc16 // CHECK:STDOUT: %.loc16_11.3: ref (i32, i32) = temporary %.loc16_11.1, %.loc16_11.2 // CHECK:STDOUT: %.loc16_15.1: ref i32 = tuple_index %.loc16_11.3, %.loc16_14 // CHECK:STDOUT: %.loc16_15.2: i32 = bind_value %.loc16_15.1 diff --git a/toolchain/check/testdata/function/call/empty_struct.carbon b/toolchain/check/testdata/function/call/empty_struct.carbon index b17e77769a90..f2eacd289979 100644 --- a/toolchain/check/testdata/function/call/empty_struct.carbon +++ b/toolchain/check/testdata/function/call/empty_struct.carbon @@ -15,14 +15,15 @@ fn Main() { // CHECK:STDOUT: --- empty_struct.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_13.1: type = struct_type {} -// CHECK:STDOUT: %.loc7_13.2: type = tuple_type () +// CHECK:STDOUT: %.loc7_13.1: type = struct_type {}, const +// CHECK:STDOUT: %.loc7_13.2: type = tuple_type (), const +// CHECK:STDOUT: %.loc12: {} = struct_value (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Echo = %Echo, .Main = %Main} -// CHECK:STDOUT: %Echo: = fn_decl @Echo -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Echo: = fn_decl @Echo, const +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Echo(%a: {}) -> {} { @@ -33,9 +34,9 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Echo.ref: = name_ref Echo, file.%Echo +// CHECK:STDOUT: %Echo.ref: = name_ref Echo, file.%Echo, const = file.%Echo // CHECK:STDOUT: %.loc12_9.1: {} = struct_literal () -// CHECK:STDOUT: %.loc12_9.2: {} = struct_value () +// CHECK:STDOUT: %.loc12_9.2: {} = struct_value (), const = constants.%.loc12 // CHECK:STDOUT: %.loc12_9.3: {} = converted %.loc12_9.1, %.loc12_9.2 // CHECK:STDOUT: %.loc12_7: init {} = call %Echo.ref(%.loc12_9.3) // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/function/call/empty_tuple.carbon b/toolchain/check/testdata/function/call/empty_tuple.carbon index 7f048e99c0d1..bd9682c9dfa3 100644 --- a/toolchain/check/testdata/function/call/empty_tuple.carbon +++ b/toolchain/check/testdata/function/call/empty_tuple.carbon @@ -15,13 +15,14 @@ fn Main() { // CHECK:STDOUT: --- empty_tuple.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7: type = tuple_type () +// CHECK:STDOUT: %.loc7: type = tuple_type (), const +// CHECK:STDOUT: %.loc12: () = tuple_value (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Echo = %Echo, .Main = %Main} -// CHECK:STDOUT: %Echo: = fn_decl @Echo -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Echo: = fn_decl @Echo, const +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Echo(%a: ()) -> () { @@ -32,9 +33,9 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Echo.ref: = name_ref Echo, file.%Echo +// CHECK:STDOUT: %Echo.ref: = name_ref Echo, file.%Echo, const = file.%Echo // CHECK:STDOUT: %.loc12_9.1: () = tuple_literal () -// CHECK:STDOUT: %.loc12_9.2: () = tuple_value () +// CHECK:STDOUT: %.loc12_9.2: () = tuple_value (), const = constants.%.loc12 // CHECK:STDOUT: %.loc12_9.3: () = converted %.loc12_9.1, %.loc12_9.2 // CHECK:STDOUT: %.loc12_7: init () = call %Echo.ref(%.loc12_9.3) // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/function/call/fail_not_callable.carbon b/toolchain/check/testdata/function/call/fail_not_callable.carbon index 2e8e5f35ec52..e440be92f8c3 100644 --- a/toolchain/check/testdata/function/call/fail_not_callable.carbon +++ b/toolchain/check/testdata/function/call/fail_not_callable.carbon @@ -14,19 +14,20 @@ fn Run() { // CHECK:STDOUT: --- fail_not_callable.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = ptr_type String +// CHECK:STDOUT: %.1: type = ptr_type String, const +// CHECK:STDOUT: %.loc11: String = string_literal "hello", const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Run = %Run} -// CHECK:STDOUT: %Run: = fn_decl @Run +// CHECK:STDOUT: %Run: = fn_decl @Run, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %.loc11: String = string_literal "hello" +// CHECK:STDOUT: %.loc11: String = string_literal "hello", const = constants.%.loc11 // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/fail_param_count.carbon b/toolchain/check/testdata/function/call/fail_param_count.carbon index ccac6a514e60..68d6a08f152d 100644 --- a/toolchain/check/testdata/function/call/fail_param_count.carbon +++ b/toolchain/check/testdata/function/call/fail_param_count.carbon @@ -58,15 +58,21 @@ fn Main() { // CHECK:STDOUT: --- fail_param_count.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc18: type = tuple_type () +// CHECK:STDOUT: %.loc18_8: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc18_7: type = tuple_type (), const +// CHECK:STDOUT: %.loc25_8: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc25_11: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc40_8: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc40_11: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc55: i32 = int_literal 0, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Run0 = %Run0, .Run1 = %Run1, .Run2 = %Run2, .Main = %Main} -// CHECK:STDOUT: %Run0: = fn_decl @Run0 -// CHECK:STDOUT: %Run1: = fn_decl @Run1 -// CHECK:STDOUT: %Run2: = fn_decl @Run2 -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Run0: = fn_decl @Run0, const +// CHECK:STDOUT: %Run1: = fn_decl @Run1, const +// CHECK:STDOUT: %Run2: = fn_decl @Run2, const +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run0() { @@ -86,23 +92,23 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Run0.ref.loc18: = name_ref Run0, file.%Run0 -// CHECK:STDOUT: %.loc18_8: i32 = int_literal 1 +// CHECK:STDOUT: %Run0.ref.loc18: = name_ref Run0, file.%Run0, const = file.%Run0 +// CHECK:STDOUT: %.loc18_8: i32 = int_literal 1, const = constants.%.loc18_8 // CHECK:STDOUT: %.loc18_7: init () = call %Run0.ref.loc18() -// CHECK:STDOUT: %Run0.ref.loc25: = name_ref Run0, file.%Run0 -// CHECK:STDOUT: %.loc25_8: i32 = int_literal 0 -// CHECK:STDOUT: %.loc25_11: i32 = int_literal 1 +// CHECK:STDOUT: %Run0.ref.loc25: = name_ref Run0, file.%Run0, const = file.%Run0 +// CHECK:STDOUT: %.loc25_8: i32 = int_literal 0, const = constants.%.loc25_8 +// CHECK:STDOUT: %.loc25_11: i32 = int_literal 1, const = constants.%.loc25_11 // CHECK:STDOUT: %.loc25_7: init () = call %Run0.ref.loc25() -// CHECK:STDOUT: %Run1.ref.loc33: = name_ref Run1, file.%Run1 +// CHECK:STDOUT: %Run1.ref.loc33: = name_ref Run1, file.%Run1, const = file.%Run1 // CHECK:STDOUT: %.loc33: init () = call %Run1.ref.loc33() -// CHECK:STDOUT: %Run1.ref.loc40: = name_ref Run1, file.%Run1 -// CHECK:STDOUT: %.loc40_8: i32 = int_literal 0 -// CHECK:STDOUT: %.loc40_11: i32 = int_literal 1 +// CHECK:STDOUT: %Run1.ref.loc40: = name_ref Run1, file.%Run1, const = file.%Run1 +// CHECK:STDOUT: %.loc40_8: i32 = int_literal 0, const = constants.%.loc40_8 +// CHECK:STDOUT: %.loc40_11: i32 = int_literal 1, const = constants.%.loc40_11 // CHECK:STDOUT: %.loc40_7: init () = call %Run1.ref.loc40() -// CHECK:STDOUT: %Run2.ref.loc48: = name_ref Run2, file.%Run2 +// CHECK:STDOUT: %Run2.ref.loc48: = name_ref Run2, file.%Run2, const = file.%Run2 // CHECK:STDOUT: %.loc48: init () = call %Run2.ref.loc48() -// CHECK:STDOUT: %Run2.ref.loc55: = name_ref Run2, file.%Run2 -// CHECK:STDOUT: %.loc55_8: i32 = int_literal 0 +// CHECK:STDOUT: %Run2.ref.loc55: = name_ref Run2, file.%Run2, const = file.%Run2 +// CHECK:STDOUT: %.loc55_8: i32 = int_literal 0, const = constants.%.loc55 // CHECK:STDOUT: %.loc55_7: init () = call %Run2.ref.loc55() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/fail_param_type.carbon b/toolchain/check/testdata/function/call/fail_param_type.carbon index ce76805b083e..6198bd15bbed 100644 --- a/toolchain/check/testdata/function/call/fail_param_type.carbon +++ b/toolchain/check/testdata/function/call/fail_param_type.carbon @@ -19,13 +19,14 @@ fn F() { // CHECK:STDOUT: --- fail_param_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc16: type = tuple_type () +// CHECK:STDOUT: %.loc16_5: f64 = real_literal 10e-1, const +// CHECK:STDOUT: %.loc16_4: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.G = %G, .F = %F} -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%a: i32) { @@ -35,8 +36,8 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G -// CHECK:STDOUT: %.loc16_5: f64 = real_literal 10e-1 +// CHECK:STDOUT: %G.ref: = name_ref G, file.%G, const = file.%G +// CHECK:STDOUT: %.loc16_5: f64 = real_literal 10e-1, const = constants.%.loc16_5 // CHECK:STDOUT: %.loc16_4: init () = call %G.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon b/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon index d442861b1601..5ac73e7c52a8 100644 --- a/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon +++ b/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon @@ -15,15 +15,19 @@ fn Run() { // CHECK:STDOUT: --- fail_return_type_mismatch.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc7: f64 = real_literal 10e-1, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Foo = %Foo, .Run = %Run} -// CHECK:STDOUT: %Foo: = fn_decl @Foo -// CHECK:STDOUT: %Run: = fn_decl @Run +// CHECK:STDOUT: %Foo: = fn_decl @Foo, const +// CHECK:STDOUT: %Run: = fn_decl @Run, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo() -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: f64 = real_literal 10e-1 +// CHECK:STDOUT: %.loc7: f64 = real_literal 10e-1, const = constants.%.loc7 // CHECK:STDOUT: return %.loc7 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -31,7 +35,7 @@ fn Run() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo +// CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo, const = file.%Foo // CHECK:STDOUT: %.loc13: init f64 = call %Foo.ref() // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/function/call/i32.carbon b/toolchain/check/testdata/function/call/i32.carbon index 5c5ad507c3cc..f4210f20218a 100644 --- a/toolchain/check/testdata/function/call/i32.carbon +++ b/toolchain/check/testdata/function/call/i32.carbon @@ -14,10 +14,14 @@ fn Main() { // CHECK:STDOUT: --- i32.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc12: i32 = int_literal 1, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Echo = %Echo, .Main = %Main} -// CHECK:STDOUT: %Echo: = fn_decl @Echo -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Echo: = fn_decl @Echo, const +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Echo(%a: i32) -> i32 { @@ -30,8 +34,8 @@ fn Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var -// CHECK:STDOUT: %Echo.ref: = name_ref Echo, file.%Echo -// CHECK:STDOUT: %.loc12_21: i32 = int_literal 1 +// CHECK:STDOUT: %Echo.ref: = name_ref Echo, file.%Echo, const = file.%Echo +// CHECK:STDOUT: %.loc12_21: i32 = int_literal 1, const = constants.%.loc12 // CHECK:STDOUT: %.loc12_20: init i32 = call %Echo.ref(%.loc12_21) // CHECK:STDOUT: assign %b.var, %.loc12_20 // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/function/call/more_param_ir.carbon b/toolchain/check/testdata/function/call/more_param_ir.carbon index 7c7cb36a5d7c..7f7a3b3ef0f7 100644 --- a/toolchain/check/testdata/function/call/more_param_ir.carbon +++ b/toolchain/check/testdata/function/call/more_param_ir.carbon @@ -15,15 +15,18 @@ fn Main() { // CHECK:STDOUT: --- more_param_ir.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10_15.1: type = tuple_type (type) -// CHECK:STDOUT: %.loc10_15.2: type = tuple_type (i32) -// CHECK:STDOUT: %.loc12: type = tuple_type () +// CHECK:STDOUT: %.loc10_15.1: type = tuple_type (type), const +// CHECK:STDOUT: %.loc10_15.2: type = tuple_type (i32), const +// CHECK:STDOUT: %.loc10_20: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc12_9: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc12_13: i32 = int_literal 6, const +// CHECK:STDOUT: %.loc12_6: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Foo = %Foo, .Main = %Main} -// CHECK:STDOUT: %Foo: = fn_decl @Foo -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Foo: = fn_decl @Foo, const +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) { @@ -37,16 +40,16 @@ fn Main() { // CHECK:STDOUT: %.loc10_15.2: type = converted %.loc10_15.1, constants.%.loc10_15.2 // CHECK:STDOUT: %x.var: ref (i32,) = var x // CHECK:STDOUT: %x: ref (i32,) = bind_name x, %x.var -// CHECK:STDOUT: %.loc10_20: i32 = int_literal 1 +// CHECK:STDOUT: %.loc10_20: i32 = int_literal 1, const = constants.%.loc10_20 // CHECK:STDOUT: %.loc10_22.1: (i32,) = tuple_literal (%.loc10_20) // CHECK:STDOUT: %.loc10_22.2: init (i32,) = tuple_init (%.loc10_20) to %x.var // CHECK:STDOUT: %.loc10_22.3: init (i32,) = converted %.loc10_22.1, %.loc10_22.2 // CHECK:STDOUT: assign %x.var, %.loc10_22.3 -// CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo +// CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo, const = file.%Foo // CHECK:STDOUT: %x.ref: ref (i32,) = name_ref x, %x -// CHECK:STDOUT: %.loc12_9: i32 = int_literal 0 +// CHECK:STDOUT: %.loc12_9: i32 = int_literal 0, const = constants.%.loc12_9 // CHECK:STDOUT: %.loc12_10.1: ref i32 = tuple_index %x.ref, %.loc12_9 -// CHECK:STDOUT: %.loc12_13: i32 = int_literal 6 +// CHECK:STDOUT: %.loc12_13: i32 = int_literal 6, const = constants.%.loc12_13 // CHECK:STDOUT: %.loc12_10.2: i32 = bind_value %.loc12_10.1 // CHECK:STDOUT: %.loc12_6: init () = call %Foo.ref(%.loc12_10.2, %.loc12_13) // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/function/call/params_one.carbon b/toolchain/check/testdata/function/call/params_one.carbon index 944fb15db29a..0529de057333 100644 --- a/toolchain/check/testdata/function/call/params_one.carbon +++ b/toolchain/check/testdata/function/call/params_one.carbon @@ -13,13 +13,14 @@ fn Main() { // CHECK:STDOUT: --- params_one.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10: type = tuple_type () +// CHECK:STDOUT: %.loc10_7: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc10_6: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Foo = %Foo, .Main = %Main} -// CHECK:STDOUT: %Foo: = fn_decl @Foo -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Foo: = fn_decl @Foo, const +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32) { @@ -29,8 +30,8 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo -// CHECK:STDOUT: %.loc10_7: i32 = int_literal 1 +// CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo, const = file.%Foo +// CHECK:STDOUT: %.loc10_7: i32 = int_literal 1, const = constants.%.loc10_7 // CHECK:STDOUT: %.loc10_6: init () = call %Foo.ref(%.loc10_7) // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/params_one_comma.carbon b/toolchain/check/testdata/function/call/params_one_comma.carbon index 86340f0ad43e..1304582e54da 100644 --- a/toolchain/check/testdata/function/call/params_one_comma.carbon +++ b/toolchain/check/testdata/function/call/params_one_comma.carbon @@ -14,13 +14,15 @@ fn Main() { // CHECK:STDOUT: --- params_one_comma.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10: type = tuple_type () +// CHECK:STDOUT: %.loc10_7: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc10_6: type = tuple_type (), const +// CHECK:STDOUT: %.loc11: i32 = int_literal 1, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Foo = %Foo, .Main = %Main} -// CHECK:STDOUT: %Foo: = fn_decl @Foo -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Foo: = fn_decl @Foo, const +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32) { @@ -30,11 +32,11 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Foo.ref.loc10: = name_ref Foo, file.%Foo -// CHECK:STDOUT: %.loc10_7: i32 = int_literal 1 +// CHECK:STDOUT: %Foo.ref.loc10: = name_ref Foo, file.%Foo, const = file.%Foo +// CHECK:STDOUT: %.loc10_7: i32 = int_literal 1, const = constants.%.loc10_7 // CHECK:STDOUT: %.loc10_6: init () = call %Foo.ref.loc10(%.loc10_7) -// CHECK:STDOUT: %Foo.ref.loc11: = name_ref Foo, file.%Foo -// CHECK:STDOUT: %.loc11_7: i32 = int_literal 1 +// CHECK:STDOUT: %Foo.ref.loc11: = name_ref Foo, file.%Foo, const = file.%Foo +// CHECK:STDOUT: %.loc11_7: i32 = int_literal 1, const = constants.%.loc11 // CHECK:STDOUT: %.loc11_6: init () = call %Foo.ref.loc11(%.loc11_7) // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/params_two.carbon b/toolchain/check/testdata/function/call/params_two.carbon index b0e8b39c8b06..f50d50930bea 100644 --- a/toolchain/check/testdata/function/call/params_two.carbon +++ b/toolchain/check/testdata/function/call/params_two.carbon @@ -13,13 +13,15 @@ fn Main() { // CHECK:STDOUT: --- params_two.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10: type = tuple_type () +// CHECK:STDOUT: %.loc10_7: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc10_10: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc10_6: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Foo = %Foo, .Main = %Main} -// CHECK:STDOUT: %Foo: = fn_decl @Foo -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Foo: = fn_decl @Foo, const +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) { @@ -29,9 +31,9 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo -// CHECK:STDOUT: %.loc10_7: i32 = int_literal 1 -// CHECK:STDOUT: %.loc10_10: i32 = int_literal 2 +// CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo, const = file.%Foo +// CHECK:STDOUT: %.loc10_7: i32 = int_literal 1, const = constants.%.loc10_7 +// CHECK:STDOUT: %.loc10_10: i32 = int_literal 2, const = constants.%.loc10_10 // CHECK:STDOUT: %.loc10_6: init () = call %Foo.ref(%.loc10_7, %.loc10_10) // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/params_two_comma.carbon b/toolchain/check/testdata/function/call/params_two_comma.carbon index 734c369ea031..e35d99da562b 100644 --- a/toolchain/check/testdata/function/call/params_two_comma.carbon +++ b/toolchain/check/testdata/function/call/params_two_comma.carbon @@ -14,13 +14,17 @@ fn Main() { // CHECK:STDOUT: --- params_two_comma.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10: type = tuple_type () +// CHECK:STDOUT: %.loc10_7: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc10_10: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc10_6: type = tuple_type (), const +// CHECK:STDOUT: %.loc11_7: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc11_10: i32 = int_literal 2, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Foo = %Foo, .Main = %Main} -// CHECK:STDOUT: %Foo: = fn_decl @Foo -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Foo: = fn_decl @Foo, const +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) { @@ -30,13 +34,13 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Foo.ref.loc10: = name_ref Foo, file.%Foo -// CHECK:STDOUT: %.loc10_7: i32 = int_literal 1 -// CHECK:STDOUT: %.loc10_10: i32 = int_literal 2 +// CHECK:STDOUT: %Foo.ref.loc10: = name_ref Foo, file.%Foo, const = file.%Foo +// CHECK:STDOUT: %.loc10_7: i32 = int_literal 1, const = constants.%.loc10_7 +// CHECK:STDOUT: %.loc10_10: i32 = int_literal 2, const = constants.%.loc10_10 // CHECK:STDOUT: %.loc10_6: init () = call %Foo.ref.loc10(%.loc10_7, %.loc10_10) -// CHECK:STDOUT: %Foo.ref.loc11: = name_ref Foo, file.%Foo -// CHECK:STDOUT: %.loc11_7: i32 = int_literal 1 -// CHECK:STDOUT: %.loc11_10: i32 = int_literal 2 +// CHECK:STDOUT: %Foo.ref.loc11: = name_ref Foo, file.%Foo, const = file.%Foo +// CHECK:STDOUT: %.loc11_7: i32 = int_literal 1, const = constants.%.loc11_7 +// CHECK:STDOUT: %.loc11_10: i32 = int_literal 2, const = constants.%.loc11_10 // CHECK:STDOUT: %.loc11_6: init () = call %Foo.ref.loc11(%.loc11_7, %.loc11_10) // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/params_zero.carbon b/toolchain/check/testdata/function/call/params_zero.carbon index 7d0a1b1a436e..712757229a83 100644 --- a/toolchain/check/testdata/function/call/params_zero.carbon +++ b/toolchain/check/testdata/function/call/params_zero.carbon @@ -13,13 +13,13 @@ fn Main() { // CHECK:STDOUT: --- params_zero.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10: type = tuple_type () +// CHECK:STDOUT: %.loc10: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Foo = %Foo, .Main = %Main} -// CHECK:STDOUT: %Foo: = fn_decl @Foo -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Foo: = fn_decl @Foo, const +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo() { @@ -29,7 +29,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo +// CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo, const = file.%Foo // CHECK:STDOUT: %.loc10: init () = call %Foo.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/return_implicit.carbon b/toolchain/check/testdata/function/call/return_implicit.carbon index 64f57ddda291..ffecdfaf6833 100644 --- a/toolchain/check/testdata/function/call/return_implicit.carbon +++ b/toolchain/check/testdata/function/call/return_implicit.carbon @@ -14,13 +14,13 @@ fn Main() { // CHECK:STDOUT: --- return_implicit.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc11: type = tuple_type () +// CHECK:STDOUT: %.loc11: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.MakeImplicitEmptyTuple = %MakeImplicitEmptyTuple, .Main = %Main} -// CHECK:STDOUT: %MakeImplicitEmptyTuple: = fn_decl @MakeImplicitEmptyTuple -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %MakeImplicitEmptyTuple: = fn_decl @MakeImplicitEmptyTuple, const +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @MakeImplicitEmptyTuple() { @@ -34,7 +34,7 @@ fn Main() { // CHECK:STDOUT: %.loc11_11.2: type = converted %.loc11_11.1, constants.%.loc11 // CHECK:STDOUT: %b.var: ref () = var b // CHECK:STDOUT: %b: ref () = bind_name b, %b.var -// CHECK:STDOUT: %MakeImplicitEmptyTuple.ref: = name_ref MakeImplicitEmptyTuple, file.%MakeImplicitEmptyTuple +// CHECK:STDOUT: %MakeImplicitEmptyTuple.ref: = name_ref MakeImplicitEmptyTuple, file.%MakeImplicitEmptyTuple, const = file.%MakeImplicitEmptyTuple // CHECK:STDOUT: %.loc11_37: init () = call %MakeImplicitEmptyTuple.ref() // CHECK:STDOUT: assign %b.var, %.loc11_37 // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/function/declaration/fail_modifiers.carbon b/toolchain/check/testdata/function/declaration/fail_modifiers.carbon index a80cfc632fb3..c24567007711 100644 --- a/toolchain/check/testdata/function/declaration/fail_modifiers.carbon +++ b/toolchain/check/testdata/function/declaration/fail_modifiers.carbon @@ -74,12 +74,12 @@ default final virtual fn ModifiersConflict2() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.WrongOrder = %WrongOrder, .DuplicateVirtual = %DuplicateVirtual, .TwoAccess = %TwoAccess, .ModifiersConflict = %ModifiersConflict, .InvalidModifier = %InvalidModifier, .ModifiersConflict2 = %ModifiersConflict2} -// CHECK:STDOUT: %WrongOrder: = fn_decl @WrongOrder -// CHECK:STDOUT: %DuplicateVirtual: = fn_decl @DuplicateVirtual -// CHECK:STDOUT: %TwoAccess: = fn_decl @TwoAccess -// CHECK:STDOUT: %ModifiersConflict: = fn_decl @ModifiersConflict -// CHECK:STDOUT: %InvalidModifier: = fn_decl @InvalidModifier -// CHECK:STDOUT: %ModifiersConflict2: = fn_decl @ModifiersConflict2 +// CHECK:STDOUT: %WrongOrder: = fn_decl @WrongOrder, const +// CHECK:STDOUT: %DuplicateVirtual: = fn_decl @DuplicateVirtual, const +// CHECK:STDOUT: %TwoAccess: = fn_decl @TwoAccess, const +// CHECK:STDOUT: %ModifiersConflict: = fn_decl @ModifiersConflict, const +// CHECK:STDOUT: %InvalidModifier: = fn_decl @InvalidModifier, const +// CHECK:STDOUT: %ModifiersConflict2: = fn_decl @ModifiersConflict2, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @WrongOrder(); diff --git a/toolchain/check/testdata/function/declaration/fail_todo_modifiers.carbon b/toolchain/check/testdata/function/declaration/fail_todo_modifiers.carbon index 156fe528133d..ef24f50f26f4 100644 --- a/toolchain/check/testdata/function/declaration/fail_todo_modifiers.carbon +++ b/toolchain/check/testdata/function/declaration/fail_todo_modifiers.carbon @@ -13,7 +13,7 @@ private fn F(); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(); diff --git a/toolchain/check/testdata/function/declaration/simple.carbon b/toolchain/check/testdata/function/declaration/simple.carbon index 03d3f2a64142..eb5e05623575 100644 --- a/toolchain/check/testdata/function/declaration/simple.carbon +++ b/toolchain/check/testdata/function/declaration/simple.carbon @@ -11,20 +11,20 @@ fn G() { F(); } // CHECK:STDOUT: --- simple.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc9: type = tuple_type () +// CHECK:STDOUT: %.loc9: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F, .G = %G} -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(); // CHECK:STDOUT: // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc9: init () = call %F.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/definition/fail_param_name_conflict.carbon b/toolchain/check/testdata/function/definition/fail_param_name_conflict.carbon index c48d02ccf617..8448b9040ec7 100644 --- a/toolchain/check/testdata/function/definition/fail_param_name_conflict.carbon +++ b/toolchain/check/testdata/function/definition/fail_param_name_conflict.carbon @@ -16,7 +16,7 @@ fn Bar(a: i32, a: i32) {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Bar = %Bar} -// CHECK:STDOUT: %Bar: = fn_decl @Bar +// CHECK:STDOUT: %Bar: = fn_decl @Bar, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Bar(%a.loc13_8: i32, %a.loc13_16: i32) { diff --git a/toolchain/check/testdata/function/definition/order.carbon b/toolchain/check/testdata/function/definition/order.carbon index 575e2cad80fd..5029b7a9e2e5 100644 --- a/toolchain/check/testdata/function/definition/order.carbon +++ b/toolchain/check/testdata/function/definition/order.carbon @@ -12,9 +12,9 @@ fn Baz() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Foo = %Foo, .Bar = %Bar, .Baz = %Baz} -// CHECK:STDOUT: %Foo: = fn_decl @Foo -// CHECK:STDOUT: %Bar: = fn_decl @Bar -// CHECK:STDOUT: %Baz: = fn_decl @Baz +// CHECK:STDOUT: %Foo: = fn_decl @Foo, const +// CHECK:STDOUT: %Bar: = fn_decl @Bar, const +// CHECK:STDOUT: %Baz: = fn_decl @Baz, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo() { diff --git a/toolchain/check/testdata/function/definition/params_one.carbon b/toolchain/check/testdata/function/definition/params_one.carbon index 2bfda88419b6..2f90bb1bbe64 100644 --- a/toolchain/check/testdata/function/definition/params_one.carbon +++ b/toolchain/check/testdata/function/definition/params_one.carbon @@ -10,7 +10,7 @@ fn Foo(a: i32) {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Foo = %Foo} -// CHECK:STDOUT: %Foo: = fn_decl @Foo +// CHECK:STDOUT: %Foo: = fn_decl @Foo, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32) { diff --git a/toolchain/check/testdata/function/definition/params_one_comma.carbon b/toolchain/check/testdata/function/definition/params_one_comma.carbon index ab537a4c13e1..1d9429ec9ccc 100644 --- a/toolchain/check/testdata/function/definition/params_one_comma.carbon +++ b/toolchain/check/testdata/function/definition/params_one_comma.carbon @@ -10,7 +10,7 @@ fn Foo(a: i32,) {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Foo = %Foo} -// CHECK:STDOUT: %Foo: = fn_decl @Foo +// CHECK:STDOUT: %Foo: = fn_decl @Foo, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32) { diff --git a/toolchain/check/testdata/function/definition/params_two.carbon b/toolchain/check/testdata/function/definition/params_two.carbon index 3888b1840797..d55d63bbf972 100644 --- a/toolchain/check/testdata/function/definition/params_two.carbon +++ b/toolchain/check/testdata/function/definition/params_two.carbon @@ -10,7 +10,7 @@ fn Foo(a: i32, b: i32) {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Foo = %Foo} -// CHECK:STDOUT: %Foo: = fn_decl @Foo +// CHECK:STDOUT: %Foo: = fn_decl @Foo, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) { diff --git a/toolchain/check/testdata/function/definition/params_two_comma.carbon b/toolchain/check/testdata/function/definition/params_two_comma.carbon index 897095412736..7a11481c47ff 100644 --- a/toolchain/check/testdata/function/definition/params_two_comma.carbon +++ b/toolchain/check/testdata/function/definition/params_two_comma.carbon @@ -10,7 +10,7 @@ fn Foo(a: i32, b: i32,) {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Foo = %Foo} -// CHECK:STDOUT: %Foo: = fn_decl @Foo +// CHECK:STDOUT: %Foo: = fn_decl @Foo, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) { diff --git a/toolchain/check/testdata/function/definition/params_zero.carbon b/toolchain/check/testdata/function/definition/params_zero.carbon index a85340f9ce74..20112ffcfc44 100644 --- a/toolchain/check/testdata/function/definition/params_zero.carbon +++ b/toolchain/check/testdata/function/definition/params_zero.carbon @@ -10,7 +10,7 @@ fn Foo() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Foo = %Foo} -// CHECK:STDOUT: %Foo: = fn_decl @Foo +// CHECK:STDOUT: %Foo: = fn_decl @Foo, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo() { diff --git a/toolchain/check/testdata/function/definition/same_param_name.carbon b/toolchain/check/testdata/function/definition/same_param_name.carbon index a8a028e6d53b..9ed01b7c398e 100644 --- a/toolchain/check/testdata/function/definition/same_param_name.carbon +++ b/toolchain/check/testdata/function/definition/same_param_name.carbon @@ -11,8 +11,8 @@ fn Bar(a: i32) {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Foo = %Foo, .Bar = %Bar} -// CHECK:STDOUT: %Foo: = fn_decl @Foo -// CHECK:STDOUT: %Bar: = fn_decl @Bar +// CHECK:STDOUT: %Foo: = fn_decl @Foo, const +// CHECK:STDOUT: %Bar: = fn_decl @Bar, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%a: i32) { diff --git a/toolchain/check/testdata/function/generic/fail_type_param_mismatch.carbon b/toolchain/check/testdata/function/generic/fail_type_param_mismatch.carbon index 48ded25fbee3..c58064ab2d9f 100644 --- a/toolchain/check/testdata/function/generic/fail_type_param_mismatch.carbon +++ b/toolchain/check/testdata/function/generic/fail_type_param_mismatch.carbon @@ -16,13 +16,13 @@ fn F(T:! type, U:! type) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%T: type, %U: type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %T.ref: type = name_ref T, %T -// CHECK:STDOUT: %.loc8: type = ptr_type T +// CHECK:STDOUT: %.loc8: type = ptr_type T, const // CHECK:STDOUT: %p.var: ref T* = var p // CHECK:STDOUT: %p: ref T* = bind_name p, %p.var // CHECK:STDOUT: %U.ref: type = name_ref U, %U diff --git a/toolchain/check/testdata/function/generic/type_param.carbon b/toolchain/check/testdata/function/generic/type_param.carbon index caf800b160e4..a54981000386 100644 --- a/toolchain/check/testdata/function/generic/type_param.carbon +++ b/toolchain/check/testdata/function/generic/type_param.carbon @@ -13,13 +13,13 @@ fn F(T:! type) { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%T: type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %T.ref.loc8: type = name_ref T, %T -// CHECK:STDOUT: %.loc8: type = ptr_type T +// CHECK:STDOUT: %.loc8: type = ptr_type T, const // CHECK:STDOUT: %p.var: ref T* = var p // CHECK:STDOUT: %p: ref T* = bind_name p, %p.var // CHECK:STDOUT: %T.ref.loc9: type = name_ref T, %T diff --git a/toolchain/check/testdata/if/else.carbon b/toolchain/check/testdata/if/else.carbon index 3066d232a02e..abbdf15638e5 100644 --- a/toolchain/check/testdata/if/else.carbon +++ b/toolchain/check/testdata/if/else.carbon @@ -20,15 +20,15 @@ fn If(b: bool) { // CHECK:STDOUT: --- else.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc13: type = tuple_type () +// CHECK:STDOUT: %.loc13: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F, .G = %G, .H = %H, .If = %If} -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %H: = fn_decl @H -// CHECK:STDOUT: %If: = fn_decl @If +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %H: = fn_decl @H, const +// CHECK:STDOUT: %If: = fn_decl @If, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -52,17 +52,17 @@ fn If(b: bool) { // CHECK:STDOUT: if %b.ref br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc13: init () = call %F.ref() // CHECK:STDOUT: br !if.done // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G +// CHECK:STDOUT: %G.ref: = name_ref G, file.%G, const = file.%G // CHECK:STDOUT: %.loc15: init () = call %G.ref() // CHECK:STDOUT: br !if.done // CHECK:STDOUT: // CHECK:STDOUT: !if.done: -// CHECK:STDOUT: %H.ref: = name_ref H, file.%H +// CHECK:STDOUT: %H.ref: = name_ref H, file.%H, const = file.%H // CHECK:STDOUT: %.loc17: init () = call %H.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon b/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon index 502913da2500..9c0c43749aff 100644 --- a/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon +++ b/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon @@ -35,11 +35,17 @@ fn If3(b: bool) -> i32 { // CHECK:STDOUT: --- fail_reachable_fallthrough.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc9: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc20: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc29: i32 = int_literal 1, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.If1 = %If1, .If2 = %If2, .If3 = %If3} -// CHECK:STDOUT: %If1: = fn_decl @If1 -// CHECK:STDOUT: %If2: = fn_decl @If2 -// CHECK:STDOUT: %If3: = fn_decl @If3 +// CHECK:STDOUT: %If1: = fn_decl @If1, const +// CHECK:STDOUT: %If2: = fn_decl @If2, const +// CHECK:STDOUT: %If3: = fn_decl @If3, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @If1(%b: bool) -> i32 { @@ -48,7 +54,7 @@ fn If3(b: bool) -> i32 { // CHECK:STDOUT: if %b.ref br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: -// CHECK:STDOUT: %.loc9: i32 = int_literal 1 +// CHECK:STDOUT: %.loc9: i32 = int_literal 1, const = constants.%.loc9 // CHECK:STDOUT: return %.loc9 // CHECK:STDOUT: // CHECK:STDOUT: !if.else: @@ -66,7 +72,7 @@ fn If3(b: bool) -> i32 { // CHECK:STDOUT: br !if.done // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %.loc20: i32 = int_literal 2 +// CHECK:STDOUT: %.loc20: i32 = int_literal 2, const = constants.%.loc20 // CHECK:STDOUT: return %.loc20 // CHECK:STDOUT: // CHECK:STDOUT: !if.done: @@ -78,7 +84,7 @@ fn If3(b: bool) -> i32 { // CHECK:STDOUT: if %b.ref br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: -// CHECK:STDOUT: %.loc29: i32 = int_literal 1 +// CHECK:STDOUT: %.loc29: i32 = int_literal 1, const = constants.%.loc29 // CHECK:STDOUT: return %.loc29 // CHECK:STDOUT: // CHECK:STDOUT: !if.else: diff --git a/toolchain/check/testdata/if/fail_scope.carbon b/toolchain/check/testdata/if/fail_scope.carbon index 6de5cc18fa1c..103dabe450cc 100644 --- a/toolchain/check/testdata/if/fail_scope.carbon +++ b/toolchain/check/testdata/if/fail_scope.carbon @@ -17,9 +17,13 @@ fn VarScope(b: bool) -> i32 { // CHECK:STDOUT: --- fail_scope.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc9: i32 = int_literal 2, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.VarScope = %VarScope} -// CHECK:STDOUT: %VarScope: = fn_decl @VarScope +// CHECK:STDOUT: %VarScope: = fn_decl @VarScope, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @VarScope(%b: bool) -> i32 { @@ -30,7 +34,7 @@ fn VarScope(b: bool) -> i32 { // CHECK:STDOUT: !if.then: // CHECK:STDOUT: %n.var: ref i32 = var n // CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var -// CHECK:STDOUT: %.loc9: i32 = int_literal 2 +// CHECK:STDOUT: %.loc9: i32 = int_literal 2, const = constants.%.loc9 // CHECK:STDOUT: assign %n.var, %.loc9 // CHECK:STDOUT: %n.ref.loc10: ref i32 = name_ref n, %n // CHECK:STDOUT: %.loc10: i32 = bind_value %n.ref.loc10 diff --git a/toolchain/check/testdata/if/no_else.carbon b/toolchain/check/testdata/if/no_else.carbon index debc3542cb0e..e6c1e21d276b 100644 --- a/toolchain/check/testdata/if/no_else.carbon +++ b/toolchain/check/testdata/if/no_else.carbon @@ -17,14 +17,14 @@ fn If(b: bool) { // CHECK:STDOUT: --- no_else.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc12: type = tuple_type () +// CHECK:STDOUT: %.loc12: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F, .G = %G, .If = %If} -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %If: = fn_decl @If +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %If: = fn_decl @If, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -43,12 +43,12 @@ fn If(b: bool) { // CHECK:STDOUT: if %b.ref br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc12: init () = call %F.ref() // CHECK:STDOUT: br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G +// CHECK:STDOUT: %G.ref: = name_ref G, file.%G, const = file.%G // CHECK:STDOUT: %.loc14: init () = call %G.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/if/unreachable_fallthrough.carbon b/toolchain/check/testdata/if/unreachable_fallthrough.carbon index 646030bde899..f034d2773917 100644 --- a/toolchain/check/testdata/if/unreachable_fallthrough.carbon +++ b/toolchain/check/testdata/if/unreachable_fallthrough.carbon @@ -15,9 +15,14 @@ fn If(b: bool) -> i32 { // CHECK:STDOUT: --- unreachable_fallthrough.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc9: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc11: i32 = int_literal 2, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.If = %If} -// CHECK:STDOUT: %If: = fn_decl @If +// CHECK:STDOUT: %If: = fn_decl @If, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @If(%b: bool) -> i32 { @@ -26,11 +31,11 @@ fn If(b: bool) -> i32 { // CHECK:STDOUT: if %b.ref br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: -// CHECK:STDOUT: %.loc9: i32 = int_literal 1 +// CHECK:STDOUT: %.loc9: i32 = int_literal 1, const = constants.%.loc9 // CHECK:STDOUT: return %.loc9 // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %.loc11: i32 = int_literal 2 +// CHECK:STDOUT: %.loc11: i32 = int_literal 2, const = constants.%.loc11 // CHECK:STDOUT: return %.loc11 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/if_expr/basic.carbon b/toolchain/check/testdata/if_expr/basic.carbon index 38ab323933b8..2660a09c99ed 100644 --- a/toolchain/check/testdata/if_expr/basic.carbon +++ b/toolchain/check/testdata/if_expr/basic.carbon @@ -12,22 +12,25 @@ fn F(b: bool, n: i32, m: i32) -> i32 { // CHECK:STDOUT: --- basic.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc8_17: type = ptr_type [i32; 1] -// CHECK:STDOUT: %.loc8_24: type = tuple_type (i32) +// CHECK:STDOUT: %.loc8_16: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc8_17.1: type = array_type %.loc8_16, i32, const +// CHECK:STDOUT: %.loc8_17.2: type = ptr_type [i32; 1], const +// CHECK:STDOUT: %.loc8_22: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc8_24: type = tuple_type (i32), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%b: bool, %n: i32, %m: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8_16: i32 = int_literal 1 -// CHECK:STDOUT: %.loc8_17: type = array_type %.loc8_16, i32 +// CHECK:STDOUT: %.loc8_16: i32 = int_literal 1, const = constants.%.loc8_16 +// CHECK:STDOUT: %.loc8_17: type = array_type %.loc8_16, i32, const = constants.%.loc8_17.1 // CHECK:STDOUT: %x.var: ref [i32; 1] = var x // CHECK:STDOUT: %x: ref [i32; 1] = bind_name x, %x.var -// CHECK:STDOUT: %.loc8_22: i32 = int_literal 0 +// CHECK:STDOUT: %.loc8_22: i32 = int_literal 0, const = constants.%.loc8_22 // CHECK:STDOUT: %.loc8_24.1: (i32,) = tuple_literal (%.loc8_22) // CHECK:STDOUT: %.loc8_24.2: i32 = int_literal 0 // CHECK:STDOUT: %.loc8_24.3: ref i32 = array_index %x.var, %.loc8_24.2 diff --git a/toolchain/check/testdata/if_expr/constant_condition.carbon b/toolchain/check/testdata/if_expr/constant_condition.carbon index c415bacc38f2..c6b654db0a20 100644 --- a/toolchain/check/testdata/if_expr/constant_condition.carbon +++ b/toolchain/check/testdata/if_expr/constant_condition.carbon @@ -17,40 +17,47 @@ fn G() -> i32 { // CHECK:STDOUT: --- constant_condition.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc7: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc8: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc11: bool = bool_literal true, const +// CHECK:STDOUT: %.loc15: bool = bool_literal false, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %A, .B = %B, .F = %F, .G = %G} -// CHECK:STDOUT: %A: = fn_decl @A -// CHECK:STDOUT: %B: = fn_decl @B -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G +// CHECK:STDOUT: %A: = fn_decl @A, const +// CHECK:STDOUT: %B: = fn_decl @B, const +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: i32 = int_literal 1 +// CHECK:STDOUT: %.loc7: i32 = int_literal 1, const = constants.%.loc7 // CHECK:STDOUT: return %.loc7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @B() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: i32 = int_literal 2 +// CHECK:STDOUT: %.loc8: i32 = int_literal 2, const = constants.%.loc8 // CHECK:STDOUT: return %.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_13: bool = bool_literal true +// CHECK:STDOUT: %.loc11_13: bool = bool_literal true, const = constants.%.loc11 // CHECK:STDOUT: if %.loc11_13 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%A +// CHECK:STDOUT: %A.ref: = name_ref A, file.%A, const = file.%A // CHECK:STDOUT: %.loc11_24.1: init i32 = call %A.ref() // CHECK:STDOUT: %.loc11_24.2: i32 = value_of_initializer %.loc11_24.1 // CHECK:STDOUT: %.loc11_24.3: i32 = converted %.loc11_24.1, %.loc11_24.2 // CHECK:STDOUT: br !if.expr.result(%.loc11_24.3) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: -// CHECK:STDOUT: %B.ref: = name_ref B, file.%B +// CHECK:STDOUT: %B.ref: = name_ref B, file.%B, const = file.%B // CHECK:STDOUT: %.loc11_33: init i32 = call %B.ref() // CHECK:STDOUT: %.loc11_27.1: i32 = value_of_initializer %.loc11_33 // CHECK:STDOUT: %.loc11_27.2: i32 = converted %.loc11_33, %.loc11_27.1 @@ -63,18 +70,18 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_13: bool = bool_literal false +// CHECK:STDOUT: %.loc15_13: bool = bool_literal false, const = constants.%.loc15 // CHECK:STDOUT: if %.loc15_13 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%A +// CHECK:STDOUT: %A.ref: = name_ref A, file.%A, const = file.%A // CHECK:STDOUT: %.loc15_25.1: init i32 = call %A.ref() // CHECK:STDOUT: %.loc15_25.2: i32 = value_of_initializer %.loc15_25.1 // CHECK:STDOUT: %.loc15_25.3: i32 = converted %.loc15_25.1, %.loc15_25.2 // CHECK:STDOUT: br !if.expr.result(%.loc15_25.3) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: -// CHECK:STDOUT: %B.ref: = name_ref B, file.%B +// CHECK:STDOUT: %B.ref: = name_ref B, file.%B, const = file.%B // CHECK:STDOUT: %.loc15_34: init i32 = call %B.ref() // CHECK:STDOUT: %.loc15_28.1: i32 = value_of_initializer %.loc15_34 // CHECK:STDOUT: %.loc15_28.2: i32 = converted %.loc15_34, %.loc15_28.1 diff --git a/toolchain/check/testdata/if_expr/control_flow.carbon b/toolchain/check/testdata/if_expr/control_flow.carbon index 7db88b9b0e64..6cba421253d1 100644 --- a/toolchain/check/testdata/if_expr/control_flow.carbon +++ b/toolchain/check/testdata/if_expr/control_flow.carbon @@ -13,22 +13,27 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: --- control_flow.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc7: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc8: i32 = int_literal 2, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %A, .B = %B, .F = %F} -// CHECK:STDOUT: %A: = fn_decl @A -// CHECK:STDOUT: %B: = fn_decl @B -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %A: = fn_decl @A, const +// CHECK:STDOUT: %B: = fn_decl @B, const +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: i32 = int_literal 1 +// CHECK:STDOUT: %.loc7: i32 = int_literal 1, const = constants.%.loc7 // CHECK:STDOUT: return %.loc7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @B() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: i32 = int_literal 2 +// CHECK:STDOUT: %.loc8: i32 = int_literal 2, const = constants.%.loc8 // CHECK:STDOUT: return %.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -38,14 +43,14 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: if %b.ref br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%A +// CHECK:STDOUT: %A.ref: = name_ref A, file.%A, const = file.%A // CHECK:STDOUT: %.loc11_21.1: init i32 = call %A.ref() // CHECK:STDOUT: %.loc11_21.2: i32 = value_of_initializer %.loc11_21.1 // CHECK:STDOUT: %.loc11_21.3: i32 = converted %.loc11_21.1, %.loc11_21.2 // CHECK:STDOUT: br !if.expr.result(%.loc11_21.3) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: -// CHECK:STDOUT: %B.ref: = name_ref B, file.%B +// CHECK:STDOUT: %B.ref: = name_ref B, file.%B, const = file.%B // CHECK:STDOUT: %.loc11_30: init i32 = call %B.ref() // CHECK:STDOUT: %.loc11_24.1: i32 = value_of_initializer %.loc11_30 // CHECK:STDOUT: %.loc11_24.2: i32 = converted %.loc11_30, %.loc11_24.1 diff --git a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon index e99d1ccc4672..2968bf88cc5f 100644 --- a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon +++ b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon @@ -36,21 +36,25 @@ class C { // CHECK:STDOUT: --- fail_not_in_function.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc34: type = struct_type {.n: } +// CHECK:STDOUT: %.loc17_17: bool = bool_literal true, const +// CHECK:STDOUT: %.loc17_27: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc17_34: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc33: bool = bool_literal true, const +// CHECK:STDOUT: %.loc34: type = struct_type {.n: }, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: %.loc17: i32 = block_arg // CHECK:STDOUT: %x: i32 = bind_name x, %.loc17 // CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C +// CHECK:STDOUT: %C: type = class_type @C, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %.loc33: bool = bool_literal true +// CHECK:STDOUT: %.loc33: bool = bool_literal true, const = constants.%.loc33 // CHECK:STDOUT: if %.loc33 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !members: -// CHECK:STDOUT: .n = +// CHECK:STDOUT: .n = // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/if_expr/nested.carbon b/toolchain/check/testdata/if_expr/nested.carbon index 895abde4a9b6..4f1a11860923 100644 --- a/toolchain/check/testdata/if_expr/nested.carbon +++ b/toolchain/check/testdata/if_expr/nested.carbon @@ -10,9 +10,16 @@ fn F(a: bool, b: bool, c: bool) -> i32 { // CHECK:STDOUT: --- nested.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc8_30: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc8_37: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc8_54: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc8_61: i32 = int_literal 4, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%a: bool, %b: bool, %c: bool) -> i32 { @@ -25,11 +32,11 @@ fn F(a: bool, b: bool, c: bool) -> i32 { // CHECK:STDOUT: if %b.ref br !if.expr.then.loc8_20 else br !if.expr.else.loc8_20 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc8_20: -// CHECK:STDOUT: %.loc8_30: i32 = int_literal 1 +// CHECK:STDOUT: %.loc8_30: i32 = int_literal 1, const = constants.%.loc8_30 // CHECK:STDOUT: br !if.expr.result.loc8_20(%.loc8_30) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc8_20: -// CHECK:STDOUT: %.loc8_37: i32 = int_literal 2 +// CHECK:STDOUT: %.loc8_37: i32 = int_literal 2, const = constants.%.loc8_37 // CHECK:STDOUT: br !if.expr.result.loc8_20(%.loc8_37) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc8_20: @@ -41,11 +48,11 @@ fn F(a: bool, b: bool, c: bool) -> i32 { // CHECK:STDOUT: if %c.ref br !if.expr.then.loc8_44 else br !if.expr.else.loc8_44 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc8_44: -// CHECK:STDOUT: %.loc8_54: i32 = int_literal 3 +// CHECK:STDOUT: %.loc8_54: i32 = int_literal 3, const = constants.%.loc8_54 // CHECK:STDOUT: br !if.expr.result.loc8_44(%.loc8_54) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc8_44: -// CHECK:STDOUT: %.loc8_61: i32 = int_literal 4 +// CHECK:STDOUT: %.loc8_61: i32 = int_literal 4, const = constants.%.loc8_61 // CHECK:STDOUT: br !if.expr.result.loc8_44(%.loc8_61) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc8_44: diff --git a/toolchain/check/testdata/if_expr/struct.carbon b/toolchain/check/testdata/if_expr/struct.carbon index 4841c67bca80..c8e37618f860 100644 --- a/toolchain/check/testdata/if_expr/struct.carbon +++ b/toolchain/check/testdata/if_expr/struct.carbon @@ -14,25 +14,27 @@ fn F(cond: bool) { // CHECK:STDOUT: --- struct.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7: type = ptr_type {.a: i32, .b: i32} -// CHECK:STDOUT: %.loc11: type = tuple_type () +// CHECK:STDOUT: %.loc7: type = ptr_type {.a: i32, .b: i32}, const +// CHECK:STDOUT: %.loc10_37: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc10_45: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc11: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.G = %G, .F = %F} -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%s: {.a: i32, .b: i32}); // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%cond: bool) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_27: type = struct_type {.a: i32, .b: i32} +// CHECK:STDOUT: %.loc10_27: type = struct_type {.a: i32, .b: i32}, const // CHECK:STDOUT: %a.var: ref {.a: i32, .b: i32} = var a // CHECK:STDOUT: %a: ref {.a: i32, .b: i32} = bind_name a, %a.var -// CHECK:STDOUT: %.loc10_37: i32 = int_literal 1 -// CHECK:STDOUT: %.loc10_45: i32 = int_literal 2 +// CHECK:STDOUT: %.loc10_37: i32 = int_literal 1, const = constants.%.loc10_37 +// CHECK:STDOUT: %.loc10_45: i32 = int_literal 2, const = constants.%.loc10_45 // CHECK:STDOUT: %.loc10_46.1: {.a: i32, .b: i32} = struct_literal (%.loc10_37, %.loc10_45) // CHECK:STDOUT: %.loc10_46.2: ref i32 = struct_access %a.var, element0 // CHECK:STDOUT: %.loc10_46.3: init i32 = initialize_from %.loc10_37 to %.loc10_46.2 @@ -41,7 +43,7 @@ fn F(cond: bool) { // CHECK:STDOUT: %.loc10_46.6: init {.a: i32, .b: i32} = struct_init (%.loc10_46.3, %.loc10_46.5) to %a.var // CHECK:STDOUT: %.loc10_46.7: init {.a: i32, .b: i32} = converted %.loc10_46.1, %.loc10_46.6 // CHECK:STDOUT: assign %a.var, %.loc10_46.7 -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G +// CHECK:STDOUT: %G.ref: = name_ref G, file.%G, const = file.%G // CHECK:STDOUT: %cond.ref: bool = name_ref cond, %cond // CHECK:STDOUT: if %cond.ref br !if.expr.then else br !if.expr.else // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/array_element_access.carbon b/toolchain/check/testdata/index/array_element_access.carbon index 73d69ee90e49..51ac36306290 100644 --- a/toolchain/check/testdata/index/array_element_access.carbon +++ b/toolchain/check/testdata/index/array_element_access.carbon @@ -12,18 +12,24 @@ var d: i32 = a[b]; // CHECK:STDOUT: --- array_element_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_15: type = ptr_type [i32; 2] -// CHECK:STDOUT: %.loc7_26: type = tuple_type (i32, i32) +// CHECK:STDOUT: %.loc7_14: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc7_15.1: type = array_type %.loc7_14, i32, const +// CHECK:STDOUT: %.loc7_15.2: type = ptr_type [i32; 2], const +// CHECK:STDOUT: %.loc7_20: i32 = int_literal 12, const +// CHECK:STDOUT: %.loc7_24: i32 = int_literal 24, const +// CHECK:STDOUT: %.loc7_26: type = tuple_type (i32, i32), const +// CHECK:STDOUT: %.loc8: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc9: i32 = int_literal 0, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.a = %a, .b = %b, .c = %c, .d = %d} -// CHECK:STDOUT: %.loc7_14: i32 = int_literal 2 -// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 +// CHECK:STDOUT: %.loc7_14: i32 = int_literal 2, const = constants.%.loc7_14 +// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32, const = constants.%.loc7_15.1 // CHECK:STDOUT: %a.var: ref [i32; 2] = var a // CHECK:STDOUT: %a: ref [i32; 2] = bind_name a, %a.var -// CHECK:STDOUT: %.loc7_20: i32 = int_literal 12 -// CHECK:STDOUT: %.loc7_24: i32 = int_literal 24 +// CHECK:STDOUT: %.loc7_20: i32 = int_literal 12, const = constants.%.loc7_20 +// CHECK:STDOUT: %.loc7_24: i32 = int_literal 24, const = constants.%.loc7_24 // CHECK:STDOUT: %.loc7_26.1: (i32, i32) = tuple_literal (%.loc7_20, %.loc7_24) // CHECK:STDOUT: %.loc7_26.2: i32 = int_literal 0 // CHECK:STDOUT: %.loc7_26.3: ref i32 = array_index %a.var, %.loc7_26.2 @@ -36,12 +42,12 @@ var d: i32 = a[b]; // CHECK:STDOUT: assign %a.var, %.loc7_26.9 // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var -// CHECK:STDOUT: %.loc8: i32 = int_literal 1 +// CHECK:STDOUT: %.loc8: i32 = int_literal 1, const = constants.%.loc8 // CHECK:STDOUT: assign %b.var, %.loc8 // CHECK:STDOUT: %c.var: ref i32 = var c // CHECK:STDOUT: %c: ref i32 = bind_name c, %c.var // CHECK:STDOUT: %a.ref.loc9: ref [i32; 2] = name_ref a, %a -// CHECK:STDOUT: %.loc9_16: i32 = int_literal 0 +// CHECK:STDOUT: %.loc9_16: i32 = int_literal 0, const = constants.%.loc9 // CHECK:STDOUT: %.loc9_17.1: ref i32 = array_index %a.ref.loc9, %.loc9_16 // CHECK:STDOUT: %.loc9_17.2: i32 = bind_value %.loc9_17.1 // CHECK:STDOUT: assign %c.var, %.loc9_17.2 diff --git a/toolchain/check/testdata/index/expr_category.carbon b/toolchain/check/testdata/index/expr_category.carbon index 1b2e91f91889..2dbca49a5b69 100644 --- a/toolchain/check/testdata/index/expr_category.carbon +++ b/toolchain/check/testdata/index/expr_category.carbon @@ -27,28 +27,50 @@ fn ValueBinding(b: [i32; 3]) { // CHECK:STDOUT: --- expr_category.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7: type = ptr_type [i32; 3] -// CHECK:STDOUT: %.loc10: type = tuple_type (i32, i32, i32) +// CHECK:STDOUT: %.loc7_17: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc7_18.1: type = array_type %.loc7_17, i32, const +// CHECK:STDOUT: %.loc7_18.2: type = ptr_type [i32; 3], const +// CHECK:STDOUT: %.loc9_15: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc9_16: type = array_type %.loc9_15, i32, const +// CHECK:STDOUT: %.loc10_16: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc10_17: type = array_type %.loc10_16, i32, const +// CHECK:STDOUT: %.loc10_22: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc10_25: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc10_28: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc10_29: type = tuple_type (i32, i32, i32), const +// CHECK:STDOUT: %.loc13: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc14_5: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc14_10: i32 = int_literal 4, const +// CHECK:STDOUT: %.loc17_26: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc17_27: type = array_type %.loc17_26, i32, const +// CHECK:STDOUT: %.loc18_16: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc18_17: type = array_type %.loc18_16, i32, const +// CHECK:STDOUT: %.loc18_22: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc18_25: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc18_28: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc22: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc23: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc24: i32 = int_literal 0, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F, .G = %G, .ValueBinding = %ValueBinding} -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %ValueBinding: = fn_decl @ValueBinding +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %ValueBinding: = fn_decl @ValueBinding, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %return: [i32; 3]; // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%b: [i32; 3]) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_16: i32 = int_literal 3 -// CHECK:STDOUT: %.loc10_17: type = array_type %.loc10_16, i32 +// CHECK:STDOUT: %.loc10_16: i32 = int_literal 3, const = constants.%.loc10_16 +// CHECK:STDOUT: %.loc10_17: type = array_type %.loc10_16, i32, const = constants.%.loc10_17 // CHECK:STDOUT: %a.var: ref [i32; 3] = var a // CHECK:STDOUT: %a: ref [i32; 3] = bind_name a, %a.var -// CHECK:STDOUT: %.loc10_22: i32 = int_literal 1 -// CHECK:STDOUT: %.loc10_25: i32 = int_literal 2 -// CHECK:STDOUT: %.loc10_28: i32 = int_literal 3 +// CHECK:STDOUT: %.loc10_22: i32 = int_literal 1, const = constants.%.loc10_22 +// CHECK:STDOUT: %.loc10_25: i32 = int_literal 2, const = constants.%.loc10_25 +// CHECK:STDOUT: %.loc10_28: i32 = int_literal 3, const = constants.%.loc10_28 // CHECK:STDOUT: %.loc10_29.1: (i32, i32, i32) = tuple_literal (%.loc10_22, %.loc10_25, %.loc10_28) // CHECK:STDOUT: %.loc10_29.2: i32 = int_literal 0 // CHECK:STDOUT: %.loc10_29.3: ref i32 = array_index %a.var, %.loc10_29.2 @@ -62,31 +84,31 @@ fn ValueBinding(b: [i32; 3]) { // CHECK:STDOUT: %.loc10_29.11: init [i32; 3] = array_init (%.loc10_29.4, %.loc10_29.7, %.loc10_29.10) to %a.var // CHECK:STDOUT: %.loc10_29.12: init [i32; 3] = converted %.loc10_29.1, %.loc10_29.11 // CHECK:STDOUT: assign %a.var, %.loc10_29.12 -// CHECK:STDOUT: %.loc13_14: type = ptr_type i32 +// CHECK:STDOUT: %.loc13_14: type = ptr_type i32, const // CHECK:STDOUT: %pa.var: ref i32* = var pa // CHECK:STDOUT: %pa: ref i32* = bind_name pa, %pa.var // CHECK:STDOUT: %a.ref.loc13: ref [i32; 3] = name_ref a, %a -// CHECK:STDOUT: %.loc13_21: i32 = int_literal 0 +// CHECK:STDOUT: %.loc13_21: i32 = int_literal 0, const = constants.%.loc13 // CHECK:STDOUT: %.loc13_22: ref i32 = array_index %a.ref.loc13, %.loc13_21 // CHECK:STDOUT: %.loc13_18: i32* = addr_of %.loc13_22 // CHECK:STDOUT: assign %pa.var, %.loc13_18 // CHECK:STDOUT: %a.ref.loc14: ref [i32; 3] = name_ref a, %a -// CHECK:STDOUT: %.loc14_5: i32 = int_literal 0 +// CHECK:STDOUT: %.loc14_5: i32 = int_literal 0, const = constants.%.loc14_5 // CHECK:STDOUT: %.loc14_6: ref i32 = array_index %a.ref.loc14, %.loc14_5 -// CHECK:STDOUT: %.loc14_10: i32 = int_literal 4 +// CHECK:STDOUT: %.loc14_10: i32 = int_literal 4, const = constants.%.loc14_10 // CHECK:STDOUT: assign %.loc14_6, %.loc14_10 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @ValueBinding(%b: [i32; 3]) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc18_16: i32 = int_literal 3 -// CHECK:STDOUT: %.loc18_17: type = array_type %.loc18_16, i32 +// CHECK:STDOUT: %.loc18_16: i32 = int_literal 3, const = constants.%.loc18_16 +// CHECK:STDOUT: %.loc18_17: type = array_type %.loc18_16, i32, const = constants.%.loc18_17 // CHECK:STDOUT: %a.var: ref [i32; 3] = var a // CHECK:STDOUT: %a: ref [i32; 3] = bind_name a, %a.var -// CHECK:STDOUT: %.loc18_22: i32 = int_literal 1 -// CHECK:STDOUT: %.loc18_25: i32 = int_literal 2 -// CHECK:STDOUT: %.loc18_28: i32 = int_literal 3 +// CHECK:STDOUT: %.loc18_22: i32 = int_literal 1, const = constants.%.loc18_22 +// CHECK:STDOUT: %.loc18_25: i32 = int_literal 2, const = constants.%.loc18_25 +// CHECK:STDOUT: %.loc18_28: i32 = int_literal 3, const = constants.%.loc18_28 // CHECK:STDOUT: %.loc18_29.1: (i32, i32, i32) = tuple_literal (%.loc18_22, %.loc18_25, %.loc18_28) // CHECK:STDOUT: %.loc18_29.2: i32 = int_literal 0 // CHECK:STDOUT: %.loc18_29.3: ref i32 = array_index %a.var, %.loc18_29.2 @@ -101,17 +123,17 @@ fn ValueBinding(b: [i32; 3]) { // CHECK:STDOUT: %.loc18_29.12: init [i32; 3] = converted %.loc18_29.1, %.loc18_29.11 // CHECK:STDOUT: assign %a.var, %.loc18_29.12 // CHECK:STDOUT: %a.ref: ref [i32; 3] = name_ref a, %a -// CHECK:STDOUT: %.loc22_5: i32 = int_literal 0 +// CHECK:STDOUT: %.loc22_5: i32 = int_literal 0, const = constants.%.loc22 // CHECK:STDOUT: %.loc22_6: ref i32 = array_index %a.ref, %.loc22_5 // CHECK:STDOUT: %b.ref: [i32; 3] = name_ref b, %b -// CHECK:STDOUT: %.loc23_5: i32 = int_literal 0 +// CHECK:STDOUT: %.loc23_5: i32 = int_literal 0, const = constants.%.loc23 // CHECK:STDOUT: %.loc23_6.1: ref [i32; 3] = value_as_ref %b.ref // CHECK:STDOUT: %.loc23_6.2: ref i32 = array_index %.loc23_6.1, %.loc23_5 // CHECK:STDOUT: %.loc23_6.3: i32 = bind_value %.loc23_6.2 -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc24_4.1: ref [i32; 3] = temporary_storage // CHECK:STDOUT: %.loc24_4.2: init [i32; 3] = call %F.ref() to %.loc24_4.1 -// CHECK:STDOUT: %.loc24_7: i32 = int_literal 0 +// CHECK:STDOUT: %.loc24_7: i32 = int_literal 0, const = constants.%.loc24 // CHECK:STDOUT: %.loc24_4.3: ref [i32; 3] = temporary %.loc24_4.1, %.loc24_4.2 // CHECK:STDOUT: %.loc24_8.1: ref i32 = array_index %.loc24_4.3, %.loc24_7 // CHECK:STDOUT: %.loc24_8.2: i32 = bind_value %.loc24_8.1 diff --git a/toolchain/check/testdata/index/fail_array_large_index.carbon b/toolchain/check/testdata/index/fail_array_large_index.carbon index 5f20dc868585..a3760ace7ff7 100644 --- a/toolchain/check/testdata/index/fail_array_large_index.carbon +++ b/toolchain/check/testdata/index/fail_array_large_index.carbon @@ -13,17 +13,21 @@ var b: i32 = a[0xFFFFFFFFFFFFFFFFF]; // CHECK:STDOUT: --- fail_array_large_index.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_15: type = ptr_type [i32; 1] -// CHECK:STDOUT: %.loc7_23: type = tuple_type (i32) +// CHECK:STDOUT: %.loc7_14: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc7_15.1: type = array_type %.loc7_14, i32, const +// CHECK:STDOUT: %.loc7_15.2: type = ptr_type [i32; 1], const +// CHECK:STDOUT: %.loc7_20: i32 = int_literal 12, const +// CHECK:STDOUT: %.loc7_23: type = tuple_type (i32), const +// CHECK:STDOUT: %.loc11: i32 = int_literal 295147905179352825855, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.a = %a, .b = %b} -// CHECK:STDOUT: %.loc7_14: i32 = int_literal 1 -// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 +// CHECK:STDOUT: %.loc7_14: i32 = int_literal 1, const = constants.%.loc7_14 +// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32, const = constants.%.loc7_15.1 // CHECK:STDOUT: %a.var: ref [i32; 1] = var a // CHECK:STDOUT: %a: ref [i32; 1] = bind_name a, %a.var -// CHECK:STDOUT: %.loc7_20: i32 = int_literal 12 +// CHECK:STDOUT: %.loc7_20: i32 = int_literal 12, const = constants.%.loc7_20 // CHECK:STDOUT: %.loc7_23.1: (i32,) = tuple_literal (%.loc7_20) // CHECK:STDOUT: %.loc7_23.2: i32 = int_literal 0 // CHECK:STDOUT: %.loc7_23.3: ref i32 = array_index %a.var, %.loc7_23.2 @@ -34,7 +38,7 @@ var b: i32 = a[0xFFFFFFFFFFFFFFFFF]; // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: %a.ref: ref [i32; 1] = name_ref a, %a -// CHECK:STDOUT: %.loc11_16: i32 = int_literal 295147905179352825855 +// CHECK:STDOUT: %.loc11_16: i32 = int_literal 295147905179352825855, const = constants.%.loc11 // CHECK:STDOUT: %.loc11_35.1: ref i32 = array_index %a.ref, // CHECK:STDOUT: %.loc11_35.2: i32 = bind_value %.loc11_35.1 // CHECK:STDOUT: assign %b.var, %.loc11_35.2 diff --git a/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon b/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon index 6e06674a3578..9f8755f45230 100644 --- a/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon +++ b/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon @@ -13,17 +13,21 @@ var b: i32 = a[2.6]; // CHECK:STDOUT: --- fail_array_non_int_indexing.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_15: type = ptr_type [i32; 1] -// CHECK:STDOUT: %.loc7_23: type = tuple_type (i32) +// CHECK:STDOUT: %.loc7_14: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc7_15.1: type = array_type %.loc7_14, i32, const +// CHECK:STDOUT: %.loc7_15.2: type = ptr_type [i32; 1], const +// CHECK:STDOUT: %.loc7_20: i32 = int_literal 12, const +// CHECK:STDOUT: %.loc7_23: type = tuple_type (i32), const +// CHECK:STDOUT: %.loc11: f64 = real_literal 26e-1, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.a = %a, .b = %b} -// CHECK:STDOUT: %.loc7_14: i32 = int_literal 1 -// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 +// CHECK:STDOUT: %.loc7_14: i32 = int_literal 1, const = constants.%.loc7_14 +// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32, const = constants.%.loc7_15.1 // CHECK:STDOUT: %a.var: ref [i32; 1] = var a // CHECK:STDOUT: %a: ref [i32; 1] = bind_name a, %a.var -// CHECK:STDOUT: %.loc7_20: i32 = int_literal 12 +// CHECK:STDOUT: %.loc7_20: i32 = int_literal 12, const = constants.%.loc7_20 // CHECK:STDOUT: %.loc7_23.1: (i32,) = tuple_literal (%.loc7_20) // CHECK:STDOUT: %.loc7_23.2: i32 = int_literal 0 // CHECK:STDOUT: %.loc7_23.3: ref i32 = array_index %a.var, %.loc7_23.2 @@ -34,7 +38,7 @@ var b: i32 = a[2.6]; // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: %a.ref: ref [i32; 1] = name_ref a, %a -// CHECK:STDOUT: %.loc11_16: f64 = real_literal 26e-1 +// CHECK:STDOUT: %.loc11_16: f64 = real_literal 26e-1, const = constants.%.loc11 // CHECK:STDOUT: %.loc11_19.1: ref i32 = array_index %a.ref, // CHECK:STDOUT: %.loc11_19.2: i32 = bind_value %.loc11_19.1 // CHECK:STDOUT: assign %b.var, %.loc11_19.2 diff --git a/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon b/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon index 19ce47e5c465..296dd7551db9 100644 --- a/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon +++ b/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon @@ -13,17 +13,21 @@ var b: i32 = a[2]; // CHECK:STDOUT: --- fail_array_out_of_bound_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_15: type = ptr_type [i32; 1] -// CHECK:STDOUT: %.loc7_23: type = tuple_type (i32) +// CHECK:STDOUT: %.loc7_14: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc7_15.1: type = array_type %.loc7_14, i32, const +// CHECK:STDOUT: %.loc7_15.2: type = ptr_type [i32; 1], const +// CHECK:STDOUT: %.loc7_20: i32 = int_literal 12, const +// CHECK:STDOUT: %.loc7_23: type = tuple_type (i32), const +// CHECK:STDOUT: %.loc11: i32 = int_literal 2, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.a = %a, .b = %b} -// CHECK:STDOUT: %.loc7_14: i32 = int_literal 1 -// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 +// CHECK:STDOUT: %.loc7_14: i32 = int_literal 1, const = constants.%.loc7_14 +// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32, const = constants.%.loc7_15.1 // CHECK:STDOUT: %a.var: ref [i32; 1] = var a // CHECK:STDOUT: %a: ref [i32; 1] = bind_name a, %a.var -// CHECK:STDOUT: %.loc7_20: i32 = int_literal 12 +// CHECK:STDOUT: %.loc7_20: i32 = int_literal 12, const = constants.%.loc7_20 // CHECK:STDOUT: %.loc7_23.1: (i32,) = tuple_literal (%.loc7_20) // CHECK:STDOUT: %.loc7_23.2: i32 = int_literal 0 // CHECK:STDOUT: %.loc7_23.3: ref i32 = array_index %a.var, %.loc7_23.2 @@ -34,7 +38,7 @@ var b: i32 = a[2]; // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: %a.ref: ref [i32; 1] = name_ref a, %a -// CHECK:STDOUT: %.loc11_16: i32 = int_literal 2 +// CHECK:STDOUT: %.loc11_16: i32 = int_literal 2, const = constants.%.loc11 // CHECK:STDOUT: %.loc11_17.1: ref i32 = array_index %a.ref, // CHECK:STDOUT: %.loc11_17.2: i32 = bind_value %.loc11_17.1 // CHECK:STDOUT: assign %b.var, %.loc11_17.2 diff --git a/toolchain/check/testdata/index/fail_empty_tuple_access.carbon b/toolchain/check/testdata/index/fail_empty_tuple_access.carbon index e23e6f9c3044..d5f0525ffb70 100644 --- a/toolchain/check/testdata/index/fail_empty_tuple_access.carbon +++ b/toolchain/check/testdata/index/fail_empty_tuple_access.carbon @@ -16,13 +16,14 @@ fn Run() { // CHECK:STDOUT: --- fail_empty_tuple_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc13: type = tuple_type () +// CHECK:STDOUT: %.loc13_4: type = tuple_type (), const +// CHECK:STDOUT: %.loc13_7: i32 = int_literal 0, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F, .Run = %Run} -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %Run: = fn_decl @Run +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %Run: = fn_decl @Run, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { @@ -32,9 +33,9 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc13_4.1: init () = call %F.ref() -// CHECK:STDOUT: %.loc13_7: i32 = int_literal 0 +// CHECK:STDOUT: %.loc13_7: i32 = int_literal 0, const = constants.%.loc13_7 // CHECK:STDOUT: %.loc13_4.2: ref () = temporary_storage // CHECK:STDOUT: %.loc13_4.3: ref () = temporary %.loc13_4.2, %.loc13_4.1 // CHECK:STDOUT: %.loc13_8: ref = tuple_index %.loc13_4.3, diff --git a/toolchain/check/testdata/index/fail_expr_category.carbon b/toolchain/check/testdata/index/fail_expr_category.carbon index a911e6adb2d0..7a38238ef0fc 100644 --- a/toolchain/check/testdata/index/fail_expr_category.carbon +++ b/toolchain/check/testdata/index/fail_expr_category.carbon @@ -32,56 +32,66 @@ fn G(b: [i32; 3]) { // CHECK:STDOUT: --- fail_expr_category.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7: type = ptr_type [i32; 3] +// CHECK:STDOUT: %.loc7_17: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc7_18.1: type = array_type %.loc7_17, i32, const +// CHECK:STDOUT: %.loc7_18.2: type = ptr_type [i32; 3], const +// CHECK:STDOUT: %.loc9_15: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc9_16: type = array_type %.loc9_15, i32, const +// CHECK:STDOUT: %.loc14: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc18_5: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc18_10: i32 = int_literal 4, const +// CHECK:STDOUT: %.loc25: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc29_7: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc29_12: i32 = int_literal 4, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F, .G = %G} -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %return: [i32; 3]; // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%b: [i32; 3]) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc14_14: type = ptr_type i32 +// CHECK:STDOUT: %.loc14_14: type = ptr_type i32, const // CHECK:STDOUT: %pb.var: ref i32* = var pb // CHECK:STDOUT: %pb: ref i32* = bind_name pb, %pb.var // CHECK:STDOUT: %b.ref.loc14: [i32; 3] = name_ref b, %b -// CHECK:STDOUT: %.loc14_21: i32 = int_literal 0 +// CHECK:STDOUT: %.loc14_21: i32 = int_literal 0, const = constants.%.loc14 // CHECK:STDOUT: %.loc14_22.1: ref [i32; 3] = value_as_ref %b.ref.loc14 // CHECK:STDOUT: %.loc14_22.2: ref i32 = array_index %.loc14_22.1, %.loc14_21 // CHECK:STDOUT: %.loc14_22.3: i32 = bind_value %.loc14_22.2 // CHECK:STDOUT: %.loc14_18: i32* = addr_of %.loc14_22.3 // CHECK:STDOUT: assign %pb.var, %.loc14_18 // CHECK:STDOUT: %b.ref.loc18: [i32; 3] = name_ref b, %b -// CHECK:STDOUT: %.loc18_5: i32 = int_literal 0 +// CHECK:STDOUT: %.loc18_5: i32 = int_literal 0, const = constants.%.loc18_5 // CHECK:STDOUT: %.loc18_6.1: ref [i32; 3] = value_as_ref %b.ref.loc18 // CHECK:STDOUT: %.loc18_6.2: ref i32 = array_index %.loc18_6.1, %.loc18_5 // CHECK:STDOUT: %.loc18_6.3: i32 = bind_value %.loc18_6.2 -// CHECK:STDOUT: %.loc18_10: i32 = int_literal 4 +// CHECK:STDOUT: %.loc18_10: i32 = int_literal 4, const = constants.%.loc18_10 // CHECK:STDOUT: assign %.loc18_6.3, %.loc18_10 -// CHECK:STDOUT: %.loc25_14: type = ptr_type i32 +// CHECK:STDOUT: %.loc25_14: type = ptr_type i32, const // CHECK:STDOUT: %pf.var: ref i32* = var pf // CHECK:STDOUT: %pf: ref i32* = bind_name pf, %pf.var -// CHECK:STDOUT: %F.ref.loc25: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref.loc25: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc25_20.1: ref [i32; 3] = temporary_storage // CHECK:STDOUT: %.loc25_20.2: init [i32; 3] = call %F.ref.loc25() to %.loc25_20.1 -// CHECK:STDOUT: %.loc25_23: i32 = int_literal 0 +// CHECK:STDOUT: %.loc25_23: i32 = int_literal 0, const = constants.%.loc25 // CHECK:STDOUT: %.loc25_20.3: ref [i32; 3] = temporary %.loc25_20.1, %.loc25_20.2 // CHECK:STDOUT: %.loc25_24.1: ref i32 = array_index %.loc25_20.3, %.loc25_23 // CHECK:STDOUT: %.loc25_24.2: i32 = bind_value %.loc25_24.1 // CHECK:STDOUT: %.loc25_18: i32* = addr_of %.loc25_24.2 // CHECK:STDOUT: assign %pf.var, %.loc25_18 -// CHECK:STDOUT: %F.ref.loc29: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref.loc29: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc29_4.1: ref [i32; 3] = temporary_storage // CHECK:STDOUT: %.loc29_4.2: init [i32; 3] = call %F.ref.loc29() to %.loc29_4.1 -// CHECK:STDOUT: %.loc29_7: i32 = int_literal 0 +// CHECK:STDOUT: %.loc29_7: i32 = int_literal 0, const = constants.%.loc29_7 // CHECK:STDOUT: %.loc29_4.3: ref [i32; 3] = temporary %.loc29_4.1, %.loc29_4.2 // CHECK:STDOUT: %.loc29_8.1: ref i32 = array_index %.loc29_4.3, %.loc29_7 // CHECK:STDOUT: %.loc29_8.2: i32 = bind_value %.loc29_8.1 -// CHECK:STDOUT: %.loc29_12: i32 = int_literal 4 +// CHECK:STDOUT: %.loc29_12: i32 = int_literal 4, const = constants.%.loc29_12 // CHECK:STDOUT: assign %.loc29_8.2, %.loc29_12 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_invalid_base.carbon b/toolchain/check/testdata/index/fail_invalid_base.carbon index f85e215ac977..812ba58d46f1 100644 --- a/toolchain/check/testdata/index/fail_invalid_base.carbon +++ b/toolchain/check/testdata/index/fail_invalid_base.carbon @@ -33,8 +33,15 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: --- fail_invalid_base.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc26_29.1: type = struct_type {.a: i32, .b: i32} -// CHECK:STDOUT: %.loc26_29.2: type = ptr_type {.a: i32, .b: i32} +// CHECK:STDOUT: %.loc15: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc21: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc26_20: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc26_28: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc26_29.1: type = struct_type {.a: i32, .b: i32}, const +// CHECK:STDOUT: %.loc26_31: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc26_29.2: type = ptr_type {.a: i32, .b: i32}, const +// CHECK:STDOUT: %.loc26_29.3: {.a: i32, .b: i32} = struct_value (%.loc26_20, %.loc26_28), const +// CHECK:STDOUT: %.loc31: i32 = int_literal 0, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -43,27 +50,27 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var // CHECK:STDOUT: %N.ref: = name_ref N, %.loc11 -// CHECK:STDOUT: %.loc15: i32 = int_literal 0 +// CHECK:STDOUT: %.loc15: i32 = int_literal 0, const = constants.%.loc15 // CHECK:STDOUT: assign %a.var, -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var -// CHECK:STDOUT: %F.ref: = name_ref F, %F -// CHECK:STDOUT: %.loc21: i32 = int_literal 1 +// CHECK:STDOUT: %F.ref: = name_ref F, %F, const = %F +// CHECK:STDOUT: %.loc21: i32 = int_literal 1, const = constants.%.loc21 // CHECK:STDOUT: assign %b.var, // CHECK:STDOUT: %c.var: ref i32 = var c // CHECK:STDOUT: %c: ref i32 = bind_name c, %c.var -// CHECK:STDOUT: %.loc26_20: i32 = int_literal 1 -// CHECK:STDOUT: %.loc26_28: i32 = int_literal 2 +// CHECK:STDOUT: %.loc26_20: i32 = int_literal 1, const = constants.%.loc26_20 +// CHECK:STDOUT: %.loc26_28: i32 = int_literal 2, const = constants.%.loc26_28 // CHECK:STDOUT: %.loc26_29.1: {.a: i32, .b: i32} = struct_literal (%.loc26_20, %.loc26_28) -// CHECK:STDOUT: %.loc26_31: i32 = int_literal 0 -// CHECK:STDOUT: %.loc26_29.2: {.a: i32, .b: i32} = struct_value (%.loc26_20, %.loc26_28) +// CHECK:STDOUT: %.loc26_31: i32 = int_literal 0, const = constants.%.loc26_31 +// CHECK:STDOUT: %.loc26_29.2: {.a: i32, .b: i32} = struct_value (%.loc26_20, %.loc26_28), const = constants.%.loc26_29.3 // CHECK:STDOUT: %.loc26_29.3: {.a: i32, .b: i32} = converted %.loc26_29.1, %.loc26_29.2 // CHECK:STDOUT: assign %c.var, // CHECK:STDOUT: %d.var: ref i32 = var d // CHECK:STDOUT: %d: ref i32 = bind_name d, %d.var -// CHECK:STDOUT: %.loc31_31: type = struct_type {.a: i32, .b: i32} -// CHECK:STDOUT: %.loc31_33: i32 = int_literal 0 +// CHECK:STDOUT: %.loc31_31: type = struct_type {.a: i32, .b: i32}, const +// CHECK:STDOUT: %.loc31_33: i32 = int_literal 0, const = constants.%.loc31 // CHECK:STDOUT: assign %d.var, // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/fail_name_not_found.carbon b/toolchain/check/testdata/index/fail_name_not_found.carbon index b51c58884fff..bdc41c27e29c 100644 --- a/toolchain/check/testdata/index/fail_name_not_found.carbon +++ b/toolchain/check/testdata/index/fail_name_not_found.carbon @@ -13,9 +13,13 @@ fn Main() { // CHECK:STDOUT: --- fail_name_not_found.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc11: i32 = int_literal 0, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { @@ -23,7 +27,7 @@ fn Main() { // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: %a.ref: = name_ref a, -// CHECK:STDOUT: %.loc11: i32 = int_literal 0 +// CHECK:STDOUT: %.loc11: i32 = int_literal 0, const = constants.%.loc11 // CHECK:STDOUT: assign %b.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_negative_indexing.carbon b/toolchain/check/testdata/index/fail_negative_indexing.carbon index 9bc1bc7ab92a..6d8bca7422bb 100644 --- a/toolchain/check/testdata/index/fail_negative_indexing.carbon +++ b/toolchain/check/testdata/index/fail_negative_indexing.carbon @@ -13,9 +13,12 @@ var b: i32 = a[-10]; // CHECK:STDOUT: --- fail_negative_indexing.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_17.1: type = tuple_type (type, type) -// CHECK:STDOUT: %.loc7_17.2: type = tuple_type (i32, i32) -// CHECK:STDOUT: %.loc7_17.3: type = ptr_type (i32, i32) +// CHECK:STDOUT: %.loc7_17.1: type = tuple_type (type, type), const +// CHECK:STDOUT: %.loc7_17.2: type = tuple_type (i32, i32), const +// CHECK:STDOUT: %.loc7_17.3: type = ptr_type (i32, i32), const +// CHECK:STDOUT: %.loc7_22: i32 = int_literal 12, const +// CHECK:STDOUT: %.loc7_26: i32 = int_literal 6, const +// CHECK:STDOUT: %.loc11: i32 = int_literal 10, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { diff --git a/toolchain/check/testdata/index/fail_non_deterministic_type.carbon b/toolchain/check/testdata/index/fail_non_deterministic_type.carbon index 15cca93eafbf..f0d9940763ca 100644 --- a/toolchain/check/testdata/index/fail_non_deterministic_type.carbon +++ b/toolchain/check/testdata/index/fail_non_deterministic_type.carbon @@ -14,9 +14,12 @@ var c: i32 = a[b]; // CHECK:STDOUT: --- fail_non_deterministic_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_17.1: type = tuple_type (type, type) -// CHECK:STDOUT: %.loc7_17.2: type = tuple_type (i32, i32) -// CHECK:STDOUT: %.loc7_17.3: type = ptr_type (i32, i32) +// CHECK:STDOUT: %.loc7_17.1: type = tuple_type (type, type), const +// CHECK:STDOUT: %.loc7_17.2: type = tuple_type (i32, i32), const +// CHECK:STDOUT: %.loc7_17.3: type = ptr_type (i32, i32), const +// CHECK:STDOUT: %.loc7_22: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc7_25: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc8: i32 = int_literal 0, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -25,8 +28,8 @@ var c: i32 = a[b]; // CHECK:STDOUT: %.loc7_17.2: type = converted %.loc7_17.1, constants.%.loc7_17.2 // CHECK:STDOUT: %a.var: ref (i32, i32) = var a // CHECK:STDOUT: %a: ref (i32, i32) = bind_name a, %a.var -// CHECK:STDOUT: %.loc7_22: i32 = int_literal 2 -// CHECK:STDOUT: %.loc7_25: i32 = int_literal 3 +// CHECK:STDOUT: %.loc7_22: i32 = int_literal 2, const = constants.%.loc7_22 +// CHECK:STDOUT: %.loc7_25: i32 = int_literal 3, const = constants.%.loc7_25 // CHECK:STDOUT: %.loc7_26.1: (i32, i32) = tuple_literal (%.loc7_22, %.loc7_25) // CHECK:STDOUT: %.loc7_26.2: ref i32 = tuple_access %a.var, element0 // CHECK:STDOUT: %.loc7_26.3: init i32 = initialize_from %.loc7_22 to %.loc7_26.2 @@ -37,7 +40,7 @@ var c: i32 = a[b]; // CHECK:STDOUT: assign %a.var, %.loc7_26.7 // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 +// CHECK:STDOUT: %.loc8: i32 = int_literal 0, const = constants.%.loc8 // CHECK:STDOUT: assign %b.var, %.loc8 // CHECK:STDOUT: %c.var: ref i32 = var c // CHECK:STDOUT: %c: ref i32 = bind_name c, %c.var diff --git a/toolchain/check/testdata/index/fail_non_tuple_access.carbon b/toolchain/check/testdata/index/fail_non_tuple_access.carbon index 30ca55a1b6e4..e1c718ce157a 100644 --- a/toolchain/check/testdata/index/fail_non_tuple_access.carbon +++ b/toolchain/check/testdata/index/fail_non_tuple_access.carbon @@ -13,15 +13,20 @@ fn Main() { // CHECK:STDOUT: --- fail_non_tuple_access.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc11_3: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc11_5: i32 = int_literal 1, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_3: i32 = int_literal 0 -// CHECK:STDOUT: %.loc11_5: i32 = int_literal 1 +// CHECK:STDOUT: %.loc11_3: i32 = int_literal 0, const = constants.%.loc11_3 +// CHECK:STDOUT: %.loc11_5: i32 = int_literal 1, const = constants.%.loc11_5 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/fail_tuple_index_error.carbon b/toolchain/check/testdata/index/fail_tuple_index_error.carbon index e093125243b3..a19211984d92 100644 --- a/toolchain/check/testdata/index/fail_tuple_index_error.carbon +++ b/toolchain/check/testdata/index/fail_tuple_index_error.carbon @@ -13,9 +13,11 @@ var b: i32 = a[oops]; // CHECK:STDOUT: --- fail_tuple_index_error.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_17.1: type = tuple_type (type, type) -// CHECK:STDOUT: %.loc7_17.2: type = tuple_type (i32, i32) -// CHECK:STDOUT: %.loc7_17.3: type = ptr_type (i32, i32) +// CHECK:STDOUT: %.loc7_17.1: type = tuple_type (type, type), const +// CHECK:STDOUT: %.loc7_17.2: type = tuple_type (i32, i32), const +// CHECK:STDOUT: %.loc7_17.3: type = ptr_type (i32, i32), const +// CHECK:STDOUT: %.loc7_22: i32 = int_literal 12, const +// CHECK:STDOUT: %.loc7_26: i32 = int_literal 6, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -24,8 +26,8 @@ var b: i32 = a[oops]; // CHECK:STDOUT: %.loc7_17.2: type = converted %.loc7_17.1, constants.%.loc7_17.2 // CHECK:STDOUT: %a.var: ref (i32, i32) = var a // CHECK:STDOUT: %a: ref (i32, i32) = bind_name a, %a.var -// CHECK:STDOUT: %.loc7_22: i32 = int_literal 12 -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 6 +// CHECK:STDOUT: %.loc7_22: i32 = int_literal 12, const = constants.%.loc7_22 +// CHECK:STDOUT: %.loc7_26: i32 = int_literal 6, const = constants.%.loc7_26 // CHECK:STDOUT: %.loc7_27.1: (i32, i32) = tuple_literal (%.loc7_22, %.loc7_26) // CHECK:STDOUT: %.loc7_27.2: ref i32 = tuple_access %a.var, element0 // CHECK:STDOUT: %.loc7_27.3: init i32 = initialize_from %.loc7_22 to %.loc7_27.2 diff --git a/toolchain/check/testdata/index/fail_tuple_large_index.carbon b/toolchain/check/testdata/index/fail_tuple_large_index.carbon index b4195154bc51..d547cab2b7ef 100644 --- a/toolchain/check/testdata/index/fail_tuple_large_index.carbon +++ b/toolchain/check/testdata/index/fail_tuple_large_index.carbon @@ -14,8 +14,10 @@ var c: i32 = b[0xFFFFFFFFFFFFFFFFF]; // CHECK:STDOUT: --- fail_tuple_large_index.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_13.1: type = tuple_type (type) -// CHECK:STDOUT: %.loc7_13.2: type = tuple_type (i32) +// CHECK:STDOUT: %.loc7_13.1: type = tuple_type (type), const +// CHECK:STDOUT: %.loc7_13.2: type = tuple_type (i32), const +// CHECK:STDOUT: %.loc7_18: i32 = int_literal 12, const +// CHECK:STDOUT: %.loc12: i32 = int_literal 295147905179352825855, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -24,7 +26,7 @@ var c: i32 = b[0xFFFFFFFFFFFFFFFFF]; // CHECK:STDOUT: %.loc7_13.2: type = converted %.loc7_13.1, constants.%.loc7_13.2 // CHECK:STDOUT: %a.var: ref (i32,) = var a // CHECK:STDOUT: %a: ref (i32,) = bind_name a, %a.var -// CHECK:STDOUT: %.loc7_18: i32 = int_literal 12 +// CHECK:STDOUT: %.loc7_18: i32 = int_literal 12, const = constants.%.loc7_18 // CHECK:STDOUT: %.loc7_21.1: (i32,) = tuple_literal (%.loc7_18) // CHECK:STDOUT: %.loc7_21.2: init (i32,) = tuple_init (%.loc7_18) to %a.var // CHECK:STDOUT: %.loc7_21.3: init (i32,) = converted %.loc7_21.1, %.loc7_21.2 @@ -42,7 +44,7 @@ var c: i32 = b[0xFFFFFFFFFFFFFFFFF]; // CHECK:STDOUT: %c.var: ref i32 = var c // CHECK:STDOUT: %c: ref i32 = bind_name c, %c.var // CHECK:STDOUT: %b.ref: ref (i32,) = name_ref b, %b -// CHECK:STDOUT: %.loc12_16: i32 = int_literal 295147905179352825855 +// CHECK:STDOUT: %.loc12_16: i32 = int_literal 295147905179352825855, const = constants.%.loc12 // CHECK:STDOUT: %.loc12_35: ref = tuple_index %b.ref, // CHECK:STDOUT: assign %c.var, // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_tuple_non_int_indexing.carbon b/toolchain/check/testdata/index/fail_tuple_non_int_indexing.carbon index 4dd336570a82..913836b0e852 100644 --- a/toolchain/check/testdata/index/fail_tuple_non_int_indexing.carbon +++ b/toolchain/check/testdata/index/fail_tuple_non_int_indexing.carbon @@ -13,9 +13,12 @@ var b: i32 = a[2.6]; // CHECK:STDOUT: --- fail_tuple_non_int_indexing.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_17.1: type = tuple_type (type, type) -// CHECK:STDOUT: %.loc7_17.2: type = tuple_type (i32, i32) -// CHECK:STDOUT: %.loc7_17.3: type = ptr_type (i32, i32) +// CHECK:STDOUT: %.loc7_17.1: type = tuple_type (type, type), const +// CHECK:STDOUT: %.loc7_17.2: type = tuple_type (i32, i32), const +// CHECK:STDOUT: %.loc7_17.3: type = ptr_type (i32, i32), const +// CHECK:STDOUT: %.loc7_22: i32 = int_literal 12, const +// CHECK:STDOUT: %.loc7_26: i32 = int_literal 6, const +// CHECK:STDOUT: %.loc11: f64 = real_literal 26e-1, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -24,8 +27,8 @@ var b: i32 = a[2.6]; // CHECK:STDOUT: %.loc7_17.2: type = converted %.loc7_17.1, constants.%.loc7_17.2 // CHECK:STDOUT: %a.var: ref (i32, i32) = var a // CHECK:STDOUT: %a: ref (i32, i32) = bind_name a, %a.var -// CHECK:STDOUT: %.loc7_22: i32 = int_literal 12 -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 6 +// CHECK:STDOUT: %.loc7_22: i32 = int_literal 12, const = constants.%.loc7_22 +// CHECK:STDOUT: %.loc7_26: i32 = int_literal 6, const = constants.%.loc7_26 // CHECK:STDOUT: %.loc7_27.1: (i32, i32) = tuple_literal (%.loc7_22, %.loc7_26) // CHECK:STDOUT: %.loc7_27.2: ref i32 = tuple_access %a.var, element0 // CHECK:STDOUT: %.loc7_27.3: init i32 = initialize_from %.loc7_22 to %.loc7_27.2 @@ -37,7 +40,7 @@ var b: i32 = a[2.6]; // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: %a.ref: ref (i32, i32) = name_ref a, %a -// CHECK:STDOUT: %.loc11_16: f64 = real_literal 26e-1 +// CHECK:STDOUT: %.loc11_16: f64 = real_literal 26e-1, const = constants.%.loc11 // CHECK:STDOUT: %.loc11_19: ref = tuple_index %a.ref, // CHECK:STDOUT: assign %b.var, // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_tuple_out_of_bound_access.carbon b/toolchain/check/testdata/index/fail_tuple_out_of_bound_access.carbon index 13f4a1df2800..907133e1046e 100644 --- a/toolchain/check/testdata/index/fail_tuple_out_of_bound_access.carbon +++ b/toolchain/check/testdata/index/fail_tuple_out_of_bound_access.carbon @@ -13,9 +13,12 @@ var b: i32 = a[2]; // CHECK:STDOUT: --- fail_tuple_out_of_bound_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_17.1: type = tuple_type (type, type) -// CHECK:STDOUT: %.loc7_17.2: type = tuple_type (i32, i32) -// CHECK:STDOUT: %.loc7_17.3: type = ptr_type (i32, i32) +// CHECK:STDOUT: %.loc7_17.1: type = tuple_type (type, type), const +// CHECK:STDOUT: %.loc7_17.2: type = tuple_type (i32, i32), const +// CHECK:STDOUT: %.loc7_17.3: type = ptr_type (i32, i32), const +// CHECK:STDOUT: %.loc7_22: i32 = int_literal 12, const +// CHECK:STDOUT: %.loc7_26: i32 = int_literal 6, const +// CHECK:STDOUT: %.loc11: i32 = int_literal 2, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -24,8 +27,8 @@ var b: i32 = a[2]; // CHECK:STDOUT: %.loc7_17.2: type = converted %.loc7_17.1, constants.%.loc7_17.2 // CHECK:STDOUT: %a.var: ref (i32, i32) = var a // CHECK:STDOUT: %a: ref (i32, i32) = bind_name a, %a.var -// CHECK:STDOUT: %.loc7_22: i32 = int_literal 12 -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 6 +// CHECK:STDOUT: %.loc7_22: i32 = int_literal 12, const = constants.%.loc7_22 +// CHECK:STDOUT: %.loc7_26: i32 = int_literal 6, const = constants.%.loc7_26 // CHECK:STDOUT: %.loc7_27.1: (i32, i32) = tuple_literal (%.loc7_22, %.loc7_26) // CHECK:STDOUT: %.loc7_27.2: ref i32 = tuple_access %a.var, element0 // CHECK:STDOUT: %.loc7_27.3: init i32 = initialize_from %.loc7_22 to %.loc7_27.2 @@ -37,7 +40,7 @@ var b: i32 = a[2]; // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: %a.ref: ref (i32, i32) = name_ref a, %a -// CHECK:STDOUT: %.loc11_16: i32 = int_literal 2 +// CHECK:STDOUT: %.loc11_16: i32 = int_literal 2, const = constants.%.loc11 // CHECK:STDOUT: %.loc11_17: ref = tuple_index %a.ref, // CHECK:STDOUT: assign %b.var, // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/tuple_element_access.carbon b/toolchain/check/testdata/index/tuple_element_access.carbon index 0cee2c285477..932970c4c0cb 100644 --- a/toolchain/check/testdata/index/tuple_element_access.carbon +++ b/toolchain/check/testdata/index/tuple_element_access.carbon @@ -11,8 +11,10 @@ var c: i32 = b[0]; // CHECK:STDOUT: --- tuple_element_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_13.1: type = tuple_type (type) -// CHECK:STDOUT: %.loc7_13.2: type = tuple_type (i32) +// CHECK:STDOUT: %.loc7_13.1: type = tuple_type (type), const +// CHECK:STDOUT: %.loc7_13.2: type = tuple_type (i32), const +// CHECK:STDOUT: %.loc7_18: i32 = int_literal 12, const +// CHECK:STDOUT: %.loc9: i32 = int_literal 0, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -21,7 +23,7 @@ var c: i32 = b[0]; // CHECK:STDOUT: %.loc7_13.2: type = converted %.loc7_13.1, constants.%.loc7_13.2 // CHECK:STDOUT: %a.var: ref (i32,) = var a // CHECK:STDOUT: %a: ref (i32,) = bind_name a, %a.var -// CHECK:STDOUT: %.loc7_18: i32 = int_literal 12 +// CHECK:STDOUT: %.loc7_18: i32 = int_literal 12, const = constants.%.loc7_18 // CHECK:STDOUT: %.loc7_21.1: (i32,) = tuple_literal (%.loc7_18) // CHECK:STDOUT: %.loc7_21.2: init (i32,) = tuple_init (%.loc7_18) to %a.var // CHECK:STDOUT: %.loc7_21.3: init (i32,) = converted %.loc7_21.1, %.loc7_21.2 @@ -39,7 +41,7 @@ var c: i32 = b[0]; // CHECK:STDOUT: %c.var: ref i32 = var c // CHECK:STDOUT: %c: ref i32 = bind_name c, %c.var // CHECK:STDOUT: %b.ref: ref (i32,) = name_ref b, %b -// CHECK:STDOUT: %.loc9_16: i32 = int_literal 0 +// CHECK:STDOUT: %.loc9_16: i32 = int_literal 0, const = constants.%.loc9 // CHECK:STDOUT: %.loc9_17.1: ref i32 = tuple_index %b.ref, %.loc9_16 // CHECK:STDOUT: %.loc9_17.2: i32 = bind_value %.loc9_17.1 // CHECK:STDOUT: assign %c.var, %.loc9_17.2 diff --git a/toolchain/check/testdata/index/tuple_return_value_access.carbon b/toolchain/check/testdata/index/tuple_return_value_access.carbon index b5d3c336d59c..03b635963f7d 100644 --- a/toolchain/check/testdata/index/tuple_return_value_access.carbon +++ b/toolchain/check/testdata/index/tuple_return_value_access.carbon @@ -13,30 +13,33 @@ fn Run() -> i32 { // CHECK:STDOUT: --- tuple_return_value_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_16.1: type = tuple_type (type) -// CHECK:STDOUT: %.loc7_16.2: type = tuple_type (i32) +// CHECK:STDOUT: %.loc7_16.1: type = tuple_type (type), const +// CHECK:STDOUT: %.loc7_16.2: type = tuple_type (i32), const +// CHECK:STDOUT: %.loc7_28: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc7_30: (i32,) = tuple_value (%.loc7_28), const +// CHECK:STDOUT: %.loc10: i32 = int_literal 0, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F, .Run = %Run} -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %Run: = fn_decl @Run +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %Run: = fn_decl @Run, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> (i32,) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_28: i32 = int_literal 0 +// CHECK:STDOUT: %.loc7_28: i32 = int_literal 0, const = constants.%.loc7_28 // CHECK:STDOUT: %.loc7_30.1: (i32,) = tuple_literal (%.loc7_28) -// CHECK:STDOUT: %.loc7_30.2: (i32,) = tuple_value (%.loc7_28) +// CHECK:STDOUT: %.loc7_30.2: (i32,) = tuple_value (%.loc7_28), const = constants.%.loc7_30 // CHECK:STDOUT: %.loc7_30.3: (i32,) = converted %.loc7_30.1, %.loc7_30.2 // CHECK:STDOUT: return %.loc7_30.3 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc10_11.1: init (i32,) = call %F.ref() -// CHECK:STDOUT: %.loc10_14: i32 = int_literal 0 +// CHECK:STDOUT: %.loc10_14: i32 = int_literal 0, const = constants.%.loc10 // CHECK:STDOUT: %.loc10_11.2: ref (i32,) = temporary_storage // CHECK:STDOUT: %.loc10_11.3: ref (i32,) = temporary %.loc10_11.2, %.loc10_11.1 // CHECK:STDOUT: %.loc10_15.1: ref i32 = tuple_index %.loc10_11.3, %.loc10_14 diff --git a/toolchain/check/testdata/interface/basic.carbon b/toolchain/check/testdata/interface/basic.carbon index c44c734ecba9..8796ee4ac07c 100644 --- a/toolchain/check/testdata/interface/basic.carbon +++ b/toolchain/check/testdata/interface/basic.carbon @@ -28,7 +28,7 @@ interface ForwardDeclared { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @ForwardDeclared { -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F diff --git a/toolchain/check/testdata/interface/fail_duplicate.carbon b/toolchain/check/testdata/interface/fail_duplicate.carbon index c6c2de535aa4..d7f053a6fe1b 100644 --- a/toolchain/check/testdata/interface/fail_duplicate.carbon +++ b/toolchain/check/testdata/interface/fail_duplicate.carbon @@ -42,15 +42,15 @@ interface Class { } // CHECK:STDOUT: package: = namespace package, {.Interface = %Interface.decl.loc7, .Function = %Function, .Class = %Class.decl} // CHECK:STDOUT: %Interface.decl.loc7 = interface_decl @Interface, () // CHECK:STDOUT: %Interface.decl.loc15 = interface_decl @Interface, () -// CHECK:STDOUT: %Function: = fn_decl @Function +// CHECK:STDOUT: %Function: = fn_decl @Function, const // CHECK:STDOUT: %.decl.loc27 = interface_decl @.1, () // CHECK:STDOUT: %Class.decl = class_decl @Class, () -// CHECK:STDOUT: %Class: type = class_type @Class +// CHECK:STDOUT: %Class: type = class_type @Class, const // CHECK:STDOUT: %.decl.loc37 = interface_decl @.2, () // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Interface { -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .F = %F diff --git a/toolchain/check/testdata/interface/fail_todo_modifiers.carbon b/toolchain/check/testdata/interface/fail_todo_modifiers.carbon index a965d03a281e..c3ad221253b3 100644 --- a/toolchain/check/testdata/interface/fail_todo_modifiers.carbon +++ b/toolchain/check/testdata/interface/fail_todo_modifiers.carbon @@ -30,8 +30,8 @@ private interface Private { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Modifiers { -// CHECK:STDOUT: %Final: = fn_decl @Final -// CHECK:STDOUT: %Default: = fn_decl @Default +// CHECK:STDOUT: %Final: = fn_decl @Final, const +// CHECK:STDOUT: %Default: = fn_decl @Default, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Final = %Final diff --git a/toolchain/check/testdata/ir/duplicate_name_same_line.carbon b/toolchain/check/testdata/ir/duplicate_name_same_line.carbon index 1416b61b1a81..6332aee3ec6a 100644 --- a/toolchain/check/testdata/ir/duplicate_name_same_line.carbon +++ b/toolchain/check/testdata/ir/duplicate_name_same_line.carbon @@ -8,31 +8,38 @@ fn A() { if (true) { var n: i32 = 1; } if (true) { var n: i32 = 2; } } // CHECK:STDOUT: --- duplicate_name_same_line.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc7_14: bool = bool_literal true, const +// CHECK:STDOUT: %.loc7_35: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc7_44: bool = bool_literal true, const +// CHECK:STDOUT: %.loc7_65: i32 = int_literal 2, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %A} -// CHECK:STDOUT: %A: = fn_decl @A +// CHECK:STDOUT: %A: = fn_decl @A, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_14: bool = bool_literal true +// CHECK:STDOUT: %.loc7_14: bool = bool_literal true, const = constants.%.loc7_14 // CHECK:STDOUT: if %.loc7_14 br !if.then.loc7_18 else br !if.else.loc7_18 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc7_18: // CHECK:STDOUT: %n.var.loc7_26: ref i32 = var n // CHECK:STDOUT: %n.loc7_26: ref i32 = bind_name n, %n.var.loc7_26 -// CHECK:STDOUT: %.loc7_35: i32 = int_literal 1 +// CHECK:STDOUT: %.loc7_35: i32 = int_literal 1, const = constants.%.loc7_35 // CHECK:STDOUT: assign %n.var.loc7_26, %.loc7_35 // CHECK:STDOUT: br !if.else.loc7_18 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc7_18: -// CHECK:STDOUT: %.loc7_44: bool = bool_literal true +// CHECK:STDOUT: %.loc7_44: bool = bool_literal true, const = constants.%.loc7_44 // CHECK:STDOUT: if %.loc7_44 br !if.then.loc7_48 else br !if.else.loc7_48 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc7_48: // CHECK:STDOUT: %n.var.loc7_56: ref i32 = var n // CHECK:STDOUT: %n.loc7_56: ref i32 = bind_name n, %n.var.loc7_56 -// CHECK:STDOUT: %.loc7_65: i32 = int_literal 2 +// CHECK:STDOUT: %.loc7_65: i32 = int_literal 2, const = constants.%.loc7_65 // CHECK:STDOUT: assign %n.var.loc7_56, %.loc7_65 // CHECK:STDOUT: br !if.else.loc7_48 // CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/convert.carbon b/toolchain/check/testdata/let/convert.carbon index 831e01972f1d..bb796c036222 100644 --- a/toolchain/check/testdata/let/convert.carbon +++ b/toolchain/check/testdata/let/convert.carbon @@ -14,14 +14,18 @@ fn F() -> i32 { // CHECK:STDOUT: --- convert.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc8_24.1: type = tuple_type (type, type, type) -// CHECK:STDOUT: %.loc8_24.2: type = tuple_type (i32, i32, i32) -// CHECK:STDOUT: %.loc8_24.3: type = ptr_type (i32, i32, i32) +// CHECK:STDOUT: %.loc8_24.1: type = tuple_type (type, type, type), const +// CHECK:STDOUT: %.loc8_24.2: type = tuple_type (i32, i32, i32), const +// CHECK:STDOUT: %.loc8_24.3: type = ptr_type (i32, i32, i32), const +// CHECK:STDOUT: %.loc8_29: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc8_32: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc8_35: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc11: i32 = int_literal 1, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { @@ -30,9 +34,9 @@ fn F() -> i32 { // CHECK:STDOUT: %.loc8_24.2: type = converted %.loc8_24.1, constants.%.loc8_24.2 // CHECK:STDOUT: %v.var: ref (i32, i32, i32) = var v // CHECK:STDOUT: %v: ref (i32, i32, i32) = bind_name v, %v.var -// CHECK:STDOUT: %.loc8_29: i32 = int_literal 1 -// CHECK:STDOUT: %.loc8_32: i32 = int_literal 2 -// CHECK:STDOUT: %.loc8_35: i32 = int_literal 3 +// CHECK:STDOUT: %.loc8_29: i32 = int_literal 1, const = constants.%.loc8_29 +// CHECK:STDOUT: %.loc8_32: i32 = int_literal 2, const = constants.%.loc8_32 +// CHECK:STDOUT: %.loc8_35: i32 = int_literal 3, const = constants.%.loc8_35 // CHECK:STDOUT: %.loc8_36.1: (i32, i32, i32) = tuple_literal (%.loc8_29, %.loc8_32, %.loc8_35) // CHECK:STDOUT: %.loc8_36.2: ref i32 = tuple_access %v.var, element0 // CHECK:STDOUT: %.loc8_36.3: init i32 = initialize_from %.loc8_29 to %.loc8_36.2 @@ -56,7 +60,7 @@ fn F() -> i32 { // CHECK:STDOUT: %.loc10_28.8: (i32, i32, i32) = converted %v.ref, %.loc10_28.7 // CHECK:STDOUT: %w: (i32, i32, i32) = bind_name w, %.loc10_28.8 // CHECK:STDOUT: %w.ref: (i32, i32, i32) = name_ref w, %w -// CHECK:STDOUT: %.loc11_12: i32 = int_literal 1 +// CHECK:STDOUT: %.loc11_12: i32 = int_literal 1, const = constants.%.loc11 // CHECK:STDOUT: %.loc11_13: i32 = tuple_index %w.ref, %.loc11_12 // CHECK:STDOUT: return %.loc11_13 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/let/fail_duplicate_decl.carbon b/toolchain/check/testdata/let/fail_duplicate_decl.carbon index 1700a6abfca4..1a79c9131947 100644 --- a/toolchain/check/testdata/let/fail_duplicate_decl.carbon +++ b/toolchain/check/testdata/let/fail_duplicate_decl.carbon @@ -16,14 +16,18 @@ fn F(a: i32) { // CHECK:STDOUT: --- fail_duplicate_decl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc14: i32 = int_literal 1, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%a.loc7: i32) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc14: i32 = int_literal 1 +// CHECK:STDOUT: %.loc14: i32 = int_literal 1, const = constants.%.loc14 // CHECK:STDOUT: %a.loc14: i32 = bind_name a, %.loc14 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/let/fail_generic.carbon b/toolchain/check/testdata/let/fail_generic.carbon index e35e45400fd1..0750c790c054 100644 --- a/toolchain/check/testdata/let/fail_generic.carbon +++ b/toolchain/check/testdata/let/fail_generic.carbon @@ -19,16 +19,20 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: --- fail_generic.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc13: i32 = int_literal 5, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%a: i32) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %T: type = bind_symbolic_name T, i32 // CHECK:STDOUT: %T.ref: type = name_ref T, %T -// CHECK:STDOUT: %.loc13: i32 = int_literal 5 +// CHECK:STDOUT: %.loc13: i32 = int_literal 5, const = constants.%.loc13 // CHECK:STDOUT: %x: T = bind_name x, // CHECK:STDOUT: %x.ref: T = name_ref x, %x // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/let/fail_modifiers.carbon b/toolchain/check/testdata/let/fail_modifiers.carbon index 2974fd1a9b40..6eeefe738b0b 100644 --- a/toolchain/check/testdata/let/fail_modifiers.carbon +++ b/toolchain/check/testdata/let/fail_modifiers.carbon @@ -70,23 +70,34 @@ protected protected let i: i32 = 1; // CHECK:STDOUT: --- fail_modifiers.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc10: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc15: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc20: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc25: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc36: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc47: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc58: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc69: i32 = int_literal 1, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {} -// CHECK:STDOUT: %.loc10: i32 = int_literal 1 +// CHECK:STDOUT: %.loc10: i32 = int_literal 1, const = constants.%.loc10 // CHECK:STDOUT: %b: i32 = bind_name b, %.loc10 -// CHECK:STDOUT: %.loc15: i32 = int_literal 1 +// CHECK:STDOUT: %.loc15: i32 = int_literal 1, const = constants.%.loc15 // CHECK:STDOUT: %c: i32 = bind_name c, %.loc15 -// CHECK:STDOUT: %.loc20: i32 = int_literal 1 +// CHECK:STDOUT: %.loc20: i32 = int_literal 1, const = constants.%.loc20 // CHECK:STDOUT: %d: i32 = bind_name d, %.loc20 -// CHECK:STDOUT: %.loc25: i32 = int_literal 1 +// CHECK:STDOUT: %.loc25: i32 = int_literal 1, const = constants.%.loc25 // CHECK:STDOUT: %e: i32 = bind_name e, %.loc25 -// CHECK:STDOUT: %.loc36: i32 = int_literal 1 +// CHECK:STDOUT: %.loc36: i32 = int_literal 1, const = constants.%.loc36 // CHECK:STDOUT: %f: i32 = bind_name f, %.loc36 -// CHECK:STDOUT: %.loc47: i32 = int_literal 1 +// CHECK:STDOUT: %.loc47: i32 = int_literal 1, const = constants.%.loc47 // CHECK:STDOUT: %g: i32 = bind_name g, %.loc47 -// CHECK:STDOUT: %.loc58: i32 = int_literal 1 +// CHECK:STDOUT: %.loc58: i32 = int_literal 1, const = constants.%.loc58 // CHECK:STDOUT: %h: i32 = bind_name h, %.loc58 -// CHECK:STDOUT: %.loc69: i32 = int_literal 1 +// CHECK:STDOUT: %.loc69: i32 = int_literal 1, const = constants.%.loc69 // CHECK:STDOUT: %i: i32 = bind_name i, %.loc69 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/fail_todo_modifiers.carbon b/toolchain/check/testdata/let/fail_todo_modifiers.carbon index 5012eec79e50..4446c62180c5 100644 --- a/toolchain/check/testdata/let/fail_todo_modifiers.carbon +++ b/toolchain/check/testdata/let/fail_todo_modifiers.carbon @@ -11,9 +11,13 @@ private let a: i32 = 1; // CHECK:STDOUT: --- fail_todo_modifiers.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc10: i32 = int_literal 1, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {} -// CHECK:STDOUT: %.loc10: i32 = int_literal 1 +// CHECK:STDOUT: %.loc10: i32 = int_literal 1, const = constants.%.loc10 // CHECK:STDOUT: %a: i32 = bind_name a, %.loc10 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/fail_use_in_init.carbon b/toolchain/check/testdata/let/fail_use_in_init.carbon index 7bae79f4cc6b..9f0af7b98068 100644 --- a/toolchain/check/testdata/let/fail_use_in_init.carbon +++ b/toolchain/check/testdata/let/fail_use_in_init.carbon @@ -15,7 +15,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/let/generic.carbon b/toolchain/check/testdata/let/generic.carbon index 301e10dd0033..8a111d12ea14 100644 --- a/toolchain/check/testdata/let/generic.carbon +++ b/toolchain/check/testdata/let/generic.carbon @@ -14,14 +14,14 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %T: type = bind_symbolic_name T, i32 // CHECK:STDOUT: %T.ref.loc9: type = name_ref T, %T -// CHECK:STDOUT: %.loc9: type = ptr_type T +// CHECK:STDOUT: %.loc9: type = ptr_type T, const // CHECK:STDOUT: %p.var: ref T* = var p // CHECK:STDOUT: %p: ref T* = bind_name p, %p.var // CHECK:STDOUT: %T.ref.loc10: type = name_ref T, %T diff --git a/toolchain/check/testdata/let/global.carbon b/toolchain/check/testdata/let/global.carbon index 8e3827ae6948..46b695c3c35e 100644 --- a/toolchain/check/testdata/let/global.carbon +++ b/toolchain/check/testdata/let/global.carbon @@ -10,11 +10,15 @@ fn F() -> i32 { return n; } // CHECK:STDOUT: --- global.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc7: i32 = int_literal 1, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} -// CHECK:STDOUT: %.loc7: i32 = int_literal 1 +// CHECK:STDOUT: %.loc7: i32 = int_literal 1, const = constants.%.loc7 // CHECK:STDOUT: %n: i32 = bind_name n, %.loc7 -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { diff --git a/toolchain/check/testdata/let/local.carbon b/toolchain/check/testdata/let/local.carbon index 9fad792c1c24..694c94d3301d 100644 --- a/toolchain/check/testdata/let/local.carbon +++ b/toolchain/check/testdata/let/local.carbon @@ -13,7 +13,7 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%a: i32) -> i32 { diff --git a/toolchain/check/testdata/namespace/add_to_import.carbon b/toolchain/check/testdata/namespace/add_to_import.carbon index 718064d689d8..9dee257866d7 100644 --- a/toolchain/check/testdata/namespace/add_to_import.carbon +++ b/toolchain/check/testdata/namespace/add_to_import.carbon @@ -27,21 +27,25 @@ var a: i32 = NS.A(); // CHECK:STDOUT: // CHECK:STDOUT: --- implicit.impl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc4: i32 = int_literal 0, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.NS = %.2, .a = %a} // CHECK:STDOUT: %.2: = namespace NS, {.A = %A} -// CHECK:STDOUT: %A: = fn_decl @A +// CHECK:STDOUT: %A: = fn_decl @A, const // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var // CHECK:STDOUT: %NS.ref: = name_ref NS, %.2 -// CHECK:STDOUT: %A.ref: = name_ref A, %A +// CHECK:STDOUT: %A.ref: = name_ref A, %A, const = %A // CHECK:STDOUT: %.loc6: init i32 = call %A.ref() // CHECK:STDOUT: assign %a.var, %.loc6 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc4: i32 = int_literal 0 +// CHECK:STDOUT: %.loc4: i32 = int_literal 0, const = constants.%.loc4 // CHECK:STDOUT: return %.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/fail_duplicate.carbon b/toolchain/check/testdata/namespace/fail_duplicate.carbon index 2fb2a15a365b..f0961e947693 100644 --- a/toolchain/check/testdata/namespace/fail_duplicate.carbon +++ b/toolchain/check/testdata/namespace/fail_duplicate.carbon @@ -23,8 +23,8 @@ fn Foo.Baz() { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Foo = %.loc7} // CHECK:STDOUT: %.loc7: = namespace Foo, {.Baz = %Baz.loc9} -// CHECK:STDOUT: %Baz.loc9: = fn_decl @Baz -// CHECK:STDOUT: %Baz.loc18: = fn_decl @Baz +// CHECK:STDOUT: %Baz.loc9: = fn_decl @Baz, const +// CHECK:STDOUT: %Baz.loc18: = fn_decl @Baz, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Baz() { diff --git a/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon b/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon index eb660b156ae3..38e1cb736b04 100644 --- a/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon +++ b/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon @@ -14,7 +14,7 @@ fn Foo.Baz() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {} -// CHECK:STDOUT: %.loc10: = fn_decl @.1 +// CHECK:STDOUT: %.loc10: = fn_decl @.1, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @.1() { diff --git a/toolchain/check/testdata/namespace/function.carbon b/toolchain/check/testdata/namespace/function.carbon index affcc926a08d..cbc80ac83e2f 100644 --- a/toolchain/check/testdata/namespace/function.carbon +++ b/toolchain/check/testdata/namespace/function.carbon @@ -20,15 +20,15 @@ fn Bar() { // CHECK:STDOUT: --- function.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc17: type = tuple_type () +// CHECK:STDOUT: %.loc17: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Foo = %.loc7, .Baz = %Baz.loc10, .Bar = %Bar} // CHECK:STDOUT: %.loc7: = namespace Foo, {.Baz = %Baz.loc13} -// CHECK:STDOUT: %Baz.loc10: = fn_decl @Baz.1 -// CHECK:STDOUT: %Baz.loc13: = fn_decl @Baz.2 -// CHECK:STDOUT: %Bar: = fn_decl @Bar +// CHECK:STDOUT: %Baz.loc10: = fn_decl @Baz.1, const +// CHECK:STDOUT: %Baz.loc13: = fn_decl @Baz.2, const +// CHECK:STDOUT: %Bar: = fn_decl @Bar, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Baz.1() { @@ -44,7 +44,7 @@ fn Bar() { // CHECK:STDOUT: fn @Bar() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%.loc7 -// CHECK:STDOUT: %Baz.ref: = name_ref Baz, file.%Baz.loc13 +// CHECK:STDOUT: %Baz.ref: = name_ref Baz, file.%Baz.loc13, const = file.%Baz.loc13 // CHECK:STDOUT: %.loc17: init () = call %Baz.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/namespace/imported.carbon b/toolchain/check/testdata/namespace/imported.carbon index 2ca8cdb78448..ec6010eaca35 100644 --- a/toolchain/check/testdata/namespace/imported.carbon +++ b/toolchain/check/testdata/namespace/imported.carbon @@ -30,8 +30,8 @@ var package_b: () = package.NS.ChildNS.B(); // CHECK:STDOUT: package: = namespace package, {.NS = %.loc4} // CHECK:STDOUT: %.loc4: = namespace NS, {.ChildNS = %.loc5, .A = %A} // CHECK:STDOUT: %.loc5: = namespace ChildNS, {.B = %B} -// CHECK:STDOUT: %A: = fn_decl @A -// CHECK:STDOUT: %B: = fn_decl @B +// CHECK:STDOUT: %A: = fn_decl @A, const +// CHECK:STDOUT: %B: = fn_decl @B, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); @@ -41,21 +41,21 @@ var package_b: () = package.NS.ChildNS.B(); // CHECK:STDOUT: --- implicit.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc4: type = tuple_type () +// CHECK:STDOUT: %.loc4: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.NS = %.2, .a = %a, .b = %b, .package_a = %package_a, .package_b = %package_b} // CHECK:STDOUT: %.2: = namespace NS, {.ChildNS = %.3, .A = %.4} // CHECK:STDOUT: %.3: = namespace ChildNS, {.B = %.5} -// CHECK:STDOUT: %.4: = fn_decl @.1 -// CHECK:STDOUT: %.5: = fn_decl @.2 +// CHECK:STDOUT: %.4: = fn_decl @.1, const +// CHECK:STDOUT: %.5: = fn_decl @.2, const // CHECK:STDOUT: %.loc4_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc4_9.2: type = converted %.loc4_9.1, constants.%.loc4 // CHECK:STDOUT: %a.var: ref () = var a // CHECK:STDOUT: %a: ref () = bind_name a, %a.var // CHECK:STDOUT: %NS.ref.loc4: = name_ref NS, %.2 -// CHECK:STDOUT: %A.ref.loc4: = name_ref A, %.4 +// CHECK:STDOUT: %A.ref.loc4: = name_ref A, %.4, const = %.4 // CHECK:STDOUT: %.loc4_17: init () = call %A.ref.loc4() // CHECK:STDOUT: assign %a.var, %.loc4_17 // CHECK:STDOUT: %.loc5_9: () = tuple_literal () @@ -64,7 +64,7 @@ var package_b: () = package.NS.ChildNS.B(); // CHECK:STDOUT: %b: ref () = bind_name b, %b.var // CHECK:STDOUT: %NS.ref.loc5: = name_ref NS, %.2 // CHECK:STDOUT: %ChildNS.ref.loc5: = name_ref ChildNS, %.3 -// CHECK:STDOUT: %B.ref.loc5: = name_ref B, %.5 +// CHECK:STDOUT: %B.ref.loc5: = name_ref B, %.5, const = %.5 // CHECK:STDOUT: %.loc5_25: init () = call %B.ref.loc5() // CHECK:STDOUT: assign %b.var, %.loc5_25 // CHECK:STDOUT: %.loc7_17: () = tuple_literal () @@ -73,7 +73,7 @@ var package_b: () = package.NS.ChildNS.B(); // CHECK:STDOUT: %package_a: ref () = bind_name package_a, %package_a.var // CHECK:STDOUT: %package.ref.loc7: = name_ref package, package // CHECK:STDOUT: %NS.ref.loc7: = name_ref NS, %.2 -// CHECK:STDOUT: %A.ref.loc7: = name_ref A, %.4 +// CHECK:STDOUT: %A.ref.loc7: = name_ref A, %.4, const = %.4 // CHECK:STDOUT: %.loc7_33: init () = call %A.ref.loc7() // CHECK:STDOUT: assign %package_a.var, %.loc7_33 // CHECK:STDOUT: %.loc8_17: () = tuple_literal () @@ -83,7 +83,7 @@ var package_b: () = package.NS.ChildNS.B(); // CHECK:STDOUT: %package.ref.loc8: = name_ref package, package // CHECK:STDOUT: %NS.ref.loc8: = name_ref NS, %.2 // CHECK:STDOUT: %ChildNS.ref.loc8: = name_ref ChildNS, %.3 -// CHECK:STDOUT: %B.ref.loc8: = name_ref B, %.5 +// CHECK:STDOUT: %B.ref.loc8: = name_ref B, %.5, const = %.5 // CHECK:STDOUT: %.loc8_41: init () = call %B.ref.loc8() // CHECK:STDOUT: assign %package_b.var, %.loc8_41 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/namespace/imported_indirect.carbon b/toolchain/check/testdata/namespace/imported_indirect.carbon index f86328efb7f8..3bb0b75f7ed1 100644 --- a/toolchain/check/testdata/namespace/imported_indirect.carbon +++ b/toolchain/check/testdata/namespace/imported_indirect.carbon @@ -69,7 +69,7 @@ var e: () = A.B.C.D(); // CHECK:STDOUT: %.2: = namespace A, {.B = %.3} // CHECK:STDOUT: %.3: = namespace B, {.C = %.4} // CHECK:STDOUT: %.4: = namespace C, {.D = %D} -// CHECK:STDOUT: %D: = fn_decl @D +// CHECK:STDOUT: %D: = fn_decl @D, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @D() { @@ -80,7 +80,7 @@ var e: () = A.B.C.D(); // CHECK:STDOUT: --- e.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc5: type = tuple_type () +// CHECK:STDOUT: %.loc5: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -88,7 +88,7 @@ var e: () = A.B.C.D(); // CHECK:STDOUT: %.2: = namespace A, {.B = %.3} // CHECK:STDOUT: %.3: = namespace B, {.C = %.4} // CHECK:STDOUT: %.4: = namespace C, {.D = %.5} -// CHECK:STDOUT: %.5: = fn_decl @.1 +// CHECK:STDOUT: %.5: = fn_decl @.1, const // CHECK:STDOUT: %.loc5_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc5_9.2: type = converted %.loc5_9.1, constants.%.loc5 // CHECK:STDOUT: %e.var: ref () = var e @@ -96,7 +96,7 @@ var e: () = A.B.C.D(); // CHECK:STDOUT: %A.ref: = name_ref A, %.2 // CHECK:STDOUT: %B.ref: = name_ref B, %.3 // CHECK:STDOUT: %C.ref: = name_ref C, %.4 -// CHECK:STDOUT: %D.ref: = name_ref D, %.5 +// CHECK:STDOUT: %D.ref: = name_ref D, %.5, const = %.5 // CHECK:STDOUT: %.loc5_20: init () = call %D.ref() // CHECK:STDOUT: assign %e.var, %.loc5_20 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/namespace/nested.carbon b/toolchain/check/testdata/namespace/nested.carbon index 813eaeb63f45..12aa0366bd89 100644 --- a/toolchain/check/testdata/namespace/nested.carbon +++ b/toolchain/check/testdata/namespace/nested.carbon @@ -17,15 +17,15 @@ fn Foo.Bar.Baz() { // CHECK:STDOUT: --- nested.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc14: type = tuple_type () +// CHECK:STDOUT: %.loc14: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Foo = %.loc7} // CHECK:STDOUT: %.loc7: = namespace Foo, {.Bar = %.loc8} // CHECK:STDOUT: %.loc8: = namespace Bar, {.Wiz = %Wiz, .Baz = %Baz} -// CHECK:STDOUT: %Wiz: = fn_decl @Wiz -// CHECK:STDOUT: %Baz: = fn_decl @Baz +// CHECK:STDOUT: %Wiz: = fn_decl @Wiz, const +// CHECK:STDOUT: %Baz: = fn_decl @Baz, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Wiz() { @@ -37,7 +37,7 @@ fn Foo.Bar.Baz() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%.loc7 // CHECK:STDOUT: %Bar.ref: = name_ref Bar, file.%.loc8 -// CHECK:STDOUT: %Wiz.ref: = name_ref Wiz, file.%Wiz +// CHECK:STDOUT: %Wiz.ref: = name_ref Wiz, file.%Wiz, const = file.%Wiz // CHECK:STDOUT: %.loc14: init () = call %Wiz.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/namespace/shadow.carbon b/toolchain/check/testdata/namespace/shadow.carbon index be1643938097..a97c24add77e 100644 --- a/toolchain/check/testdata/namespace/shadow.carbon +++ b/toolchain/check/testdata/namespace/shadow.carbon @@ -26,16 +26,19 @@ fn N.M.B() -> i32 { // CHECK:STDOUT: --- shadow.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc16: type = tuple_type () +// CHECK:STDOUT: %.loc16: type = tuple_type (), const +// CHECK:STDOUT: %.loc17: bool = bool_literal true, const +// CHECK:STDOUT: %.loc18: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc23: i32 = int_literal 0, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %A.loc7, .N = %.loc9} -// CHECK:STDOUT: %A.loc7: = fn_decl @A.1 +// CHECK:STDOUT: %A.loc7: = fn_decl @A.1, const // CHECK:STDOUT: %.loc9: = namespace N, {.A = %A.loc10, .M = %.loc12} -// CHECK:STDOUT: %A.loc10: = fn_decl @A.2 +// CHECK:STDOUT: %A.loc10: = fn_decl @A.2, const // CHECK:STDOUT: %.loc12: = namespace M, {.B = %B} -// CHECK:STDOUT: %B: = fn_decl @B +// CHECK:STDOUT: %B: = fn_decl @B, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A.1(); @@ -44,22 +47,22 @@ fn N.M.B() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @B() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref.loc16: = name_ref A, file.%A.loc10 +// CHECK:STDOUT: %A.ref.loc16: = name_ref A, file.%A.loc10, const = file.%A.loc10 // CHECK:STDOUT: %.loc16: init () = call %A.ref.loc16() -// CHECK:STDOUT: %.loc17: bool = bool_literal true +// CHECK:STDOUT: %.loc17: bool = bool_literal true, const = constants.%.loc17 // CHECK:STDOUT: if %.loc17 br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: // CHECK:STDOUT: %A.var: ref i32 = var A // CHECK:STDOUT: %A: ref i32 = bind_name A, %A.var -// CHECK:STDOUT: %.loc18: i32 = int_literal 0 +// CHECK:STDOUT: %.loc18: i32 = int_literal 0, const = constants.%.loc18 // CHECK:STDOUT: assign %A.var, %.loc18 // CHECK:STDOUT: %A.ref.loc21: ref i32 = name_ref A, %A // CHECK:STDOUT: %.loc21: i32 = bind_value %A.ref.loc21 // CHECK:STDOUT: return %.loc21 // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %.loc23: i32 = int_literal 0 +// CHECK:STDOUT: %.loc23: i32 = int_literal 0, const = constants.%.loc23 // CHECK:STDOUT: return %.loc23 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/unqualified_lookup.carbon b/toolchain/check/testdata/namespace/unqualified_lookup.carbon index 7d94a56abc8a..157875a965f6 100644 --- a/toolchain/check/testdata/namespace/unqualified_lookup.carbon +++ b/toolchain/check/testdata/namespace/unqualified_lookup.carbon @@ -29,19 +29,19 @@ fn OuterN.InnerN.CallABC() { // CHECK:STDOUT: --- unqualified_lookup.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc15: type = tuple_type () +// CHECK:STDOUT: %.loc15: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.OuterN = %.loc7, .A = %A, .CallA = %CallA} // CHECK:STDOUT: %.loc7: = namespace OuterN, {.InnerN = %.loc8, .B = %B, .CallAB = %CallAB} // CHECK:STDOUT: %.loc8: = namespace InnerN, {.C = %C, .CallABC = %CallABC} -// CHECK:STDOUT: %A: = fn_decl @A -// CHECK:STDOUT: %B: = fn_decl @B -// CHECK:STDOUT: %C: = fn_decl @C -// CHECK:STDOUT: %CallA: = fn_decl @CallA -// CHECK:STDOUT: %CallAB: = fn_decl @CallAB -// CHECK:STDOUT: %CallABC: = fn_decl @CallABC +// CHECK:STDOUT: %A: = fn_decl @A, const +// CHECK:STDOUT: %B: = fn_decl @B, const +// CHECK:STDOUT: %C: = fn_decl @C, const +// CHECK:STDOUT: %CallA: = fn_decl @CallA, const +// CHECK:STDOUT: %CallAB: = fn_decl @CallAB, const +// CHECK:STDOUT: %CallABC: = fn_decl @CallABC, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); @@ -52,27 +52,27 @@ fn OuterN.InnerN.CallABC() { // CHECK:STDOUT: // CHECK:STDOUT: fn @CallA() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%A +// CHECK:STDOUT: %A.ref: = name_ref A, file.%A, const = file.%A // CHECK:STDOUT: %.loc15: init () = call %A.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @CallAB() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%A +// CHECK:STDOUT: %A.ref: = name_ref A, file.%A, const = file.%A // CHECK:STDOUT: %.loc19: init () = call %A.ref() -// CHECK:STDOUT: %B.ref: = name_ref B, file.%B +// CHECK:STDOUT: %B.ref: = name_ref B, file.%B, const = file.%B // CHECK:STDOUT: %.loc20: init () = call %B.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @CallABC() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%A +// CHECK:STDOUT: %A.ref: = name_ref A, file.%A, const = file.%A // CHECK:STDOUT: %.loc24: init () = call %A.ref() -// CHECK:STDOUT: %B.ref: = name_ref B, file.%B +// CHECK:STDOUT: %B.ref: = name_ref B, file.%B, const = file.%B // CHECK:STDOUT: %.loc25: init () = call %B.ref() -// CHECK:STDOUT: %C.ref: = name_ref C, file.%C +// CHECK:STDOUT: %C.ref: = name_ref C, file.%C, const = file.%C // CHECK:STDOUT: %.loc26: init () = call %C.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/and.carbon b/toolchain/check/testdata/operators/and.carbon index a2cc2c393ae0..b1df33c23304 100644 --- a/toolchain/check/testdata/operators/and.carbon +++ b/toolchain/check/testdata/operators/and.carbon @@ -13,36 +13,42 @@ fn And() -> bool { // CHECK:STDOUT: --- and.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc7: bool = bool_literal true, const +// CHECK:STDOUT: %.loc8: bool = bool_literal true, const +// CHECK:STDOUT: %.loc11: bool = bool_literal false, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F, .G = %G, .And = %And} -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %And: = fn_decl @And +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %And: = fn_decl @And, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: bool = bool_literal true +// CHECK:STDOUT: %.loc7: bool = bool_literal true, const = constants.%.loc7 // CHECK:STDOUT: return %.loc7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: bool = bool_literal true +// CHECK:STDOUT: %.loc8: bool = bool_literal true, const = constants.%.loc8 // CHECK:STDOUT: return %.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @And() -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc11_11: init bool = call %F.ref() // CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %.loc11_11 // CHECK:STDOUT: %.loc11_14.2: bool = converted %.loc11_11, %.loc11_14.1 -// CHECK:STDOUT: %.loc11_14.3: bool = bool_literal false +// CHECK:STDOUT: %.loc11_14.3: bool = bool_literal false, const = constants.%.loc11 // CHECK:STDOUT: if %.loc11_14.2 br !and.rhs else br !and.result(%.loc11_14.3) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs: -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G +// CHECK:STDOUT: %G.ref: = name_ref G, file.%G, const = file.%G // CHECK:STDOUT: %.loc11_19: init bool = call %G.ref() // CHECK:STDOUT: %.loc11_14.4: bool = value_of_initializer %.loc11_19 // CHECK:STDOUT: %.loc11_14.5: bool = converted %.loc11_19, %.loc11_14.4 diff --git a/toolchain/check/testdata/operators/assignment.carbon b/toolchain/check/testdata/operators/assignment.carbon index 98a3739b799a..be3273b350df 100644 --- a/toolchain/check/testdata/operators/assignment.carbon +++ b/toolchain/check/testdata/operators/assignment.carbon @@ -25,32 +25,47 @@ fn Main() { // CHECK:STDOUT: --- assignment.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc11_19.1: type = tuple_type (type, type) -// CHECK:STDOUT: %.loc11_19.2: type = tuple_type (i32, i32) -// CHECK:STDOUT: %.loc11_19.3: type = ptr_type (i32, i32) -// CHECK:STDOUT: %.loc15: type = ptr_type {.a: i32, .b: i32} +// CHECK:STDOUT: %.loc8: i32 = int_literal 12, const +// CHECK:STDOUT: %.loc9: i32 = int_literal 9, const +// CHECK:STDOUT: %.loc11_19.1: type = tuple_type (type, type), const +// CHECK:STDOUT: %.loc11_19.2: type = tuple_type (i32, i32), const +// CHECK:STDOUT: %.loc11_19.3: type = ptr_type (i32, i32), const +// CHECK:STDOUT: %.loc11_24: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc11_27: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc12_5: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc12_10: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc13_5: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc13_10: i32 = int_literal 4, const +// CHECK:STDOUT: %.loc15_27: type = ptr_type {.a: i32, .b: i32}, const +// CHECK:STDOUT: %.loc15_37: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc15_45: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc16: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc17: i32 = int_literal 4, const +// CHECK:STDOUT: %.loc20: i32 = int_literal 5, const +// CHECK:STDOUT: %.loc22_8: bool = bool_literal true, const +// CHECK:STDOUT: %.loc22_31: i32 = int_literal 10, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %.loc8: i32 = int_literal 12 +// CHECK:STDOUT: %.loc8: i32 = int_literal 12, const = constants.%.loc8 // CHECK:STDOUT: assign %a.var, %.loc8 // CHECK:STDOUT: %a.ref.loc9: ref i32 = name_ref a, %a -// CHECK:STDOUT: %.loc9: i32 = int_literal 9 +// CHECK:STDOUT: %.loc9: i32 = int_literal 9, const = constants.%.loc9 // CHECK:STDOUT: assign %a.ref.loc9, %.loc9 // CHECK:STDOUT: %.loc11_19.1: (type, type) = tuple_literal (i32, i32) // CHECK:STDOUT: %.loc11_19.2: type = converted %.loc11_19.1, constants.%.loc11_19.2 // CHECK:STDOUT: %b.var: ref (i32, i32) = var b // CHECK:STDOUT: %b: ref (i32, i32) = bind_name b, %b.var -// CHECK:STDOUT: %.loc11_24: i32 = int_literal 1 -// CHECK:STDOUT: %.loc11_27: i32 = int_literal 2 +// CHECK:STDOUT: %.loc11_24: i32 = int_literal 1, const = constants.%.loc11_24 +// CHECK:STDOUT: %.loc11_27: i32 = int_literal 2, const = constants.%.loc11_27 // CHECK:STDOUT: %.loc11_28.1: (i32, i32) = tuple_literal (%.loc11_24, %.loc11_27) // CHECK:STDOUT: %.loc11_28.2: ref i32 = tuple_access %b.var, element0 // CHECK:STDOUT: %.loc11_28.3: init i32 = initialize_from %.loc11_24 to %.loc11_28.2 @@ -60,20 +75,20 @@ fn Main() { // CHECK:STDOUT: %.loc11_28.7: init (i32, i32) = converted %.loc11_28.1, %.loc11_28.6 // CHECK:STDOUT: assign %b.var, %.loc11_28.7 // CHECK:STDOUT: %b.ref.loc12: ref (i32, i32) = name_ref b, %b -// CHECK:STDOUT: %.loc12_5: i32 = int_literal 0 +// CHECK:STDOUT: %.loc12_5: i32 = int_literal 0, const = constants.%.loc12_5 // CHECK:STDOUT: %.loc12_6: ref i32 = tuple_index %b.ref.loc12, %.loc12_5 -// CHECK:STDOUT: %.loc12_10: i32 = int_literal 3 +// CHECK:STDOUT: %.loc12_10: i32 = int_literal 3, const = constants.%.loc12_10 // CHECK:STDOUT: assign %.loc12_6, %.loc12_10 // CHECK:STDOUT: %b.ref.loc13: ref (i32, i32) = name_ref b, %b -// CHECK:STDOUT: %.loc13_5: i32 = int_literal 1 +// CHECK:STDOUT: %.loc13_5: i32 = int_literal 1, const = constants.%.loc13_5 // CHECK:STDOUT: %.loc13_6: ref i32 = tuple_index %b.ref.loc13, %.loc13_5 -// CHECK:STDOUT: %.loc13_10: i32 = int_literal 4 +// CHECK:STDOUT: %.loc13_10: i32 = int_literal 4, const = constants.%.loc13_10 // CHECK:STDOUT: assign %.loc13_6, %.loc13_10 -// CHECK:STDOUT: %.loc15_27: type = struct_type {.a: i32, .b: i32} +// CHECK:STDOUT: %.loc15_27: type = struct_type {.a: i32, .b: i32}, const // CHECK:STDOUT: %c.var: ref {.a: i32, .b: i32} = var c // CHECK:STDOUT: %c: ref {.a: i32, .b: i32} = bind_name c, %c.var -// CHECK:STDOUT: %.loc15_37: i32 = int_literal 1 -// CHECK:STDOUT: %.loc15_45: i32 = int_literal 2 +// CHECK:STDOUT: %.loc15_37: i32 = int_literal 1, const = constants.%.loc15_37 +// CHECK:STDOUT: %.loc15_45: i32 = int_literal 2, const = constants.%.loc15_45 // CHECK:STDOUT: %.loc15_46.1: {.a: i32, .b: i32} = struct_literal (%.loc15_37, %.loc15_45) // CHECK:STDOUT: %.loc15_46.2: ref i32 = struct_access %c.var, element0 // CHECK:STDOUT: %.loc15_46.3: init i32 = initialize_from %.loc15_37 to %.loc15_46.2 @@ -84,13 +99,13 @@ fn Main() { // CHECK:STDOUT: assign %c.var, %.loc15_46.7 // CHECK:STDOUT: %c.ref.loc16: ref {.a: i32, .b: i32} = name_ref c, %c // CHECK:STDOUT: %.loc16_4: ref i32 = struct_access %c.ref.loc16, element0 -// CHECK:STDOUT: %.loc16_9: i32 = int_literal 3 +// CHECK:STDOUT: %.loc16_9: i32 = int_literal 3, const = constants.%.loc16 // CHECK:STDOUT: assign %.loc16_4, %.loc16_9 // CHECK:STDOUT: %c.ref.loc17: ref {.a: i32, .b: i32} = name_ref c, %c // CHECK:STDOUT: %.loc17_4: ref i32 = struct_access %c.ref.loc17, element1 -// CHECK:STDOUT: %.loc17_9: i32 = int_literal 4 +// CHECK:STDOUT: %.loc17_9: i32 = int_literal 4, const = constants.%.loc17 // CHECK:STDOUT: assign %.loc17_4, %.loc17_9 -// CHECK:STDOUT: %.loc19_13: type = ptr_type i32 +// CHECK:STDOUT: %.loc19_13: type = ptr_type i32, const // CHECK:STDOUT: %p.var: ref i32* = var p // CHECK:STDOUT: %p: ref i32* = bind_name p, %p.var // CHECK:STDOUT: %a.ref.loc19: ref i32 = name_ref a, %a @@ -99,9 +114,9 @@ fn Main() { // CHECK:STDOUT: %p.ref.loc20: ref i32* = name_ref p, %p // CHECK:STDOUT: %.loc20_4: i32* = bind_value %p.ref.loc20 // CHECK:STDOUT: %.loc20_3: ref i32 = deref %.loc20_4 -// CHECK:STDOUT: %.loc20_8: i32 = int_literal 5 +// CHECK:STDOUT: %.loc20_8: i32 = int_literal 5, const = constants.%.loc20 // CHECK:STDOUT: assign %.loc20_3, %.loc20_8 -// CHECK:STDOUT: %.loc22_8: bool = bool_literal true +// CHECK:STDOUT: %.loc22_8: bool = bool_literal true, const = constants.%.loc22_8 // CHECK:STDOUT: if %.loc22_8 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: @@ -117,7 +132,7 @@ fn Main() { // CHECK:STDOUT: !if.expr.result: // CHECK:STDOUT: %.loc22_5: i32* = block_arg !if.expr.result // CHECK:STDOUT: %.loc22_3: ref i32 = deref %.loc22_5 -// CHECK:STDOUT: %.loc22_31: i32 = int_literal 10 +// CHECK:STDOUT: %.loc22_31: i32 = int_literal 10, const = constants.%.loc22_31 // CHECK:STDOUT: assign %.loc22_3, %.loc22_31 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/fail_assignment_to_error.carbon b/toolchain/check/testdata/operators/fail_assignment_to_error.carbon index 1bb7deee72cb..f2cf8dbc2c9f 100644 --- a/toolchain/check/testdata/operators/fail_assignment_to_error.carbon +++ b/toolchain/check/testdata/operators/fail_assignment_to_error.carbon @@ -17,19 +17,24 @@ fn Main() { // CHECK:STDOUT: --- fail_assignment_to_error.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc11: i32 = int_literal 42, const +// CHECK:STDOUT: %.loc15: i32 = int_literal 42, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %undeclared.ref: = name_ref undeclared, -// CHECK:STDOUT: %.loc11: i32 = int_literal 42 +// CHECK:STDOUT: %.loc11: i32 = int_literal 42, const = constants.%.loc11 // CHECK:STDOUT: assign %undeclared.ref, // CHECK:STDOUT: %also_undeclared.ref: = name_ref also_undeclared, // CHECK:STDOUT: %.loc15_3: ref = deref -// CHECK:STDOUT: %.loc15_22: i32 = int_literal 42 +// CHECK:STDOUT: %.loc15_22: i32 = int_literal 42, const = constants.%.loc15 // CHECK:STDOUT: assign %.loc15_3, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/fail_assignment_to_non_assignable.carbon b/toolchain/check/testdata/operators/fail_assignment_to_non_assignable.carbon index 9a3567a1b2b0..8b0a54b6407b 100644 --- a/toolchain/check/testdata/operators/fail_assignment_to_non_assignable.carbon +++ b/toolchain/check/testdata/operators/fail_assignment_to_non_assignable.carbon @@ -48,34 +48,56 @@ fn Main() { // CHECK:STDOUT: --- fail_assignment_to_non_assignable.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc21_8.1: type = tuple_type (i32, i32) -// CHECK:STDOUT: %.loc21_8.2: type = ptr_type (i32, i32) -// CHECK:STDOUT: %.loc34_18.1: type = struct_type {.x: i32, .y: i32} -// CHECK:STDOUT: %.loc34_18.2: type = ptr_type {.x: i32, .y: i32} +// CHECK:STDOUT: %.loc13_3: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc13_7: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc17: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc21_4: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc21_7: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc21_8.1: type = tuple_type (i32, i32), const +// CHECK:STDOUT: %.loc21_13: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc21_16: i32 = int_literal 4, const +// CHECK:STDOUT: %.loc21_8.2: type = ptr_type (i32, i32), const +// CHECK:STDOUT: %.loc21_8.3: (i32, i32) = tuple_value (%.loc21_4, %.loc21_7), const +// CHECK:STDOUT: %.loc22: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc26_13: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc26_16: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc34_9: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc34_17: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc34_18.1: type = struct_type {.x: i32, .y: i32}, const +// CHECK:STDOUT: %.loc34_28: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc34_36: i32 = int_literal 4, const +// CHECK:STDOUT: %.loc34_18.2: type = ptr_type {.x: i32, .y: i32}, const +// CHECK:STDOUT: %.loc34_18.3: {.x: i32, .y: i32} = struct_value (%.loc34_9, %.loc34_17), const +// CHECK:STDOUT: %.loc38_7: bool = bool_literal true, const +// CHECK:STDOUT: %.loc38_17: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc38_24: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc38_29: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc45_7: bool = bool_literal true, const +// CHECK:STDOUT: %.loc45_29: i32 = int_literal 10, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F, .Main = %Main} -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc13_3: i32 = int_literal 1 -// CHECK:STDOUT: %.loc13_7: i32 = int_literal 2 +// CHECK:STDOUT: %.loc13_3: i32 = int_literal 1, const = constants.%.loc13_3 +// CHECK:STDOUT: %.loc13_7: i32 = int_literal 2, const = constants.%.loc13_7 // CHECK:STDOUT: assign %.loc13_3, %.loc13_7 -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc17_4: init i32 = call %F.ref() -// CHECK:STDOUT: %.loc17_9: i32 = int_literal 1 +// CHECK:STDOUT: %.loc17_9: i32 = int_literal 1, const = constants.%.loc17 // CHECK:STDOUT: assign %.loc17_4, %.loc17_9 -// CHECK:STDOUT: %.loc21_4: i32 = int_literal 1 -// CHECK:STDOUT: %.loc21_7: i32 = int_literal 2 +// CHECK:STDOUT: %.loc21_4: i32 = int_literal 1, const = constants.%.loc21_4 +// CHECK:STDOUT: %.loc21_7: i32 = int_literal 2, const = constants.%.loc21_7 // CHECK:STDOUT: %.loc21_8.1: (i32, i32) = tuple_literal (%.loc21_4, %.loc21_7) -// CHECK:STDOUT: %.loc21_13: i32 = int_literal 3 -// CHECK:STDOUT: %.loc21_16: i32 = int_literal 4 +// CHECK:STDOUT: %.loc21_13: i32 = int_literal 3, const = constants.%.loc21_13 +// CHECK:STDOUT: %.loc21_16: i32 = int_literal 4, const = constants.%.loc21_16 // CHECK:STDOUT: %.loc21_17.1: (i32, i32) = tuple_literal (%.loc21_13, %.loc21_16) // CHECK:STDOUT: %.loc21_17.2: i32 = tuple_access %.loc21_8.1, element0 // CHECK:STDOUT: %.loc21_17.3: init i32 = initialize_from %.loc21_13 to %.loc21_17.2 @@ -84,17 +106,17 @@ fn Main() { // CHECK:STDOUT: %.loc21_17.6: init (i32, i32) = tuple_init (%.loc21_17.3, %.loc21_17.5) to %.loc21_8.1 // CHECK:STDOUT: %.loc21_17.7: init (i32, i32) = converted %.loc21_17.1, %.loc21_17.6 // CHECK:STDOUT: assign %.loc21_8.1, %.loc21_17.7 -// CHECK:STDOUT: %.loc21_8.2: (i32, i32) = tuple_value (%.loc21_4, %.loc21_7) +// CHECK:STDOUT: %.loc21_8.2: (i32, i32) = tuple_value (%.loc21_4, %.loc21_7), const = constants.%.loc21_8.3 // CHECK:STDOUT: %.loc21_8.3: (i32, i32) = converted %.loc21_8.1, %.loc21_8.2 // CHECK:STDOUT: %n.var: ref i32 = var n // CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var -// CHECK:STDOUT: %.loc22: i32 = int_literal 0 +// CHECK:STDOUT: %.loc22: i32 = int_literal 0, const = constants.%.loc22 // CHECK:STDOUT: assign %n.var, %.loc22 // CHECK:STDOUT: %n.ref.loc26_4: ref i32 = name_ref n, %n // CHECK:STDOUT: %n.ref.loc26_7: ref i32 = name_ref n, %n // CHECK:STDOUT: %.loc26_8.1: (i32, i32) = tuple_literal (%n.ref.loc26_4, %n.ref.loc26_7) -// CHECK:STDOUT: %.loc26_13: i32 = int_literal 1 -// CHECK:STDOUT: %.loc26_16: i32 = int_literal 2 +// CHECK:STDOUT: %.loc26_13: i32 = int_literal 1, const = constants.%.loc26_13 +// CHECK:STDOUT: %.loc26_16: i32 = int_literal 2, const = constants.%.loc26_16 // CHECK:STDOUT: %.loc26_17.1: (i32, i32) = tuple_literal (%.loc26_13, %.loc26_16) // CHECK:STDOUT: %.loc26_17.2: i32 = tuple_access %.loc26_8.1, element0 // CHECK:STDOUT: %.loc26_17.3: init i32 = initialize_from %.loc26_13 to %.loc26_17.2 @@ -107,13 +129,13 @@ fn Main() { // CHECK:STDOUT: %.loc26_7: i32 = bind_value %n.ref.loc26_7 // CHECK:STDOUT: %.loc26_8.2: (i32, i32) = tuple_value (%.loc26_4, %.loc26_7) // CHECK:STDOUT: %.loc26_8.3: (i32, i32) = converted %.loc26_8.1, %.loc26_8.2 -// CHECK:STDOUT: %.loc30: type = ptr_type i32 +// CHECK:STDOUT: %.loc30: type = ptr_type i32, const // CHECK:STDOUT: assign i32, %.loc30 -// CHECK:STDOUT: %.loc34_9: i32 = int_literal 1 -// CHECK:STDOUT: %.loc34_17: i32 = int_literal 2 +// CHECK:STDOUT: %.loc34_9: i32 = int_literal 1, const = constants.%.loc34_9 +// CHECK:STDOUT: %.loc34_17: i32 = int_literal 2, const = constants.%.loc34_17 // CHECK:STDOUT: %.loc34_18.1: {.x: i32, .y: i32} = struct_literal (%.loc34_9, %.loc34_17) -// CHECK:STDOUT: %.loc34_28: i32 = int_literal 3 -// CHECK:STDOUT: %.loc34_36: i32 = int_literal 4 +// CHECK:STDOUT: %.loc34_28: i32 = int_literal 3, const = constants.%.loc34_28 +// CHECK:STDOUT: %.loc34_36: i32 = int_literal 4, const = constants.%.loc34_36 // CHECK:STDOUT: %.loc34_37.1: {.x: i32, .y: i32} = struct_literal (%.loc34_28, %.loc34_36) // CHECK:STDOUT: %.loc34_37.2: i32 = struct_access %.loc34_18.1, element0 // CHECK:STDOUT: %.loc34_37.3: init i32 = initialize_from %.loc34_28 to %.loc34_37.2 @@ -122,26 +144,26 @@ fn Main() { // CHECK:STDOUT: %.loc34_37.6: init {.x: i32, .y: i32} = struct_init (%.loc34_37.3, %.loc34_37.5) to %.loc34_18.1 // CHECK:STDOUT: %.loc34_37.7: init {.x: i32, .y: i32} = converted %.loc34_37.1, %.loc34_37.6 // CHECK:STDOUT: assign %.loc34_18.1, %.loc34_37.7 -// CHECK:STDOUT: %.loc34_18.2: {.x: i32, .y: i32} = struct_value (%.loc34_9, %.loc34_17) +// CHECK:STDOUT: %.loc34_18.2: {.x: i32, .y: i32} = struct_value (%.loc34_9, %.loc34_17), const = constants.%.loc34_18.3 // CHECK:STDOUT: %.loc34_18.3: {.x: i32, .y: i32} = converted %.loc34_18.1, %.loc34_18.2 -// CHECK:STDOUT: %.loc38_7: bool = bool_literal true +// CHECK:STDOUT: %.loc38_7: bool = bool_literal true, const = constants.%.loc38_7 // CHECK:STDOUT: if %.loc38_7 br !if.expr.then.loc38 else br !if.expr.else.loc38 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc38: -// CHECK:STDOUT: %.loc38_17: i32 = int_literal 1 +// CHECK:STDOUT: %.loc38_17: i32 = int_literal 1, const = constants.%.loc38_17 // CHECK:STDOUT: br !if.expr.result.loc38(%.loc38_17) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else.loc38: -// CHECK:STDOUT: %.loc38_24: i32 = int_literal 2 +// CHECK:STDOUT: %.loc38_24: i32 = int_literal 2, const = constants.%.loc38_24 // CHECK:STDOUT: br !if.expr.result.loc38(%.loc38_24) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc38: // CHECK:STDOUT: %.loc38_4: i32 = block_arg !if.expr.result.loc38 -// CHECK:STDOUT: %.loc38_29: i32 = int_literal 3 +// CHECK:STDOUT: %.loc38_29: i32 = int_literal 3, const = constants.%.loc38_29 // CHECK:STDOUT: assign %.loc38_4, %.loc38_29 // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %.loc45_7: bool = bool_literal true +// CHECK:STDOUT: %.loc45_7: bool = bool_literal true, const = constants.%.loc45_7 // CHECK:STDOUT: if %.loc45_7 br !if.expr.then.loc45 else br !if.expr.else.loc45 // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then.loc45: @@ -156,7 +178,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result.loc45: // CHECK:STDOUT: %.loc45_4: i32 = block_arg !if.expr.result.loc45 -// CHECK:STDOUT: %.loc45_29: i32 = int_literal 10 +// CHECK:STDOUT: %.loc45_29: i32 = int_literal 10, const = constants.%.loc45_29 // CHECK:STDOUT: assign %.loc45_4, %.loc45_29 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/fail_type_mismatch.carbon b/toolchain/check/testdata/operators/fail_type_mismatch.carbon index 2dbe2e0f4e14..d0c9881b3567 100644 --- a/toolchain/check/testdata/operators/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/operators/fail_type_mismatch.carbon @@ -13,16 +13,20 @@ fn Main() { // CHECK:STDOUT: --- fail_type_mismatch.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc11: i32 = int_literal 12, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.var: ref bool = var x // CHECK:STDOUT: %x: ref bool = bind_name x, %x.var -// CHECK:STDOUT: %.loc11_21: i32 = int_literal 12 +// CHECK:STDOUT: %.loc11_21: i32 = int_literal 12, const = constants.%.loc11 // CHECK:STDOUT: %.loc11_17: = not // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/operators/fail_type_mismatch_assignment.carbon b/toolchain/check/testdata/operators/fail_type_mismatch_assignment.carbon index 673b5d3b3434..527e47961e45 100644 --- a/toolchain/check/testdata/operators/fail_type_mismatch_assignment.carbon +++ b/toolchain/check/testdata/operators/fail_type_mismatch_assignment.carbon @@ -14,19 +14,24 @@ fn Main() { // CHECK:STDOUT: --- fail_type_mismatch_assignment.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc8: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc12: f64 = real_literal 56e-1, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %.loc8: i32 = int_literal 3 +// CHECK:STDOUT: %.loc8: i32 = int_literal 3, const = constants.%.loc8 // CHECK:STDOUT: assign %a.var, %.loc8 // CHECK:STDOUT: %a.ref: ref i32 = name_ref a, %a -// CHECK:STDOUT: %.loc12: f64 = real_literal 56e-1 +// CHECK:STDOUT: %.loc12: f64 = real_literal 56e-1, const = constants.%.loc12 // CHECK:STDOUT: assign %a.ref, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/fail_type_mismatch_once.carbon b/toolchain/check/testdata/operators/fail_type_mismatch_once.carbon index 5c65da0d2143..d947e4a7b376 100644 --- a/toolchain/check/testdata/operators/fail_type_mismatch_once.carbon +++ b/toolchain/check/testdata/operators/fail_type_mismatch_once.carbon @@ -15,6 +15,11 @@ fn Main() -> i32 { // CHECK:STDOUT: --- fail_type_mismatch_once.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc13_10: i32 = int_literal 12, const +// CHECK:STDOUT: %.loc13_15: f64 = real_literal 34e-1, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/fail_unimplemented_op.carbon b/toolchain/check/testdata/operators/fail_unimplemented_op.carbon index aa302ffc43c0..e71d8bb58ac4 100644 --- a/toolchain/check/testdata/operators/fail_unimplemented_op.carbon +++ b/toolchain/check/testdata/operators/fail_unimplemented_op.carbon @@ -13,6 +13,11 @@ fn Main() -> i32 { // CHECK:STDOUT: --- fail_unimplemented_op.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc11_10: i32 = int_literal 12, const +// CHECK:STDOUT: %.loc11_15: i32 = int_literal 34, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/or.carbon b/toolchain/check/testdata/operators/or.carbon index af288a75a3f2..e37e56df29b3 100644 --- a/toolchain/check/testdata/operators/or.carbon +++ b/toolchain/check/testdata/operators/or.carbon @@ -13,37 +13,43 @@ fn Or() -> bool { // CHECK:STDOUT: --- or.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc7: bool = bool_literal true, const +// CHECK:STDOUT: %.loc8: bool = bool_literal true, const +// CHECK:STDOUT: %.loc11: bool = bool_literal true, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F, .G = %G, .Or = %Or} -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %Or: = fn_decl @Or +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %Or: = fn_decl @Or, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: bool = bool_literal true +// CHECK:STDOUT: %.loc7: bool = bool_literal true, const = constants.%.loc7 // CHECK:STDOUT: return %.loc7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: bool = bool_literal true +// CHECK:STDOUT: %.loc8: bool = bool_literal true, const = constants.%.loc8 // CHECK:STDOUT: return %.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Or() -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc11_11: init bool = call %F.ref() // CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %.loc11_11 // CHECK:STDOUT: %.loc11_14.2: bool = converted %.loc11_11, %.loc11_14.1 // CHECK:STDOUT: %.loc11_14.3: bool = not %.loc11_14.2 -// CHECK:STDOUT: %.loc11_14.4: bool = bool_literal true +// CHECK:STDOUT: %.loc11_14.4: bool = bool_literal true, const = constants.%.loc11 // CHECK:STDOUT: if %.loc11_14.3 br !or.rhs else br !or.result(%.loc11_14.4) // CHECK:STDOUT: // CHECK:STDOUT: !or.rhs: -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G +// CHECK:STDOUT: %G.ref: = name_ref G, file.%G, const = file.%G // CHECK:STDOUT: %.loc11_18: init bool = call %G.ref() // CHECK:STDOUT: %.loc11_14.5: bool = value_of_initializer %.loc11_18 // CHECK:STDOUT: %.loc11_14.6: bool = converted %.loc11_18, %.loc11_14.5 diff --git a/toolchain/check/testdata/operators/unary_op.carbon b/toolchain/check/testdata/operators/unary_op.carbon index 0414f921e3cf..adf885268b60 100644 --- a/toolchain/check/testdata/operators/unary_op.carbon +++ b/toolchain/check/testdata/operators/unary_op.carbon @@ -8,11 +8,27 @@ fn Not(b: bool) -> bool { return not b; } +let not_true: bool = not true; +let not_false: bool = not false; + // CHECK:STDOUT: --- unary_op.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc11_26.1: bool = bool_literal true, const +// CHECK:STDOUT: %.loc11_26.2: bool = bool_literal false, const +// CHECK:STDOUT: %.loc12_27.1: bool = bool_literal false, const +// CHECK:STDOUT: %.loc12_27.2: bool = bool_literal true, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Not = %Not} -// CHECK:STDOUT: %Not: = fn_decl @Not +// CHECK:STDOUT: %Not: = fn_decl @Not, const +// CHECK:STDOUT: %.loc11_26: bool = bool_literal true, const = constants.%.loc11_26.1 +// CHECK:STDOUT: %.loc11_22: bool = not %.loc11_26, const = constants.%.loc11_26.2 +// CHECK:STDOUT: %not_true: bool = bind_name not_true, %.loc11_22 +// CHECK:STDOUT: %.loc12_27: bool = bool_literal false, const = constants.%.loc12_27.1 +// CHECK:STDOUT: %.loc12_23: bool = not %.loc12_27, const = constants.%.loc12_27.2 +// CHECK:STDOUT: %not_false: bool = bind_name not_false, %.loc12_23 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Not(%b: bool) -> bool { diff --git a/toolchain/check/testdata/package_expr/fail_not_found.carbon b/toolchain/check/testdata/package_expr/fail_not_found.carbon index c64e4ff314b3..6cd5de203109 100644 --- a/toolchain/check/testdata/package_expr/fail_not_found.carbon +++ b/toolchain/check/testdata/package_expr/fail_not_found.carbon @@ -15,7 +15,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/package_expr/syntax.carbon b/toolchain/check/testdata/package_expr/syntax.carbon index fe7d46386127..338a00c4a112 100644 --- a/toolchain/check/testdata/package_expr/syntax.carbon +++ b/toolchain/check/testdata/package_expr/syntax.carbon @@ -44,20 +44,25 @@ fn Main() { // CHECK:STDOUT: --- global.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc4: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc7: i32 = int_literal 1, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x, .Main = %Main} // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %.loc4: i32 = int_literal 0 +// CHECK:STDOUT: %.loc4: i32 = int_literal 0, const = constants.%.loc4 // CHECK:STDOUT: assign %x.var, %.loc4 -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %.loc7: i32 = int_literal 1 +// CHECK:STDOUT: %.loc7: i32 = int_literal 1, const = constants.%.loc7 // CHECK:STDOUT: assign %x.var, %.loc7 // CHECK:STDOUT: %y.var: ref i32 = var y // CHECK:STDOUT: %y: ref i32 = bind_name y, %y.var @@ -70,20 +75,25 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: --- inside_fn.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc4: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc7: i32 = int_literal 1, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x, .Main = %Main} // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %.loc4: i32 = int_literal 0 +// CHECK:STDOUT: %.loc4: i32 = int_literal 0, const = constants.%.loc4 // CHECK:STDOUT: assign %x.var, %.loc4 -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %.loc7: i32 = int_literal 1 +// CHECK:STDOUT: %.loc7: i32 = int_literal 1, const = constants.%.loc7 // CHECK:STDOUT: assign %x.var, %.loc7 // CHECK:STDOUT: %y.var: ref i32 = var y // CHECK:STDOUT: %y: ref i32 = bind_name y, %y.var @@ -97,20 +107,20 @@ fn Main() { // CHECK:STDOUT: --- namespace.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc8: type = struct_type {} -// CHECK:STDOUT: %.loc11: type = tuple_type () +// CHECK:STDOUT: %.loc8: type = struct_type {}, const +// CHECK:STDOUT: %.loc11: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.NS = %.loc4, .Main = %Main} // CHECK:STDOUT: %.loc4: = namespace NS, {.C = %C.decl} // CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %C: type = class_type @C, const +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %Foo: = fn_decl @Foo +// CHECK:STDOUT: %Foo: = fn_decl @Foo, const // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Foo = %Foo @@ -125,8 +135,8 @@ fn Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %package.ref: = name_ref package, package // CHECK:STDOUT: %NS.ref: = name_ref NS, file.%.loc4 -// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C -// CHECK:STDOUT: %Foo.ref: = name_ref Foo, @C.%Foo +// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C, const = file.%C +// CHECK:STDOUT: %Foo.ref: = name_ref Foo, @C.%Foo, const = @C.%Foo // CHECK:STDOUT: %.loc11: init () = call %Foo.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/packages/fail_name_with_import_failure.carbon b/toolchain/check/testdata/packages/fail_name_with_import_failure.carbon index af33b521781f..ce201a140ffa 100644 --- a/toolchain/check/testdata/packages/fail_name_with_import_failure.carbon +++ b/toolchain/check/testdata/packages/fail_name_with_import_failure.carbon @@ -16,7 +16,7 @@ var a: () = A(); // CHECK:STDOUT: --- implicit.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7: type = tuple_type () +// CHECK:STDOUT: %.loc7: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { diff --git a/toolchain/check/testdata/packages/fail_todo_lazy_import_ref.carbon b/toolchain/check/testdata/packages/fail_todo_lazy_import_ref.carbon index ae7248ae471a..b426423748ff 100644 --- a/toolchain/check/testdata/packages/fail_todo_lazy_import_ref.carbon +++ b/toolchain/check/testdata/packages/fail_todo_lazy_import_ref.carbon @@ -22,18 +22,22 @@ var a: () = a_ref; // CHECK:STDOUT: --- implicit.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc4: i32 = int_literal 0, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.a_ref = %a_ref} // CHECK:STDOUT: %a_ref.var: ref i32 = var a_ref // CHECK:STDOUT: %a_ref: ref i32 = bind_name a_ref, %a_ref.var -// CHECK:STDOUT: %.loc4: i32 = int_literal 0 +// CHECK:STDOUT: %.loc4: i32 = int_literal 0, const = constants.%.loc4 // CHECK:STDOUT: assign %a_ref.var, %.loc4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: --- implicit.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc4: type = tuple_type () +// CHECK:STDOUT: %.loc4: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { diff --git a/toolchain/check/testdata/packages/loaded_global.carbon b/toolchain/check/testdata/packages/loaded_global.carbon index f0b0e86274a0..cecc51e52eb1 100644 --- a/toolchain/check/testdata/packages/loaded_global.carbon +++ b/toolchain/check/testdata/packages/loaded_global.carbon @@ -38,7 +38,7 @@ var package_b: () = package.B(); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %A} -// CHECK:STDOUT: %A: = fn_decl @A +// CHECK:STDOUT: %A: = fn_decl @A, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); @@ -46,17 +46,17 @@ var package_b: () = package.B(); // CHECK:STDOUT: --- implicit.impl.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc4: type = tuple_type () +// CHECK:STDOUT: %.loc4: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %.2, .a = %a, .package_a = %package_a} -// CHECK:STDOUT: %.2: = fn_decl @.1 +// CHECK:STDOUT: %.2: = fn_decl @.1, const // CHECK:STDOUT: %.loc4_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc4_9.2: type = converted %.loc4_9.1, constants.%.loc4 // CHECK:STDOUT: %a.var: ref () = var a // CHECK:STDOUT: %a: ref () = bind_name a, %a.var -// CHECK:STDOUT: %A.ref.loc4: = name_ref A, %.2 +// CHECK:STDOUT: %A.ref.loc4: = name_ref A, %.2, const = %.2 // CHECK:STDOUT: %.loc4_14: init () = call %A.ref.loc4() // CHECK:STDOUT: assign %a.var, %.loc4_14 // CHECK:STDOUT: %.loc6_17: () = tuple_literal () @@ -64,7 +64,7 @@ var package_b: () = package.B(); // CHECK:STDOUT: %package_a.var: ref () = var package_a // CHECK:STDOUT: %package_a: ref () = bind_name package_a, %package_a.var // CHECK:STDOUT: %package.ref: = name_ref package, package -// CHECK:STDOUT: %A.ref.loc6: = name_ref A, %.2 +// CHECK:STDOUT: %A.ref.loc6: = name_ref A, %.2, const = %.2 // CHECK:STDOUT: %.loc6_30: init () = call %A.ref.loc6() // CHECK:STDOUT: assign %package_a.var, %.loc6_30 // CHECK:STDOUT: } @@ -75,7 +75,7 @@ var package_b: () = package.B(); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.B = %B} -// CHECK:STDOUT: %B: = fn_decl @B +// CHECK:STDOUT: %B: = fn_decl @B, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @B(); @@ -83,17 +83,17 @@ var package_b: () = package.B(); // CHECK:STDOUT: --- same_package_importer.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc6: type = tuple_type () +// CHECK:STDOUT: %.loc6: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.B = %.2, .b = %b, .package_b = %package_b} -// CHECK:STDOUT: %.2: = fn_decl @.1 +// CHECK:STDOUT: %.2: = fn_decl @.1, const // CHECK:STDOUT: %.loc6_9.1: () = tuple_literal () // CHECK:STDOUT: %.loc6_9.2: type = converted %.loc6_9.1, constants.%.loc6 // CHECK:STDOUT: %b.var: ref () = var b // CHECK:STDOUT: %b: ref () = bind_name b, %b.var -// CHECK:STDOUT: %B.ref.loc6: = name_ref B, %.2 +// CHECK:STDOUT: %B.ref.loc6: = name_ref B, %.2, const = %.2 // CHECK:STDOUT: %.loc6_14: init () = call %B.ref.loc6() // CHECK:STDOUT: assign %b.var, %.loc6_14 // CHECK:STDOUT: %.loc8_17: () = tuple_literal () @@ -101,7 +101,7 @@ var package_b: () = package.B(); // CHECK:STDOUT: %package_b.var: ref () = var package_b // CHECK:STDOUT: %package_b: ref () = bind_name package_b, %package_b.var // CHECK:STDOUT: %package.ref: = name_ref package, package -// CHECK:STDOUT: %B.ref.loc8: = name_ref B, %.2 +// CHECK:STDOUT: %B.ref.loc8: = name_ref B, %.2, const = %.2 // CHECK:STDOUT: %.loc8_30: init () = call %B.ref.loc8() // CHECK:STDOUT: assign %package_b.var, %.loc8_30 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/packages/unused_lazy_import.carbon b/toolchain/check/testdata/packages/unused_lazy_import.carbon index 269e60e6db15..96a09e59f7c5 100644 --- a/toolchain/check/testdata/packages/unused_lazy_import.carbon +++ b/toolchain/check/testdata/packages/unused_lazy_import.carbon @@ -18,7 +18,7 @@ package Implicit impl; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %A} -// CHECK:STDOUT: %A: = fn_decl @A +// CHECK:STDOUT: %A: = fn_decl @A, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); diff --git a/toolchain/check/testdata/pointer/address_of_deref.carbon b/toolchain/check/testdata/pointer/address_of_deref.carbon index c3f569e57562..151be5cc82f0 100644 --- a/toolchain/check/testdata/pointer/address_of_deref.carbon +++ b/toolchain/check/testdata/pointer/address_of_deref.carbon @@ -12,19 +12,20 @@ fn F() -> i32 { // CHECK:STDOUT: --- address_of_deref.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc9: type = ptr_type i32 +// CHECK:STDOUT: %.loc8: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc9: type = ptr_type i32, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.var: ref i32 = var n // CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 +// CHECK:STDOUT: %.loc8: i32 = int_literal 0, const = constants.%.loc8 // CHECK:STDOUT: assign %n.var, %.loc8 // CHECK:STDOUT: %n.ref: ref i32 = name_ref n, %n // CHECK:STDOUT: %.loc9_13: i32* = addr_of %n.ref diff --git a/toolchain/check/testdata/pointer/address_of_lvalue.carbon b/toolchain/check/testdata/pointer/address_of_lvalue.carbon index ef2006b3efde..8b39d37eda6e 100644 --- a/toolchain/check/testdata/pointer/address_of_lvalue.carbon +++ b/toolchain/check/testdata/pointer/address_of_lvalue.carbon @@ -19,24 +19,30 @@ fn F() { // CHECK:STDOUT: --- address_of_lvalue.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc8: type = ptr_type {.a: i32, .b: i32} -// CHECK:STDOUT: %.loc14_19.1: type = tuple_type (type, type) -// CHECK:STDOUT: %.loc14_19.2: type = tuple_type (i32, i32) -// CHECK:STDOUT: %.loc14_19.3: type = ptr_type (i32, i32) +// CHECK:STDOUT: %.loc8_27: type = ptr_type {.a: i32, .b: i32}, const +// CHECK:STDOUT: %.loc8_37: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc8_45: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc14_19.1: type = tuple_type (type, type), const +// CHECK:STDOUT: %.loc14_19.2: type = tuple_type (i32, i32), const +// CHECK:STDOUT: %.loc14_19.3: type = ptr_type (i32, i32), const +// CHECK:STDOUT: %.loc14_24: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc14_27: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc15: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc16: i32 = int_literal 1, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8_27: type = struct_type {.a: i32, .b: i32} +// CHECK:STDOUT: %.loc8_27: type = struct_type {.a: i32, .b: i32}, const // CHECK:STDOUT: %s.var: ref {.a: i32, .b: i32} = var s // CHECK:STDOUT: %s: ref {.a: i32, .b: i32} = bind_name s, %s.var -// CHECK:STDOUT: %.loc8_37: i32 = int_literal 1 -// CHECK:STDOUT: %.loc8_45: i32 = int_literal 2 +// CHECK:STDOUT: %.loc8_37: i32 = int_literal 1, const = constants.%.loc8_37 +// CHECK:STDOUT: %.loc8_45: i32 = int_literal 2, const = constants.%.loc8_45 // CHECK:STDOUT: %.loc8_46.1: {.a: i32, .b: i32} = struct_literal (%.loc8_37, %.loc8_45) // CHECK:STDOUT: %.loc8_46.2: ref i32 = struct_access %s.var, element0 // CHECK:STDOUT: %.loc8_46.3: init i32 = initialize_from %.loc8_37 to %.loc8_46.2 @@ -45,21 +51,21 @@ fn F() { // CHECK:STDOUT: %.loc8_46.6: init {.a: i32, .b: i32} = struct_init (%.loc8_46.3, %.loc8_46.5) to %s.var // CHECK:STDOUT: %.loc8_46.7: init {.a: i32, .b: i32} = converted %.loc8_46.1, %.loc8_46.6 // CHECK:STDOUT: assign %s.var, %.loc8_46.7 -// CHECK:STDOUT: %.loc10_27: type = struct_type {.a: i32, .b: i32} -// CHECK:STDOUT: %.loc10_28: type = ptr_type {.a: i32, .b: i32} +// CHECK:STDOUT: %.loc10_27: type = struct_type {.a: i32, .b: i32}, const +// CHECK:STDOUT: %.loc10_28: type = ptr_type {.a: i32, .b: i32}, const // CHECK:STDOUT: %p.var: ref {.a: i32, .b: i32}* = var p // CHECK:STDOUT: %p: ref {.a: i32, .b: i32}* = bind_name p, %p.var // CHECK:STDOUT: %s.ref.loc10: ref {.a: i32, .b: i32} = name_ref s, %s // CHECK:STDOUT: %.loc10_32: {.a: i32, .b: i32}* = addr_of %s.ref.loc10 // CHECK:STDOUT: assign %p.var, %.loc10_32 -// CHECK:STDOUT: %.loc11_13: type = ptr_type i32 +// CHECK:STDOUT: %.loc11_13: type = ptr_type i32, const // CHECK:STDOUT: %q.var: ref i32* = var q // CHECK:STDOUT: %q: ref i32* = bind_name q, %q.var // CHECK:STDOUT: %s.ref.loc11: ref {.a: i32, .b: i32} = name_ref s, %s // CHECK:STDOUT: %.loc11_19: ref i32 = struct_access %s.ref.loc11, element0 // CHECK:STDOUT: %.loc11_17: i32* = addr_of %.loc11_19 // CHECK:STDOUT: assign %q.var, %.loc11_17 -// CHECK:STDOUT: %.loc12_13: type = ptr_type i32 +// CHECK:STDOUT: %.loc12_13: type = ptr_type i32, const // CHECK:STDOUT: %r.var: ref i32* = var r // CHECK:STDOUT: %r: ref i32* = bind_name r, %r.var // CHECK:STDOUT: %s.ref.loc12: ref {.a: i32, .b: i32} = name_ref s, %s @@ -70,8 +76,8 @@ fn F() { // CHECK:STDOUT: %.loc14_19.2: type = converted %.loc14_19.1, constants.%.loc14_19.2 // CHECK:STDOUT: %t.var: ref (i32, i32) = var t // CHECK:STDOUT: %t: ref (i32, i32) = bind_name t, %t.var -// CHECK:STDOUT: %.loc14_24: i32 = int_literal 1 -// CHECK:STDOUT: %.loc14_27: i32 = int_literal 2 +// CHECK:STDOUT: %.loc14_24: i32 = int_literal 1, const = constants.%.loc14_24 +// CHECK:STDOUT: %.loc14_27: i32 = int_literal 2, const = constants.%.loc14_27 // CHECK:STDOUT: %.loc14_28.1: (i32, i32) = tuple_literal (%.loc14_24, %.loc14_27) // CHECK:STDOUT: %.loc14_28.2: ref i32 = tuple_access %t.var, element0 // CHECK:STDOUT: %.loc14_28.3: init i32 = initialize_from %.loc14_24 to %.loc14_28.2 @@ -80,19 +86,19 @@ fn F() { // CHECK:STDOUT: %.loc14_28.6: init (i32, i32) = tuple_init (%.loc14_28.3, %.loc14_28.5) to %t.var // CHECK:STDOUT: %.loc14_28.7: init (i32, i32) = converted %.loc14_28.1, %.loc14_28.6 // CHECK:STDOUT: assign %t.var, %.loc14_28.7 -// CHECK:STDOUT: %.loc15_14: type = ptr_type i32 +// CHECK:STDOUT: %.loc15_14: type = ptr_type i32, const // CHECK:STDOUT: %t0.var: ref i32* = var t0 // CHECK:STDOUT: %t0: ref i32* = bind_name t0, %t0.var // CHECK:STDOUT: %t.ref.loc15: ref (i32, i32) = name_ref t, %t -// CHECK:STDOUT: %.loc15_21: i32 = int_literal 0 +// CHECK:STDOUT: %.loc15_21: i32 = int_literal 0, const = constants.%.loc15 // CHECK:STDOUT: %.loc15_22: ref i32 = tuple_index %t.ref.loc15, %.loc15_21 // CHECK:STDOUT: %.loc15_18: i32* = addr_of %.loc15_22 // CHECK:STDOUT: assign %t0.var, %.loc15_18 -// CHECK:STDOUT: %.loc16_14: type = ptr_type i32 +// CHECK:STDOUT: %.loc16_14: type = ptr_type i32, const // CHECK:STDOUT: %t1.var: ref i32* = var t1 // CHECK:STDOUT: %t1: ref i32* = bind_name t1, %t1.var // CHECK:STDOUT: %t.ref.loc16: ref (i32, i32) = name_ref t, %t -// CHECK:STDOUT: %.loc16_21: i32 = int_literal 1 +// CHECK:STDOUT: %.loc16_21: i32 = int_literal 1, const = constants.%.loc16 // CHECK:STDOUT: %.loc16_22: ref i32 = tuple_index %t.ref.loc16, %.loc16_21 // CHECK:STDOUT: %.loc16_18: i32* = addr_of %.loc16_22 // CHECK:STDOUT: assign %t1.var, %.loc16_18 diff --git a/toolchain/check/testdata/pointer/basic.carbon b/toolchain/check/testdata/pointer/basic.carbon index 6eb1f86c9ab9..00e255f0e945 100644 --- a/toolchain/check/testdata/pointer/basic.carbon +++ b/toolchain/check/testdata/pointer/basic.carbon @@ -13,18 +13,22 @@ fn F() -> i32 { // CHECK:STDOUT: --- basic.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc8: i32 = int_literal 0, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.var: ref i32 = var n // CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 +// CHECK:STDOUT: %.loc8: i32 = int_literal 0, const = constants.%.loc8 // CHECK:STDOUT: assign %n.var, %.loc8 -// CHECK:STDOUT: %.loc9_13: type = ptr_type i32 +// CHECK:STDOUT: %.loc9_13: type = ptr_type i32, const // CHECK:STDOUT: %p.var: ref i32* = var p // CHECK:STDOUT: %p: ref i32* = bind_name p, %p.var // CHECK:STDOUT: %n.ref: ref i32 = name_ref n, %n diff --git a/toolchain/check/testdata/pointer/fail_address_of_error.carbon b/toolchain/check/testdata/pointer/fail_address_of_error.carbon index a13bfab3a5db..8b30ce0bbdd9 100644 --- a/toolchain/check/testdata/pointer/fail_address_of_error.carbon +++ b/toolchain/check/testdata/pointer/fail_address_of_error.carbon @@ -21,13 +21,13 @@ fn Test() { // CHECK:STDOUT: --- fail_address_of_error.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc11: type = ptr_type -// CHECK:STDOUT: %.loc18: type = ptr_type * +// CHECK:STDOUT: %.loc11: type = ptr_type , const +// CHECK:STDOUT: %.loc18: type = ptr_type *, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Test = %Test} -// CHECK:STDOUT: %Test: = fn_decl @Test +// CHECK:STDOUT: %Test: = fn_decl @Test, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Test() { diff --git a/toolchain/check/testdata/pointer/fail_address_of_value.carbon b/toolchain/check/testdata/pointer/fail_address_of_value.carbon index 65467e104b7d..c3257f7a44e9 100644 --- a/toolchain/check/testdata/pointer/fail_address_of_value.carbon +++ b/toolchain/check/testdata/pointer/fail_address_of_value.carbon @@ -85,26 +85,48 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: --- fail_address_of_value.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc15: type = ptr_type i32 -// CHECK:STDOUT: %.loc19: type = ptr_type bool -// CHECK:STDOUT: %.loc23: type = ptr_type f64 -// CHECK:STDOUT: %.1: type = ptr_type String -// CHECK:STDOUT: %.loc31_9: type = tuple_type (i32, i32) -// CHECK:STDOUT: %.loc31_3: type = ptr_type (i32, i32) -// CHECK:STDOUT: %.loc35: type = ptr_type {.a: i32} -// CHECK:STDOUT: %.loc64: type = ptr_type type +// CHECK:STDOUT: %.loc15_4: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc15_3.1: type = ptr_type i32, const +// CHECK:STDOUT: %.loc15_3.2: i32* = addr_of %.loc15_4, const +// CHECK:STDOUT: %.loc19_4: bool = bool_literal true, const +// CHECK:STDOUT: %.loc19_3.1: type = ptr_type bool, const +// CHECK:STDOUT: %.loc19_3.2: bool* = addr_of %.loc19_4, const +// CHECK:STDOUT: %.loc23_4: f64 = real_literal 10e-1, const +// CHECK:STDOUT: %.loc23_3.1: type = ptr_type f64, const +// CHECK:STDOUT: %.loc23_3.2: f64* = addr_of %.loc23_4, const +// CHECK:STDOUT: %.1: type = ptr_type String, const +// CHECK:STDOUT: %.loc27_4: String = string_literal "Hello", const +// CHECK:STDOUT: %.loc27_3: String* = addr_of %.loc27_4, const +// CHECK:STDOUT: %.loc31_5: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc31_8: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc31_9: type = tuple_type (i32, i32), const +// CHECK:STDOUT: %.loc31_3: type = ptr_type (i32, i32), const +// CHECK:STDOUT: %.loc35_10: i32 = int_literal 5, const +// CHECK:STDOUT: %.loc35_3: type = ptr_type {.a: i32}, const +// CHECK:STDOUT: %.loc42_5: bool = bool_literal true, const +// CHECK:STDOUT: %.loc42_10: bool = bool_literal false, const +// CHECK:STDOUT: %.loc42_14: bool = bool_literal false, const +// CHECK:STDOUT: %.loc50_9.1: bool = bool_literal true, const +// CHECK:STDOUT: %.loc50_9.2: bool = bool_literal false, const +// CHECK:STDOUT: %.loc50_3: bool* = addr_of %.loc50_9.2, const +// CHECK:STDOUT: %.loc64: type = ptr_type type, const +// CHECK:STDOUT: %.loc68: type* = addr_of @AddressOfType.%.loc68_14, const +// CHECK:STDOUT: %.loc75_6: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc75_9: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc75_12: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc75_10: (i32, i32) = tuple_value (%.loc75_6, %.loc75_9), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.G = %G, .H = %H, .AddressOfLiteral = %AddressOfLiteral, .AddressOfOperator = %AddressOfOperator, .AddressOfCall = %AddressOfCall, .AddressOfType = %AddressOfType, .AddressOfTupleElementValue = %AddressOfTupleElementValue, .AddressOfParam = %AddressOfParam} -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %H: = fn_decl @H -// CHECK:STDOUT: %AddressOfLiteral: = fn_decl @AddressOfLiteral -// CHECK:STDOUT: %AddressOfOperator: = fn_decl @AddressOfOperator -// CHECK:STDOUT: %AddressOfCall: = fn_decl @AddressOfCall -// CHECK:STDOUT: %AddressOfType: = fn_decl @AddressOfType -// CHECK:STDOUT: %AddressOfTupleElementValue: = fn_decl @AddressOfTupleElementValue -// CHECK:STDOUT: %AddressOfParam: = fn_decl @AddressOfParam +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %H: = fn_decl @H, const +// CHECK:STDOUT: %AddressOfLiteral: = fn_decl @AddressOfLiteral, const +// CHECK:STDOUT: %AddressOfOperator: = fn_decl @AddressOfOperator, const +// CHECK:STDOUT: %AddressOfCall: = fn_decl @AddressOfCall, const +// CHECK:STDOUT: %AddressOfType: = fn_decl @AddressOfType, const +// CHECK:STDOUT: %AddressOfTupleElementValue: = fn_decl @AddressOfTupleElementValue, const +// CHECK:STDOUT: %AddressOfParam: = fn_decl @AddressOfParam, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32; @@ -113,19 +135,19 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfLiteral() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_4: i32 = int_literal 0 -// CHECK:STDOUT: %.loc15_3: i32* = addr_of %.loc15_4 -// CHECK:STDOUT: %.loc19_4: bool = bool_literal true -// CHECK:STDOUT: %.loc19_3: bool* = addr_of %.loc19_4 -// CHECK:STDOUT: %.loc23_4: f64 = real_literal 10e-1 -// CHECK:STDOUT: %.loc23_3: f64* = addr_of %.loc23_4 -// CHECK:STDOUT: %.loc27_4: String = string_literal "Hello" -// CHECK:STDOUT: %.loc27_3: String* = addr_of %.loc27_4 -// CHECK:STDOUT: %.loc31_5: i32 = int_literal 1 -// CHECK:STDOUT: %.loc31_8: i32 = int_literal 2 +// CHECK:STDOUT: %.loc15_4: i32 = int_literal 0, const = constants.%.loc15_4 +// CHECK:STDOUT: %.loc15_3: i32* = addr_of %.loc15_4, const = constants.%.loc15_3.2 +// CHECK:STDOUT: %.loc19_4: bool = bool_literal true, const = constants.%.loc19_4 +// CHECK:STDOUT: %.loc19_3: bool* = addr_of %.loc19_4, const = constants.%.loc19_3.2 +// CHECK:STDOUT: %.loc23_4: f64 = real_literal 10e-1, const = constants.%.loc23_4 +// CHECK:STDOUT: %.loc23_3: f64* = addr_of %.loc23_4, const = constants.%.loc23_3.2 +// CHECK:STDOUT: %.loc27_4: String = string_literal "Hello", const = constants.%.loc27_4 +// CHECK:STDOUT: %.loc27_3: String* = addr_of %.loc27_4, const = constants.%.loc27_3 +// CHECK:STDOUT: %.loc31_5: i32 = int_literal 1, const = constants.%.loc31_5 +// CHECK:STDOUT: %.loc31_8: i32 = int_literal 2, const = constants.%.loc31_8 // CHECK:STDOUT: %.loc31_9: (i32, i32) = tuple_literal (%.loc31_5, %.loc31_8) // CHECK:STDOUT: %.loc31_3: (i32, i32)* = addr_of %.loc31_9 -// CHECK:STDOUT: %.loc35_10: i32 = int_literal 5 +// CHECK:STDOUT: %.loc35_10: i32 = int_literal 5, const = constants.%.loc35_10 // CHECK:STDOUT: %.loc35_11: {.a: i32} = struct_literal (%.loc35_10) // CHECK:STDOUT: %.loc35_3: {.a: i32}* = addr_of %.loc35_11 // CHECK:STDOUT: return @@ -133,32 +155,32 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfOperator() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc42_5: bool = bool_literal true -// CHECK:STDOUT: %.loc42_10.1: bool = bool_literal false +// CHECK:STDOUT: %.loc42_5: bool = bool_literal true, const = constants.%.loc42_5 +// CHECK:STDOUT: %.loc42_10.1: bool = bool_literal false, const = constants.%.loc42_10 // CHECK:STDOUT: if %.loc42_5 br !and.rhs else br !and.result(%.loc42_10.1) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs: -// CHECK:STDOUT: %.loc42_14: bool = bool_literal false +// CHECK:STDOUT: %.loc42_14: bool = bool_literal false, const = constants.%.loc42_14 // CHECK:STDOUT: br !and.result(%.loc42_14) // CHECK:STDOUT: // CHECK:STDOUT: !and.result: // CHECK:STDOUT: %.loc42_10.2: bool = block_arg !and.result // CHECK:STDOUT: %.loc42_3: bool* = addr_of %.loc42_10.2 -// CHECK:STDOUT: %H.ref: = name_ref H, file.%H +// CHECK:STDOUT: %H.ref: = name_ref H, file.%H, const = file.%H // CHECK:STDOUT: %.loc46_5.1: init {.a: i32} = call %H.ref() // CHECK:STDOUT: %.loc46_5.2: ref {.a: i32} = temporary_storage // CHECK:STDOUT: %.loc46_5.3: ref {.a: i32} = temporary %.loc46_5.2, %.loc46_5.1 // CHECK:STDOUT: %.loc46_7: ref i32 = struct_access %.loc46_5.3, element0 // CHECK:STDOUT: %.loc46_3: i32* = addr_of %.loc46_7 -// CHECK:STDOUT: %.loc50_9: bool = bool_literal true -// CHECK:STDOUT: %.loc50_5: bool = not %.loc50_9 -// CHECK:STDOUT: %.loc50_3: bool* = addr_of %.loc50_5 +// CHECK:STDOUT: %.loc50_9: bool = bool_literal true, const = constants.%.loc50_9.1 +// CHECK:STDOUT: %.loc50_5: bool = not %.loc50_9, const = constants.%.loc50_9.2 +// CHECK:STDOUT: %.loc50_3: bool* = addr_of %.loc50_5, const = constants.%.loc50_3 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfCall() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G +// CHECK:STDOUT: %G.ref: = name_ref G, file.%G, const = file.%G // CHECK:STDOUT: %.loc57_5: init i32 = call %G.ref() // CHECK:STDOUT: %.loc57_3: i32* = addr_of %.loc57_5 // CHECK:STDOUT: return @@ -167,19 +189,19 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: fn @AddressOfType() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %.loc64: type* = addr_of i32 -// CHECK:STDOUT: %.loc68_5: type = const_type i32 -// CHECK:STDOUT: %.loc68_14: type = ptr_type const i32 -// CHECK:STDOUT: %.loc68_3: type* = addr_of %.loc68_14 +// CHECK:STDOUT: %.loc68_5: type = const_type i32, const +// CHECK:STDOUT: %.loc68_14: type = ptr_type const i32, const +// CHECK:STDOUT: %.loc68_3: type* = addr_of %.loc68_14, const = constants.%.loc68 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfTupleElementValue() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc75_6: i32 = int_literal 1 -// CHECK:STDOUT: %.loc75_9: i32 = int_literal 2 +// CHECK:STDOUT: %.loc75_6: i32 = int_literal 1, const = constants.%.loc75_6 +// CHECK:STDOUT: %.loc75_9: i32 = int_literal 2, const = constants.%.loc75_9 // CHECK:STDOUT: %.loc75_10.1: (i32, i32) = tuple_literal (%.loc75_6, %.loc75_9) -// CHECK:STDOUT: %.loc75_12: i32 = int_literal 0 -// CHECK:STDOUT: %.loc75_10.2: (i32, i32) = tuple_value (%.loc75_6, %.loc75_9) +// CHECK:STDOUT: %.loc75_12: i32 = int_literal 0, const = constants.%.loc75_12 +// CHECK:STDOUT: %.loc75_10.2: (i32, i32) = tuple_value (%.loc75_6, %.loc75_9), const = constants.%.loc75_10 // CHECK:STDOUT: %.loc75_10.3: (i32, i32) = converted %.loc75_10.1, %.loc75_10.2 // CHECK:STDOUT: %.loc75_13: i32 = tuple_index %.loc75_10.3, %.loc75_12 // CHECK:STDOUT: %.loc75_3: i32* = addr_of %.loc75_13 @@ -188,7 +210,7 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfParam(%param: i32) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc82_22: type = ptr_type i32 +// CHECK:STDOUT: %.loc82_22: type = ptr_type i32, const // CHECK:STDOUT: %param_addr.var: ref i32* = var param_addr // CHECK:STDOUT: %param_addr: ref i32* = bind_name param_addr, %param_addr.var // CHECK:STDOUT: %param.ref: i32 = name_ref param, %param diff --git a/toolchain/check/testdata/pointer/fail_deref_function.carbon b/toolchain/check/testdata/pointer/fail_deref_function.carbon index d09abb144d3f..4ddf5eecaf26 100644 --- a/toolchain/check/testdata/pointer/fail_deref_function.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_function.carbon @@ -15,12 +15,12 @@ fn A() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %A} -// CHECK:STDOUT: %A: = fn_decl @A +// CHECK:STDOUT: %A: = fn_decl @A, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%A +// CHECK:STDOUT: %A.ref: = name_ref A, file.%A, const = file.%A // CHECK:STDOUT: %.loc11: ref = deref // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/pointer/fail_deref_namespace.carbon b/toolchain/check/testdata/pointer/fail_deref_namespace.carbon index 80addd8a1fdc..8a1325664fb9 100644 --- a/toolchain/check/testdata/pointer/fail_deref_namespace.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_namespace.carbon @@ -18,7 +18,7 @@ fn F() { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %.loc7, .F = %F} // CHECK:STDOUT: %.loc7: = namespace A, {} -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon b/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon index b4779fdcf748..10440e1fb540 100644 --- a/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon @@ -22,13 +22,15 @@ fn Deref(n: i32) { // CHECK:STDOUT: --- fail_deref_not_pointer.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc15: type = tuple_type () -// CHECK:STDOUT: %.loc19: type = struct_type {} +// CHECK:STDOUT: %.loc15_5.1: type = tuple_type (), const +// CHECK:STDOUT: %.loc15_5.2: () = tuple_value (), const +// CHECK:STDOUT: %.loc19_5.1: type = struct_type {}, const +// CHECK:STDOUT: %.loc19_5.2: {} = struct_value (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Deref = %Deref} -// CHECK:STDOUT: %Deref: = fn_decl @Deref +// CHECK:STDOUT: %Deref: = fn_decl @Deref, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Deref(%n: i32) { @@ -36,11 +38,11 @@ fn Deref(n: i32) { // CHECK:STDOUT: %n.ref: i32 = name_ref n, %n // CHECK:STDOUT: %.loc11: ref = deref %n.ref // CHECK:STDOUT: %.loc15_5.1: () = tuple_literal () -// CHECK:STDOUT: %.loc15_5.2: () = tuple_value () +// CHECK:STDOUT: %.loc15_5.2: () = tuple_value (), const = constants.%.loc15_5.2 // CHECK:STDOUT: %.loc15_5.3: () = converted %.loc15_5.1, %.loc15_5.2 // CHECK:STDOUT: %.loc15_3: ref = deref %.loc15_5.3 // CHECK:STDOUT: %.loc19_5.1: {} = struct_literal () -// CHECK:STDOUT: %.loc19_5.2: {} = struct_value () +// CHECK:STDOUT: %.loc19_5.2: {} = struct_value (), const = constants.%.loc19_5.2 // CHECK:STDOUT: %.loc19_5.3: {} = converted %.loc19_5.1, %.loc19_5.2 // CHECK:STDOUT: %.loc19_3: ref = deref %.loc19_5.3 // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/pointer/fail_type_mismatch.carbon b/toolchain/check/testdata/pointer/fail_type_mismatch.carbon index f81041f61371..338bbf062619 100644 --- a/toolchain/check/testdata/pointer/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/pointer/fail_type_mismatch.carbon @@ -14,12 +14,12 @@ fn ConstMismatch(p: const {}*) -> const ({}*) { // CHECK:STDOUT: --- fail_type_mismatch.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7: type = struct_type {} +// CHECK:STDOUT: %.loc7: type = struct_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.ConstMismatch = %ConstMismatch} -// CHECK:STDOUT: %ConstMismatch: = fn_decl @ConstMismatch +// CHECK:STDOUT: %ConstMismatch: = fn_decl @ConstMismatch, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @ConstMismatch(%p: const {}*) -> const ({}*) { diff --git a/toolchain/check/testdata/pointer/nested_const.carbon b/toolchain/check/testdata/pointer/nested_const.carbon index f8f692876e01..55471c7ac0ac 100644 --- a/toolchain/check/testdata/pointer/nested_const.carbon +++ b/toolchain/check/testdata/pointer/nested_const.carbon @@ -13,7 +13,7 @@ fn F(p: const (const (const i32*)*)) -> const i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%p: const (const (const i32*)*)) -> const i32 { diff --git a/toolchain/check/testdata/pointer/types.carbon b/toolchain/check/testdata/pointer/types.carbon index dc225a8468b6..c97a1b1cf77b 100644 --- a/toolchain/check/testdata/pointer/types.carbon +++ b/toolchain/check/testdata/pointer/types.carbon @@ -16,8 +16,8 @@ fn ConstPtr(p: const i32*) -> (const i32)* { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Ptr = %Ptr, .ConstPtr = %ConstPtr} -// CHECK:STDOUT: %Ptr: = fn_decl @Ptr -// CHECK:STDOUT: %ConstPtr: = fn_decl @ConstPtr +// CHECK:STDOUT: %Ptr: = fn_decl @Ptr, const +// CHECK:STDOUT: %ConstPtr: = fn_decl @ConstPtr, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Ptr(%p: i32*) -> i32* { diff --git a/toolchain/check/testdata/return/code_after_return.carbon b/toolchain/check/testdata/return/code_after_return.carbon index e29e10aa2405..1220eb64a123 100644 --- a/toolchain/check/testdata/return/code_after_return.carbon +++ b/toolchain/check/testdata/return/code_after_return.carbon @@ -11,9 +11,13 @@ fn Main() { // CHECK:STDOUT: --- code_after_return.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc9: i32 = int_literal 1, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/return/code_after_return_value.carbon b/toolchain/check/testdata/return/code_after_return_value.carbon index 09f9d001a6bf..3dcc506534d1 100644 --- a/toolchain/check/testdata/return/code_after_return_value.carbon +++ b/toolchain/check/testdata/return/code_after_return_value.carbon @@ -18,14 +18,22 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: --- code_after_return_value.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc8: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc12_26: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc12_33: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc13_9: bool = bool_literal false, const +// CHECK:STDOUT: %.loc13_16: bool = bool_literal true, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%b: bool) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 +// CHECK:STDOUT: %.loc8: i32 = int_literal 0, const = constants.%.loc8 // CHECK:STDOUT: return %.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_call_in_type.carbon b/toolchain/check/testdata/return/fail_call_in_type.carbon index 48230d5c301a..ae7a15517736 100644 --- a/toolchain/check/testdata/return/fail_call_in_type.carbon +++ b/toolchain/check/testdata/return/fail_call_in_type.carbon @@ -14,10 +14,14 @@ fn Six() -> ReturnType() { return 6; } // CHECK:STDOUT: --- fail_call_in_type.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc13: i32 = int_literal 6, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.ReturnType = %ReturnType, .Six = %Six} -// CHECK:STDOUT: %ReturnType: = fn_decl @ReturnType -// CHECK:STDOUT: %Six: = fn_decl @Six +// CHECK:STDOUT: %ReturnType: = fn_decl @ReturnType, const +// CHECK:STDOUT: %Six: = fn_decl @Six, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @ReturnType() -> type { @@ -27,7 +31,7 @@ fn Six() -> ReturnType() { return 6; } // CHECK:STDOUT: // CHECK:STDOUT: fn @Six() -> { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc13: i32 = int_literal 6 +// CHECK:STDOUT: %.loc13: i32 = int_literal 6, const = constants.%.loc13 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_error_in_type.carbon b/toolchain/check/testdata/return/fail_error_in_type.carbon index d70b47bd917a..a97e8bf44683 100644 --- a/toolchain/check/testdata/return/fail_error_in_type.carbon +++ b/toolchain/check/testdata/return/fail_error_in_type.carbon @@ -13,7 +13,7 @@ fn Six() -> x; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Six = %Six} -// CHECK:STDOUT: %Six: = fn_decl @Six +// CHECK:STDOUT: %Six: = fn_decl @Six, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Six() -> ; diff --git a/toolchain/check/testdata/return/fail_let_in_type.carbon b/toolchain/check/testdata/return/fail_let_in_type.carbon index 5b1120acf947..4f7f6b5f2cd0 100644 --- a/toolchain/check/testdata/return/fail_let_in_type.carbon +++ b/toolchain/check/testdata/return/fail_let_in_type.carbon @@ -13,15 +13,19 @@ fn Six() -> x { return 6; } // CHECK:STDOUT: --- fail_let_in_type.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc12: i32 = int_literal 6, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Six = %Six} // CHECK:STDOUT: %x: type = bind_name x, i32 -// CHECK:STDOUT: %Six: = fn_decl @Six +// CHECK:STDOUT: %Six: = fn_decl @Six, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Six() -> { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc12: i32 = int_literal 6 +// CHECK:STDOUT: %.loc12: i32 = int_literal 6, const = constants.%.loc12 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_missing_return.carbon b/toolchain/check/testdata/return/fail_missing_return.carbon index 7dfd0194a374..0ff37cd6f81f 100644 --- a/toolchain/check/testdata/return/fail_missing_return.carbon +++ b/toolchain/check/testdata/return/fail_missing_return.carbon @@ -14,7 +14,7 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { diff --git a/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon b/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon index b60742b215a8..2fcf76a9496d 100644 --- a/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon +++ b/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon @@ -13,12 +13,12 @@ fn F() -> () { // CHECK:STDOUT: --- fail_missing_return_empty_tuple.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7: type = tuple_type () +// CHECK:STDOUT: %.loc7: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> () { diff --git a/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon b/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon index 3b84b63da0c1..5a5129c62f55 100644 --- a/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon +++ b/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon @@ -15,7 +15,7 @@ fn Procedure() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Procedure = %Procedure} -// CHECK:STDOUT: %Procedure: = fn_decl @Procedure +// CHECK:STDOUT: %Procedure: = fn_decl @Procedure, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Procedure() -> i32 { diff --git a/toolchain/check/testdata/return/fail_return_with_returned_var.carbon b/toolchain/check/testdata/return/fail_return_with_returned_var.carbon index f4c261b84758..61a51c4c41ba 100644 --- a/toolchain/check/testdata/return/fail_return_with_returned_var.carbon +++ b/toolchain/check/testdata/return/fail_return_with_returned_var.carbon @@ -30,25 +30,29 @@ fn G() -> C { // CHECK:STDOUT: --- fail_return_with_returned_var.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc18_35.1: type = struct_type {.a: i32, .b: i32} -// CHECK:STDOUT: %.loc18_35.2: type = ptr_type {.a: i32, .b: i32} +// CHECK:STDOUT: %.loc8: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc15: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc18_35.1: type = struct_type {.a: i32, .b: i32}, const +// CHECK:STDOUT: %.loc18_35.2: type = ptr_type {.a: i32, .b: i32}, const +// CHECK:STDOUT: %.loc20_29: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc20_37: i32 = int_literal 2, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F, .C = %C.decl, .G = %G} -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C -// CHECK:STDOUT: %G: = fn_decl @G +// CHECK:STDOUT: %C: type = class_type @C, const +// CHECK:STDOUT: %G: = fn_decl @G, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %.loc18_16.1: type = unbound_element_type C, i32 -// CHECK:STDOUT: %.loc18_16.2: = field_decl a, element0 -// CHECK:STDOUT: %a: = bind_name a, %.loc18_16.2 -// CHECK:STDOUT: %.loc18_28.1: type = unbound_element_type C, i32 -// CHECK:STDOUT: %.loc18_28.2: = field_decl b, element1 -// CHECK:STDOUT: %b: = bind_name b, %.loc18_28.2 +// CHECK:STDOUT: %.loc18_16.1: type = unbound_element_type C, i32, const +// CHECK:STDOUT: %.loc18_16.2: = field_decl a, element0, const +// CHECK:STDOUT: %a: = bind_name a, %.loc18_16.2, const = %.loc18_16.2 +// CHECK:STDOUT: %.loc18_28.1: type = unbound_element_type C, i32, const +// CHECK:STDOUT: %.loc18_28.2: = field_decl b, element1, const +// CHECK:STDOUT: %b: = bind_name b, %.loc18_28.2, const = %.loc18_28.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .a = %a @@ -59,18 +63,18 @@ fn G() -> C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 +// CHECK:STDOUT: %.loc8: i32 = int_literal 0, const = constants.%.loc8 // CHECK:STDOUT: assign %v.var, %.loc8 -// CHECK:STDOUT: %.loc15: i32 = int_literal 1 +// CHECK:STDOUT: %.loc15: i32 = int_literal 1, const = constants.%.loc15 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> %return: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C +// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C, const = file.%C // CHECK:STDOUT: %c: ref C = bind_name c, %return -// CHECK:STDOUT: %.loc20_29: i32 = int_literal 1 -// CHECK:STDOUT: %.loc20_37: i32 = int_literal 2 +// CHECK:STDOUT: %.loc20_29: i32 = int_literal 1, const = constants.%.loc20_29 +// CHECK:STDOUT: %.loc20_37: i32 = int_literal 2, const = constants.%.loc20_37 // CHECK:STDOUT: %.loc20_38.1: {.a: i32, .b: i32} = struct_literal (%.loc20_29, %.loc20_37) // CHECK:STDOUT: %.loc20_38.2: ref i32 = class_element_access %return, element0 // CHECK:STDOUT: %.loc20_38.3: init i32 = initialize_from %.loc20_29 to %.loc20_38.2 diff --git a/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon b/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon index 7ccb5de87320..b39ccfc38629 100644 --- a/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon @@ -18,12 +18,12 @@ fn Procedure() { // CHECK:STDOUT: --- fail_returned_var_no_return_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc14: type = tuple_type () +// CHECK:STDOUT: %.loc14: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Procedure = %Procedure} -// CHECK:STDOUT: %Procedure: = fn_decl @Procedure +// CHECK:STDOUT: %Procedure: = fn_decl @Procedure, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Procedure() { diff --git a/toolchain/check/testdata/return/fail_returned_var_shadow.carbon b/toolchain/check/testdata/return/fail_returned_var_shadow.carbon index 781f5e02affc..5fde3d2eb930 100644 --- a/toolchain/check/testdata/return/fail_returned_var_shadow.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_shadow.carbon @@ -36,50 +36,62 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: --- fail_returned_var_shadow.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc8: bool = bool_literal true, const +// CHECK:STDOUT: %.loc9: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc16: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc18: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc22: bool = bool_literal true, const +// CHECK:STDOUT: %.loc23: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc24: bool = bool_literal true, const +// CHECK:STDOUT: %.loc31: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc34: i32 = int_literal 0, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.SameScope = %SameScope, .DifferentScopes = %DifferentScopes} -// CHECK:STDOUT: %SameScope: = fn_decl @SameScope -// CHECK:STDOUT: %DifferentScopes: = fn_decl @DifferentScopes +// CHECK:STDOUT: %SameScope: = fn_decl @SameScope, const +// CHECK:STDOUT: %DifferentScopes: = fn_decl @DifferentScopes, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @SameScope() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: bool = bool_literal true +// CHECK:STDOUT: %.loc8: bool = bool_literal true, const = constants.%.loc8 // CHECK:STDOUT: if %.loc8 br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc9: i32 = int_literal 0 +// CHECK:STDOUT: %.loc9: i32 = int_literal 0, const = constants.%.loc9 // CHECK:STDOUT: assign %v.var, %.loc9 // CHECK:STDOUT: %w.var: ref i32 = var w // CHECK:STDOUT: %w: ref i32 = bind_name w, %w.var -// CHECK:STDOUT: %.loc16: i32 = int_literal 1 +// CHECK:STDOUT: %.loc16: i32 = int_literal 1, const = constants.%.loc16 // CHECK:STDOUT: assign %w.var, %.loc16 // CHECK:STDOUT: br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %.loc18: i32 = int_literal 0 +// CHECK:STDOUT: %.loc18: i32 = int_literal 0, const = constants.%.loc18 // CHECK:STDOUT: return %.loc18 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @DifferentScopes() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc22: bool = bool_literal true +// CHECK:STDOUT: %.loc22: bool = bool_literal true, const = constants.%.loc22 // CHECK:STDOUT: if %.loc22 br !if.then.loc22 else br !if.else.loc22 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc22: // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc23: i32 = int_literal 0 +// CHECK:STDOUT: %.loc23: i32 = int_literal 0, const = constants.%.loc23 // CHECK:STDOUT: assign %v.var, %.loc23 -// CHECK:STDOUT: %.loc24: bool = bool_literal true +// CHECK:STDOUT: %.loc24: bool = bool_literal true, const = constants.%.loc24 // CHECK:STDOUT: if %.loc24 br !if.then.loc24 else br !if.else.loc24 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc24: // CHECK:STDOUT: %w.var: ref i32 = var w // CHECK:STDOUT: %w: ref i32 = bind_name w, %w.var -// CHECK:STDOUT: %.loc31: i32 = int_literal 1 +// CHECK:STDOUT: %.loc31: i32 = int_literal 1, const = constants.%.loc31 // CHECK:STDOUT: assign %w.var, %.loc31 // CHECK:STDOUT: br !if.else.loc24 // CHECK:STDOUT: @@ -87,7 +99,7 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: br !if.else.loc22 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc22: -// CHECK:STDOUT: %.loc34: i32 = int_literal 0 +// CHECK:STDOUT: %.loc34: i32 = int_literal 0, const = constants.%.loc34 // CHECK:STDOUT: return %.loc34 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_returned_var_type.carbon b/toolchain/check/testdata/return/fail_returned_var_type.carbon index d322f3fab728..77558a0c660b 100644 --- a/toolchain/check/testdata/return/fail_returned_var_type.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_type.carbon @@ -17,15 +17,19 @@ fn Mismatch() -> i32 { // CHECK:STDOUT: --- fail_returned_var_type.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc14: f64 = real_literal 0e-1, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Mismatch = %Mismatch} -// CHECK:STDOUT: %Mismatch: = fn_decl @Mismatch +// CHECK:STDOUT: %Mismatch: = fn_decl @Mismatch, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Mismatch() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %v: f64 = bind_name v, -// CHECK:STDOUT: %.loc14: f64 = real_literal 0e-1 +// CHECK:STDOUT: %.loc14: f64 = real_literal 0e-1, const = constants.%.loc14 // CHECK:STDOUT: assign , // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/return/fail_type_mismatch.carbon b/toolchain/check/testdata/return/fail_type_mismatch.carbon index 3bce022a2567..5a7d0186fe16 100644 --- a/toolchain/check/testdata/return/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/return/fail_type_mismatch.carbon @@ -13,14 +13,18 @@ fn Main() -> i32 { // CHECK:STDOUT: --- fail_type_mismatch.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc11: f64 = real_literal 10e-1, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11: f64 = real_literal 10e-1 +// CHECK:STDOUT: %.loc11: f64 = real_literal 10e-1, const = constants.%.loc11 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_value_disallowed.carbon b/toolchain/check/testdata/return/fail_value_disallowed.carbon index 453f1cb2684c..c848c0ef5f8a 100644 --- a/toolchain/check/testdata/return/fail_value_disallowed.carbon +++ b/toolchain/check/testdata/return/fail_value_disallowed.carbon @@ -16,14 +16,18 @@ fn Main() { // CHECK:STDOUT: --- fail_value_disallowed.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc14: i32 = int_literal 0, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc14: i32 = int_literal 0 +// CHECK:STDOUT: %.loc14: i32 = int_literal 0, const = constants.%.loc14 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_value_missing.carbon b/toolchain/check/testdata/return/fail_value_missing.carbon index 19e1dc53f3f2..3f32b882e2c2 100644 --- a/toolchain/check/testdata/return/fail_value_missing.carbon +++ b/toolchain/check/testdata/return/fail_value_missing.carbon @@ -18,7 +18,7 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { diff --git a/toolchain/check/testdata/return/fail_var_in_type.carbon b/toolchain/check/testdata/return/fail_var_in_type.carbon index 7ea5143f5bec..bdde6759f56d 100644 --- a/toolchain/check/testdata/return/fail_var_in_type.carbon +++ b/toolchain/check/testdata/return/fail_var_in_type.carbon @@ -12,17 +12,21 @@ fn Six() -> x { return 6; } // CHECK:STDOUT: --- fail_var_in_type.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc11: i32 = int_literal 6, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x, .Six = %Six} // CHECK:STDOUT: %x.var: ref type = var x // CHECK:STDOUT: %x: ref type = bind_name x, %x.var // CHECK:STDOUT: assign %x.var, i32 -// CHECK:STDOUT: %Six: = fn_decl @Six +// CHECK:STDOUT: %Six: = fn_decl @Six, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Six() -> { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11: i32 = int_literal 6 +// CHECK:STDOUT: %.loc11: i32 = int_literal 6, const = constants.%.loc11 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/missing_return_no_return_type.carbon b/toolchain/check/testdata/return/missing_return_no_return_type.carbon index ce5ef9e2ef34..ed5b37c14011 100644 --- a/toolchain/check/testdata/return/missing_return_no_return_type.carbon +++ b/toolchain/check/testdata/return/missing_return_no_return_type.carbon @@ -11,7 +11,7 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/return/no_value.carbon b/toolchain/check/testdata/return/no_value.carbon index 6e93dd5cae92..f3b2b9fa8f93 100644 --- a/toolchain/check/testdata/return/no_value.carbon +++ b/toolchain/check/testdata/return/no_value.carbon @@ -12,7 +12,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/return/returned_var.carbon b/toolchain/check/testdata/return/returned_var.carbon index 98bc87815a15..09e661e37316 100644 --- a/toolchain/check/testdata/return/returned_var.carbon +++ b/toolchain/check/testdata/return/returned_var.carbon @@ -22,25 +22,28 @@ fn G() -> i32 { // CHECK:STDOUT: --- returned_var.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10_1.1: type = struct_type {.a: i32, .b: i32} -// CHECK:STDOUT: %.loc10_1.2: type = ptr_type {.a: i32, .b: i32} +// CHECK:STDOUT: %.loc10_1.1: type = struct_type {.a: i32, .b: i32}, const +// CHECK:STDOUT: %.loc10_1.2: type = ptr_type {.a: i32, .b: i32}, const +// CHECK:STDOUT: %.loc13_34: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc13_42: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc18: i32 = int_literal 0, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.C = %C.decl, .F = %F, .G = %G} // CHECK:STDOUT: %C.decl = class_decl @C, () -// CHECK:STDOUT: %C: type = class_type @C -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G +// CHECK:STDOUT: %C: type = class_type @C, const +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type C, i32 -// CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0 -// CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2 -// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type C, i32 -// CHECK:STDOUT: %.loc9_8.2: = field_decl b, element1 -// CHECK:STDOUT: %b: = bind_name b, %.loc9_8.2 +// CHECK:STDOUT: %.loc8_8.1: type = unbound_element_type C, i32, const +// CHECK:STDOUT: %.loc8_8.2: = field_decl a, element0, const +// CHECK:STDOUT: %a: = bind_name a, %.loc8_8.2, const = %.loc8_8.2 +// CHECK:STDOUT: %.loc9_8.1: type = unbound_element_type C, i32, const +// CHECK:STDOUT: %.loc9_8.2: = field_decl b, element1, const +// CHECK:STDOUT: %b: = bind_name b, %.loc9_8.2, const = %.loc9_8.2 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .a = %a @@ -49,10 +52,10 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %return: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C +// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C, const = file.%C // CHECK:STDOUT: %result: ref C = bind_name result, %return -// CHECK:STDOUT: %.loc13_34: i32 = int_literal 1 -// CHECK:STDOUT: %.loc13_42: i32 = int_literal 2 +// CHECK:STDOUT: %.loc13_34: i32 = int_literal 1, const = constants.%.loc13_34 +// CHECK:STDOUT: %.loc13_42: i32 = int_literal 2, const = constants.%.loc13_42 // CHECK:STDOUT: %.loc13_43.1: {.a: i32, .b: i32} = struct_literal (%.loc13_34, %.loc13_42) // CHECK:STDOUT: %.loc13_43.2: ref i32 = class_element_access %return, element0 // CHECK:STDOUT: %.loc13_43.3: init i32 = initialize_from %.loc13_34 to %.loc13_43.2 @@ -68,7 +71,7 @@ fn G() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %result.var: ref i32 = var result // CHECK:STDOUT: %result: ref i32 = bind_name result, %result.var -// CHECK:STDOUT: %.loc18_30: i32 = int_literal 0 +// CHECK:STDOUT: %.loc18_30: i32 = int_literal 0, const = constants.%.loc18 // CHECK:STDOUT: assign %result.var, %.loc18_30 // CHECK:STDOUT: %.loc18_16: i32 = bind_value %result // CHECK:STDOUT: return %.loc18_16 diff --git a/toolchain/check/testdata/return/returned_var_scope.carbon b/toolchain/check/testdata/return/returned_var_scope.carbon index a93917dea7e7..2eb22a42a21f 100644 --- a/toolchain/check/testdata/return/returned_var_scope.carbon +++ b/toolchain/check/testdata/return/returned_var_scope.carbon @@ -25,37 +25,47 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: --- returned_var_scope.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc8: bool = bool_literal true, const +// CHECK:STDOUT: %.loc9: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc11: bool = bool_literal true, const +// CHECK:STDOUT: %.loc12: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc14: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc19: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc22: i32 = int_literal 1, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.UnrelatedScopes = %UnrelatedScopes, .EnclosingButAfter = %EnclosingButAfter} -// CHECK:STDOUT: %UnrelatedScopes: = fn_decl @UnrelatedScopes -// CHECK:STDOUT: %EnclosingButAfter: = fn_decl @EnclosingButAfter +// CHECK:STDOUT: %UnrelatedScopes: = fn_decl @UnrelatedScopes, const +// CHECK:STDOUT: %EnclosingButAfter: = fn_decl @EnclosingButAfter, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @UnrelatedScopes() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: bool = bool_literal true +// CHECK:STDOUT: %.loc8: bool = bool_literal true, const = constants.%.loc8 // CHECK:STDOUT: if %.loc8 br !if.then.loc8 else br !if.else.loc8 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc8: // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc9: i32 = int_literal 0 +// CHECK:STDOUT: %.loc9: i32 = int_literal 0, const = constants.%.loc9 // CHECK:STDOUT: assign %v.var, %.loc9 // CHECK:STDOUT: br !if.else.loc8 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc8: -// CHECK:STDOUT: %.loc11: bool = bool_literal true +// CHECK:STDOUT: %.loc11: bool = bool_literal true, const = constants.%.loc11 // CHECK:STDOUT: if %.loc11 br !if.then.loc11 else br !if.else.loc11 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc11: // CHECK:STDOUT: %w.var: ref i32 = var w // CHECK:STDOUT: %w: ref i32 = bind_name w, %w.var -// CHECK:STDOUT: %.loc12: i32 = int_literal 1 +// CHECK:STDOUT: %.loc12: i32 = int_literal 1, const = constants.%.loc12 // CHECK:STDOUT: assign %w.var, %.loc12 // CHECK:STDOUT: br !if.else.loc11 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc11: -// CHECK:STDOUT: %.loc14: i32 = int_literal 0 +// CHECK:STDOUT: %.loc14: i32 = int_literal 0, const = constants.%.loc14 // CHECK:STDOUT: return %.loc14 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -67,7 +77,7 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: !if.then: // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc19_27: i32 = int_literal 0 +// CHECK:STDOUT: %.loc19_27: i32 = int_literal 0, const = constants.%.loc19 // CHECK:STDOUT: assign %v.var, %.loc19_27 // CHECK:STDOUT: %.loc19_18: i32 = bind_value %v // CHECK:STDOUT: return %.loc19_18 @@ -75,7 +85,7 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: !if.else: // CHECK:STDOUT: %w.var: ref i32 = var w // CHECK:STDOUT: %w: ref i32 = bind_name w, %w.var -// CHECK:STDOUT: %.loc22_25: i32 = int_literal 1 +// CHECK:STDOUT: %.loc22_25: i32 = int_literal 1, const = constants.%.loc22 // CHECK:STDOUT: assign %w.var, %.loc22_25 // CHECK:STDOUT: %.loc22_16: i32 = bind_value %w // CHECK:STDOUT: return %.loc22_16 diff --git a/toolchain/check/testdata/return/struct.carbon b/toolchain/check/testdata/return/struct.carbon index cfb83528ab76..bf0b1df73272 100644 --- a/toolchain/check/testdata/return/struct.carbon +++ b/toolchain/check/testdata/return/struct.carbon @@ -10,16 +10,21 @@ fn Main() -> {.a: i32} { // CHECK:STDOUT: --- struct.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc8_16: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc8_17: {.a: i32} = struct_value (%.loc8_16), const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> {.a: i32} { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8_16: i32 = int_literal 3 +// CHECK:STDOUT: %.loc8_16: i32 = int_literal 3, const = constants.%.loc8_16 // CHECK:STDOUT: %.loc8_17.1: {.a: i32} = struct_literal (%.loc8_16) -// CHECK:STDOUT: %.loc8_17.2: {.a: i32} = struct_value (%.loc8_16) +// CHECK:STDOUT: %.loc8_17.2: {.a: i32} = struct_value (%.loc8_16), const = constants.%.loc8_17 // CHECK:STDOUT: %.loc8_17.3: {.a: i32} = converted %.loc8_17.1, %.loc8_17.2 // CHECK:STDOUT: return %.loc8_17.3 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/return/tuple.carbon b/toolchain/check/testdata/return/tuple.carbon index c5c0553751f7..926e7a76efea 100644 --- a/toolchain/check/testdata/return/tuple.carbon +++ b/toolchain/check/testdata/return/tuple.carbon @@ -12,20 +12,22 @@ fn Main() -> (i32, i32) { // CHECK:STDOUT: --- tuple.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc8_23.1: type = tuple_type (type, type) -// CHECK:STDOUT: %.loc8_23.2: type = tuple_type (i32, i32) -// CHECK:STDOUT: %.loc8_23.3: type = ptr_type (i32, i32) +// CHECK:STDOUT: %.loc8_23.1: type = tuple_type (type, type), const +// CHECK:STDOUT: %.loc8_23.2: type = tuple_type (i32, i32), const +// CHECK:STDOUT: %.loc8_23.3: type = ptr_type (i32, i32), const +// CHECK:STDOUT: %.loc9_11: i32 = int_literal 15, const +// CHECK:STDOUT: %.loc9_15: i32 = int_literal 35, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> %return: (i32, i32) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9_11: i32 = int_literal 15 -// CHECK:STDOUT: %.loc9_15: i32 = int_literal 35 +// CHECK:STDOUT: %.loc9_11: i32 = int_literal 15, const = constants.%.loc9_11 +// CHECK:STDOUT: %.loc9_15: i32 = int_literal 35, const = constants.%.loc9_15 // CHECK:STDOUT: %.loc9_17.1: (i32, i32) = tuple_literal (%.loc9_11, %.loc9_15) // CHECK:STDOUT: %.loc9_17.2: ref i32 = tuple_access %return, element0 // CHECK:STDOUT: %.loc9_17.3: init i32 = initialize_from %.loc9_11 to %.loc9_17.2 diff --git a/toolchain/check/testdata/return/value.carbon b/toolchain/check/testdata/return/value.carbon index bbc952b6bb47..611ccd1a8e70 100644 --- a/toolchain/check/testdata/return/value.carbon +++ b/toolchain/check/testdata/return/value.carbon @@ -10,14 +10,18 @@ fn Main() -> i32 { // CHECK:STDOUT: --- value.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc8: i32 = int_literal 0, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 +// CHECK:STDOUT: %.loc8: i32 = int_literal 0, const = constants.%.loc8 // CHECK:STDOUT: return %.loc8 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/empty.carbon b/toolchain/check/testdata/struct/empty.carbon index e45281b4264c..73709f6ab2e1 100644 --- a/toolchain/check/testdata/struct/empty.carbon +++ b/toolchain/check/testdata/struct/empty.carbon @@ -10,8 +10,8 @@ var y: {} = x; // CHECK:STDOUT: --- empty.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_9.1: type = struct_type {} -// CHECK:STDOUT: %.loc7_9.2: type = tuple_type () +// CHECK:STDOUT: %.loc7_9.1: type = struct_type {}, const +// CHECK:STDOUT: %.loc7_9.2: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { diff --git a/toolchain/check/testdata/struct/fail_access_into_invalid.carbon b/toolchain/check/testdata/struct/fail_access_into_invalid.carbon index 07e5dddc312d..47dc533ee0bd 100644 --- a/toolchain/check/testdata/struct/fail_access_into_invalid.carbon +++ b/toolchain/check/testdata/struct/fail_access_into_invalid.carbon @@ -14,7 +14,7 @@ fn F() { a.b; } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F} -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { diff --git a/toolchain/check/testdata/struct/fail_assign_empty.carbon b/toolchain/check/testdata/struct/fail_assign_empty.carbon index bcfa7e4431e8..b0be2ee052c1 100644 --- a/toolchain/check/testdata/struct/fail_assign_empty.carbon +++ b/toolchain/check/testdata/struct/fail_assign_empty.carbon @@ -12,12 +12,12 @@ var x: {.a: i32} = {}; // CHECK:STDOUT: --- fail_assign_empty.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10: type = struct_type {} +// CHECK:STDOUT: %.loc10: type = struct_type {}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x} -// CHECK:STDOUT: %.loc10_16: type = struct_type {.a: i32} +// CHECK:STDOUT: %.loc10_16: type = struct_type {.a: i32}, const // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var // CHECK:STDOUT: %.loc10_21: {} = struct_literal () diff --git a/toolchain/check/testdata/struct/fail_assign_nested.carbon b/toolchain/check/testdata/struct/fail_assign_nested.carbon index b5409abcc6ad..fc788dafe147 100644 --- a/toolchain/check/testdata/struct/fail_assign_nested.carbon +++ b/toolchain/check/testdata/struct/fail_assign_nested.carbon @@ -12,17 +12,17 @@ var x: {.a: {}} = {.b = {}}; // CHECK:STDOUT: --- fail_assign_nested.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10_14.1: type = struct_type {} -// CHECK:STDOUT: %.loc10_14.2: type = tuple_type () -// CHECK:STDOUT: %.loc10_15: type = struct_type {.a: ()} -// CHECK:STDOUT: %.loc10_27: type = struct_type {.b: {}} +// CHECK:STDOUT: %.loc10_14.1: type = struct_type {}, const +// CHECK:STDOUT: %.loc10_14.2: type = tuple_type (), const +// CHECK:STDOUT: %.loc10_15: type = struct_type {.a: ()}, const +// CHECK:STDOUT: %.loc10_27: type = struct_type {.b: {}}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x} // CHECK:STDOUT: %.loc10_14.1: {} = struct_literal () // CHECK:STDOUT: %.loc10_14.2: type = converted %.loc10_14.1, constants.%.loc10_14.1 -// CHECK:STDOUT: %.loc10_15: type = struct_type {.a: {}} +// CHECK:STDOUT: %.loc10_15: type = struct_type {.a: {}}, const // CHECK:STDOUT: %x.var: ref {.a: {}} = var x // CHECK:STDOUT: %x: ref {.a: {}} = bind_name x, %x.var // CHECK:STDOUT: %.loc10_26: {} = struct_literal () diff --git a/toolchain/check/testdata/struct/fail_assign_to_empty.carbon b/toolchain/check/testdata/struct/fail_assign_to_empty.carbon index 70a790b94a44..36993e43861d 100644 --- a/toolchain/check/testdata/struct/fail_assign_to_empty.carbon +++ b/toolchain/check/testdata/struct/fail_assign_to_empty.carbon @@ -12,9 +12,10 @@ var x: {} = {.a = 1}; // CHECK:STDOUT: --- fail_assign_to_empty.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10_9.1: type = struct_type {} -// CHECK:STDOUT: %.loc10_9.2: type = tuple_type () -// CHECK:STDOUT: %.loc10_20: type = struct_type {.a: i32} +// CHECK:STDOUT: %.loc10_9.1: type = struct_type {}, const +// CHECK:STDOUT: %.loc10_9.2: type = tuple_type (), const +// CHECK:STDOUT: %.loc10_19: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc10_20: type = struct_type {.a: i32}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -23,7 +24,7 @@ var x: {} = {.a = 1}; // CHECK:STDOUT: %.loc10_9.2: type = converted %.loc10_9.1, constants.%.loc10_9.1 // CHECK:STDOUT: %x.var: ref {} = var x // CHECK:STDOUT: %x: ref {} = bind_name x, %x.var -// CHECK:STDOUT: %.loc10_19: i32 = int_literal 1 +// CHECK:STDOUT: %.loc10_19: i32 = int_literal 1, const = constants.%.loc10_19 // CHECK:STDOUT: %.loc10_20: {.a: i32} = struct_literal (%.loc10_19) // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_duplicate_name.carbon b/toolchain/check/testdata/struct/fail_duplicate_name.carbon index 029697e8cf2c..5b19af5fd2ef 100644 --- a/toolchain/check/testdata/struct/fail_duplicate_name.carbon +++ b/toolchain/check/testdata/struct/fail_duplicate_name.carbon @@ -47,30 +47,37 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: --- fail_duplicate_name.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc21: type = struct_type {.a: i32} -// CHECK:STDOUT: %.loc45: type = ptr_type {.b: i32, .c: i32} +// CHECK:STDOUT: %.loc21_35: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc21_36: type = struct_type {.a: i32}, const +// CHECK:STDOUT: %.loc29_22: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc29_32: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc37_26: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc37_34: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc45_25: type = ptr_type {.b: i32, .c: i32}, const +// CHECK:STDOUT: %.loc45_35: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc45_43: i32 = int_literal 4, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F, .x = %x, .y = %y} -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %.loc21_35: i32 = int_literal 1 +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %.loc21_35: i32 = int_literal 1, const = constants.%.loc21_35 // CHECK:STDOUT: %.loc21_36: {.a: i32} = struct_literal (%.loc21_35) // CHECK:STDOUT: %v: = bind_name v, -// CHECK:STDOUT: %.loc29_22: i32 = int_literal 1 -// CHECK:STDOUT: %.loc29_32: i32 = int_literal 2 +// CHECK:STDOUT: %.loc29_22: i32 = int_literal 1, const = constants.%.loc29_22 +// CHECK:STDOUT: %.loc29_32: i32 = int_literal 2, const = constants.%.loc29_32 // CHECK:STDOUT: %w: i32 = bind_name w, -// CHECK:STDOUT: %.loc37_16: type = struct_type {.a: i32} +// CHECK:STDOUT: %.loc37_16: type = struct_type {.a: i32}, const // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var -// CHECK:STDOUT: %.loc37_26: i32 = int_literal 1 -// CHECK:STDOUT: %.loc37_34: i32 = int_literal 2 +// CHECK:STDOUT: %.loc37_26: i32 = int_literal 1, const = constants.%.loc37_26 +// CHECK:STDOUT: %.loc37_34: i32 = int_literal 2, const = constants.%.loc37_34 // CHECK:STDOUT: assign %x.var, -// CHECK:STDOUT: %.loc45_25: type = struct_type {.b: i32, .c: i32} +// CHECK:STDOUT: %.loc45_25: type = struct_type {.b: i32, .c: i32}, const // CHECK:STDOUT: %y.var: ref {.b: i32, .c: i32} = var y // CHECK:STDOUT: %y: ref {.b: i32, .c: i32} = bind_name y, %y.var -// CHECK:STDOUT: %.loc45_35: i32 = int_literal 3 -// CHECK:STDOUT: %.loc45_43: i32 = int_literal 4 +// CHECK:STDOUT: %.loc45_35: i32 = int_literal 3, const = constants.%.loc45_35 +// CHECK:STDOUT: %.loc45_43: i32 = int_literal 4, const = constants.%.loc45_43 // CHECK:STDOUT: assign %y.var, // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon b/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon index 7ba47545eb09..707aefd99582 100644 --- a/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon +++ b/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon @@ -17,18 +17,19 @@ var y: {.b: i32} = x; // CHECK:STDOUT: --- fail_field_name_mismatch.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10: type = struct_type {.b: i32} +// CHECK:STDOUT: %.loc10_26: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc10_27: type = struct_type {.b: i32}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x, .y = %y} -// CHECK:STDOUT: %.loc10_16: type = struct_type {.a: i32} +// CHECK:STDOUT: %.loc10_16: type = struct_type {.a: i32}, const // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var -// CHECK:STDOUT: %.loc10_26: i32 = int_literal 1 +// CHECK:STDOUT: %.loc10_26: i32 = int_literal 1, const = constants.%.loc10_26 // CHECK:STDOUT: %.loc10_27: {.b: i32} = struct_literal (%.loc10_26) // CHECK:STDOUT: assign %x.var, -// CHECK:STDOUT: %.loc15: type = struct_type {.b: i32} +// CHECK:STDOUT: %.loc15: type = struct_type {.b: i32}, const // CHECK:STDOUT: %y.var: ref {.b: i32} = var y // CHECK:STDOUT: %y: ref {.b: i32} = bind_name y, %y.var // CHECK:STDOUT: %x.ref: ref {.a: i32} = name_ref x, %x diff --git a/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon b/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon index 99ed5a2f33b1..b59cdcbf5502 100644 --- a/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon +++ b/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon @@ -12,15 +12,16 @@ var x: {.a: i32} = {.b = 1.0}; // CHECK:STDOUT: --- fail_field_type_mismatch.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10: type = struct_type {.b: f64} +// CHECK:STDOUT: %.loc10_26: f64 = real_literal 10e-1, const +// CHECK:STDOUT: %.loc10_29: type = struct_type {.b: f64}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x} -// CHECK:STDOUT: %.loc10_16: type = struct_type {.a: i32} +// CHECK:STDOUT: %.loc10_16: type = struct_type {.a: i32}, const // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var -// CHECK:STDOUT: %.loc10_26: f64 = real_literal 10e-1 +// CHECK:STDOUT: %.loc10_26: f64 = real_literal 10e-1, const = constants.%.loc10_26 // CHECK:STDOUT: %.loc10_29: {.b: f64} = struct_literal (%.loc10_26) // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_member_access_type.carbon b/toolchain/check/testdata/struct/fail_member_access_type.carbon index de0b0fa67289..5109435995db 100644 --- a/toolchain/check/testdata/struct/fail_member_access_type.carbon +++ b/toolchain/check/testdata/struct/fail_member_access_type.carbon @@ -12,12 +12,16 @@ var y: i32 = x.b; // CHECK:STDOUT: --- fail_member_access_type.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc7: f64 = real_literal 40e-1, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x, .y = %y} -// CHECK:STDOUT: %.loc7_16: type = struct_type {.a: f64} +// CHECK:STDOUT: %.loc7_16: type = struct_type {.a: f64}, const // CHECK:STDOUT: %x.var: ref {.a: f64} = var x // CHECK:STDOUT: %x: ref {.a: f64} = bind_name x, %x.var -// CHECK:STDOUT: %.loc7_26: f64 = real_literal 40e-1 +// CHECK:STDOUT: %.loc7_26: f64 = real_literal 40e-1, const = constants.%.loc7 // CHECK:STDOUT: %.loc7_29.1: {.a: f64} = struct_literal (%.loc7_26) // CHECK:STDOUT: %.loc7_29.2: init {.a: f64} = struct_init (%.loc7_26) to %x.var // CHECK:STDOUT: %.loc7_29.3: init {.a: f64} = converted %.loc7_29.1, %.loc7_29.2 diff --git a/toolchain/check/testdata/struct/fail_member_of_function.carbon b/toolchain/check/testdata/struct/fail_member_of_function.carbon index d97ae1dd11c3..f1570a2394f5 100644 --- a/toolchain/check/testdata/struct/fail_member_of_function.carbon +++ b/toolchain/check/testdata/struct/fail_member_of_function.carbon @@ -15,12 +15,12 @@ fn A() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %A} -// CHECK:STDOUT: %A: = fn_decl @A +// CHECK:STDOUT: %A: = fn_decl @A, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%A +// CHECK:STDOUT: %A.ref: = name_ref A, file.%A, const = file.%A // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/fail_nested_incomplete.carbon b/toolchain/check/testdata/struct/fail_nested_incomplete.carbon index c1c1aebccbd3..f6fc8ac9792b 100644 --- a/toolchain/check/testdata/struct/fail_nested_incomplete.carbon +++ b/toolchain/check/testdata/struct/fail_nested_incomplete.carbon @@ -22,19 +22,19 @@ var p: Incomplete* = &s.a; // CHECK:STDOUT: --- fail_nested_incomplete.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc20: type = ptr_type +// CHECK:STDOUT: %.loc20: type = ptr_type , const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Incomplete = %Incomplete.decl, .s = %s, .p = %p} // CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () -// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete -// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete -// CHECK:STDOUT: %.loc15: type = struct_type {.a: Incomplete} +// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete, const +// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete, const = %Incomplete +// CHECK:STDOUT: %.loc15: type = struct_type {.a: Incomplete}, const // CHECK:STDOUT: %s.var: ref = var s // CHECK:STDOUT: %s: ref = bind_name s, %s.var -// CHECK:STDOUT: %Incomplete.ref.loc20: type = name_ref Incomplete, %Incomplete -// CHECK:STDOUT: %.loc20_18: type = ptr_type Incomplete +// CHECK:STDOUT: %Incomplete.ref.loc20: type = name_ref Incomplete, %Incomplete, const = %Incomplete +// CHECK:STDOUT: %.loc20_18: type = ptr_type Incomplete, const // CHECK:STDOUT: %p.var: ref Incomplete* = var p // CHECK:STDOUT: %p: ref Incomplete* = bind_name p, %p.var // CHECK:STDOUT: %s.ref: ref = name_ref s, %s diff --git a/toolchain/check/testdata/struct/fail_non_member_access.carbon b/toolchain/check/testdata/struct/fail_non_member_access.carbon index 1fd693b57e59..94be8ab0602a 100644 --- a/toolchain/check/testdata/struct/fail_non_member_access.carbon +++ b/toolchain/check/testdata/struct/fail_non_member_access.carbon @@ -12,12 +12,16 @@ var y: i32 = x.b; // CHECK:STDOUT: --- fail_non_member_access.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc7: i32 = int_literal 4, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x, .y = %y} -// CHECK:STDOUT: %.loc7_16: type = struct_type {.a: i32} +// CHECK:STDOUT: %.loc7_16: type = struct_type {.a: i32}, const // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 4 +// CHECK:STDOUT: %.loc7_26: i32 = int_literal 4, const = constants.%.loc7 // CHECK:STDOUT: %.loc7_27.1: {.a: i32} = struct_literal (%.loc7_26) // CHECK:STDOUT: %.loc7_27.2: init {.a: i32} = struct_init (%.loc7_26) to %x.var // CHECK:STDOUT: %.loc7_27.3: init {.a: i32} = converted %.loc7_27.1, %.loc7_27.2 diff --git a/toolchain/check/testdata/struct/fail_too_few_values.carbon b/toolchain/check/testdata/struct/fail_too_few_values.carbon index 1c9d5f330e9b..db9e7c66b242 100644 --- a/toolchain/check/testdata/struct/fail_too_few_values.carbon +++ b/toolchain/check/testdata/struct/fail_too_few_values.carbon @@ -12,16 +12,17 @@ var x: {.a: i32, .b: i32} = {.a = 1}; // CHECK:STDOUT: --- fail_too_few_values.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10_25: type = ptr_type {.a: i32, .b: i32} -// CHECK:STDOUT: %.loc10_36: type = struct_type {.a: i32} +// CHECK:STDOUT: %.loc10_25: type = ptr_type {.a: i32, .b: i32}, const +// CHECK:STDOUT: %.loc10_35: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc10_36: type = struct_type {.a: i32}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x} -// CHECK:STDOUT: %.loc10_25: type = struct_type {.a: i32, .b: i32} +// CHECK:STDOUT: %.loc10_25: type = struct_type {.a: i32, .b: i32}, const // CHECK:STDOUT: %x.var: ref {.a: i32, .b: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32, .b: i32} = bind_name x, %x.var -// CHECK:STDOUT: %.loc10_35: i32 = int_literal 1 +// CHECK:STDOUT: %.loc10_35: i32 = int_literal 1, const = constants.%.loc10_35 // CHECK:STDOUT: %.loc10_36: {.a: i32} = struct_literal (%.loc10_35) // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_type_assign.carbon b/toolchain/check/testdata/struct/fail_type_assign.carbon index e89021814647..057846e4f9bb 100644 --- a/toolchain/check/testdata/struct/fail_type_assign.carbon +++ b/toolchain/check/testdata/struct/fail_type_assign.carbon @@ -13,10 +13,10 @@ var x: {.a: i32} = {.a: i32}; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x} -// CHECK:STDOUT: %.loc10_16: type = struct_type {.a: i32} +// CHECK:STDOUT: %.loc10_16: type = struct_type {.a: i32}, const // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var -// CHECK:STDOUT: %.loc10_28: type = struct_type {.a: i32} +// CHECK:STDOUT: %.loc10_28: type = struct_type {.a: i32}, const // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/fail_value_as_type.carbon b/toolchain/check/testdata/struct/fail_value_as_type.carbon index 6882d160481e..0547b1a5895a 100644 --- a/toolchain/check/testdata/struct/fail_value_as_type.carbon +++ b/toolchain/check/testdata/struct/fail_value_as_type.carbon @@ -12,12 +12,13 @@ var x: {.a = 1}; // CHECK:STDOUT: --- fail_value_as_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10: type = struct_type {.a: i32} +// CHECK:STDOUT: %.loc10_14: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc10_15: type = struct_type {.a: i32}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x} -// CHECK:STDOUT: %.loc10_14: i32 = int_literal 1 +// CHECK:STDOUT: %.loc10_14: i32 = int_literal 1, const = constants.%.loc10_14 // CHECK:STDOUT: %.loc10_15: {.a: i32} = struct_literal (%.loc10_14) // CHECK:STDOUT: %x.var: ref = var x // CHECK:STDOUT: %x: ref = bind_name x, %x.var diff --git a/toolchain/check/testdata/struct/literal_member_access.carbon b/toolchain/check/testdata/struct/literal_member_access.carbon index 123e109775ae..1da7fd073a67 100644 --- a/toolchain/check/testdata/struct/literal_member_access.carbon +++ b/toolchain/check/testdata/struct/literal_member_access.carbon @@ -13,27 +13,29 @@ fn F() -> i32 { // CHECK:STDOUT: --- literal_member_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7: type = ptr_type {.x: i32, .y: i32, .z: i32} -// CHECK:STDOUT: %.loc10_35.1: type = struct_type {.a: i32, .b: {.x: i32, .y: i32, .z: i32}, .c: i32} -// CHECK:STDOUT: %.loc10_35.2: type = struct_type {.a: i32, .b: {.x: i32, .y: i32, .z: i32}*, .c: i32} -// CHECK:STDOUT: %.loc10_35.3: type = ptr_type {.a: i32, .b: {.x: i32, .y: i32, .z: i32}*, .c: i32} +// CHECK:STDOUT: %.loc7: type = ptr_type {.x: i32, .y: i32, .z: i32}, const +// CHECK:STDOUT: %.loc10_16: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc10_34: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc10_35.1: type = struct_type {.a: i32, .b: {.x: i32, .y: i32, .z: i32}, .c: i32}, const +// CHECK:STDOUT: %.loc10_35.2: type = struct_type {.a: i32, .b: {.x: i32, .y: i32, .z: i32}*, .c: i32}, const +// CHECK:STDOUT: %.loc10_35.3: type = ptr_type {.a: i32, .b: {.x: i32, .y: i32, .z: i32}*, .c: i32}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.G = %G, .F = %F} -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> %return: {.x: i32, .y: i32, .z: i32}; // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_16: i32 = int_literal 1 -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G +// CHECK:STDOUT: %.loc10_16: i32 = int_literal 1, const = constants.%.loc10_16 +// CHECK:STDOUT: %G.ref: = name_ref G, file.%G, const = file.%G // CHECK:STDOUT: %.loc10_25.1: ref {.x: i32, .y: i32, .z: i32} = temporary_storage // CHECK:STDOUT: %.loc10_25.2: init {.x: i32, .y: i32, .z: i32} = call %G.ref() to %.loc10_25.1 -// CHECK:STDOUT: %.loc10_34: i32 = int_literal 3 +// CHECK:STDOUT: %.loc10_34: i32 = int_literal 3, const = constants.%.loc10_34 // CHECK:STDOUT: %.loc10_35.1: {.a: i32, .b: {.x: i32, .y: i32, .z: i32}, .c: i32} = struct_literal (%.loc10_16, %.loc10_25.2, %.loc10_34) // CHECK:STDOUT: %.loc10_25.3: ref {.x: i32, .y: i32, .z: i32} = temporary %.loc10_25.1, %.loc10_25.2 // CHECK:STDOUT: %.loc10_25.4: ref i32 = struct_access %.loc10_25.3, element0 diff --git a/toolchain/check/testdata/struct/member_access.carbon b/toolchain/check/testdata/struct/member_access.carbon index 56e0e6ba4ac6..008247e97edb 100644 --- a/toolchain/check/testdata/struct/member_access.carbon +++ b/toolchain/check/testdata/struct/member_access.carbon @@ -11,16 +11,18 @@ var z: i32 = y; // CHECK:STDOUT: --- member_access.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7: type = ptr_type {.a: f64, .b: i32} +// CHECK:STDOUT: %.loc7_25: type = ptr_type {.a: f64, .b: i32}, const +// CHECK:STDOUT: %.loc7_35: f64 = real_literal 0e-1, const +// CHECK:STDOUT: %.loc7_45: i32 = int_literal 1, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x, .y = %y, .z = %z} -// CHECK:STDOUT: %.loc7_25: type = struct_type {.a: f64, .b: i32} +// CHECK:STDOUT: %.loc7_25: type = struct_type {.a: f64, .b: i32}, const // CHECK:STDOUT: %x.var: ref {.a: f64, .b: i32} = var x // CHECK:STDOUT: %x: ref {.a: f64, .b: i32} = bind_name x, %x.var -// CHECK:STDOUT: %.loc7_35: f64 = real_literal 0e-1 -// CHECK:STDOUT: %.loc7_45: i32 = int_literal 1 +// CHECK:STDOUT: %.loc7_35: f64 = real_literal 0e-1, const = constants.%.loc7_35 +// CHECK:STDOUT: %.loc7_45: i32 = int_literal 1, const = constants.%.loc7_45 // CHECK:STDOUT: %.loc7_46.1: {.a: f64, .b: i32} = struct_literal (%.loc7_35, %.loc7_45) // CHECK:STDOUT: %.loc7_46.2: ref f64 = struct_access %x.var, element0 // CHECK:STDOUT: %.loc7_46.3: init f64 = initialize_from %.loc7_35 to %.loc7_46.2 diff --git a/toolchain/check/testdata/struct/nested_struct_in_place.carbon b/toolchain/check/testdata/struct/nested_struct_in_place.carbon index 64e891d88ac8..7868e7d70e38 100644 --- a/toolchain/check/testdata/struct/nested_struct_in_place.carbon +++ b/toolchain/check/testdata/struct/nested_struct_in_place.carbon @@ -13,17 +13,17 @@ fn G() { // CHECK:STDOUT: --- nested_struct_in_place.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_25.1: type = tuple_type (type, type, type) -// CHECK:STDOUT: %.loc7_25.2: type = tuple_type (i32, i32, i32) -// CHECK:STDOUT: %.loc7_25.3: type = ptr_type (i32, i32, i32) -// CHECK:STDOUT: %.loc10_51.1: type = struct_type {.a: (i32, i32, i32)*, .b: (i32, i32, i32)*} -// CHECK:STDOUT: %.loc10_51.2: type = ptr_type {.a: (i32, i32, i32)*, .b: (i32, i32, i32)*} +// CHECK:STDOUT: %.loc7_25.1: type = tuple_type (type, type, type), const +// CHECK:STDOUT: %.loc7_25.2: type = tuple_type (i32, i32, i32), const +// CHECK:STDOUT: %.loc7_25.3: type = ptr_type (i32, i32, i32), const +// CHECK:STDOUT: %.loc10_51.1: type = struct_type {.a: (i32, i32, i32)*, .b: (i32, i32, i32)*}, const +// CHECK:STDOUT: %.loc10_51.2: type = ptr_type {.a: (i32, i32, i32)*, .b: (i32, i32, i32)*}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F, .G = %G} -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %return: (i32, i32, i32); @@ -34,13 +34,13 @@ fn G() { // CHECK:STDOUT: %.loc7_25.1: type = converted %.loc10_29, constants.%.loc7_25.2 // CHECK:STDOUT: %.loc10_50: (type, type, type) = tuple_literal (i32, i32, i32) // CHECK:STDOUT: %.loc7_25.2: type = converted %.loc10_50, constants.%.loc7_25.2 -// CHECK:STDOUT: %.loc10_51: type = struct_type {.a: (i32, i32, i32), .b: (i32, i32, i32)} +// CHECK:STDOUT: %.loc10_51: type = struct_type {.a: (i32, i32, i32), .b: (i32, i32, i32)}, const // CHECK:STDOUT: %v.var: ref {.a: (i32, i32, i32), .b: (i32, i32, i32)} = var v // CHECK:STDOUT: %v: ref {.a: (i32, i32, i32), .b: (i32, i32, i32)} = bind_name v, %v.var -// CHECK:STDOUT: %F.ref.loc10_61: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref.loc10_61: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc10_74.1: ref (i32, i32, i32) = struct_access %v.var, element0 // CHECK:STDOUT: %.loc10_62: init (i32, i32, i32) = call %F.ref.loc10_61() to %.loc10_74.1 -// CHECK:STDOUT: %F.ref.loc10_71: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref.loc10_71: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc10_74.2: ref (i32, i32, i32) = struct_access %v.var, element1 // CHECK:STDOUT: %.loc10_72: init (i32, i32, i32) = call %F.ref.loc10_71() to %.loc10_74.2 // CHECK:STDOUT: %.loc10_74.3: {.a: (i32, i32, i32), .b: (i32, i32, i32)} = struct_literal (%.loc10_62, %.loc10_72) diff --git a/toolchain/check/testdata/struct/one_entry.carbon b/toolchain/check/testdata/struct/one_entry.carbon index c9d4a1c1e2c2..8035a6ccd89e 100644 --- a/toolchain/check/testdata/struct/one_entry.carbon +++ b/toolchain/check/testdata/struct/one_entry.carbon @@ -9,17 +9,21 @@ var y: {.a: i32} = x; // CHECK:STDOUT: --- one_entry.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc7: i32 = int_literal 4, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x, .y = %y} -// CHECK:STDOUT: %.loc7_16: type = struct_type {.a: i32} +// CHECK:STDOUT: %.loc7_16: type = struct_type {.a: i32}, const // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 4 +// CHECK:STDOUT: %.loc7_26: i32 = int_literal 4, const = constants.%.loc7 // CHECK:STDOUT: %.loc7_27.1: {.a: i32} = struct_literal (%.loc7_26) // CHECK:STDOUT: %.loc7_27.2: init {.a: i32} = struct_init (%.loc7_26) to %x.var // CHECK:STDOUT: %.loc7_27.3: init {.a: i32} = converted %.loc7_27.1, %.loc7_27.2 // CHECK:STDOUT: assign %x.var, %.loc7_27.3 -// CHECK:STDOUT: %.loc8_16: type = struct_type {.a: i32} +// CHECK:STDOUT: %.loc8_16: type = struct_type {.a: i32}, const // CHECK:STDOUT: %y.var: ref {.a: i32} = var y // CHECK:STDOUT: %y: ref {.a: i32} = bind_name y, %y.var // CHECK:STDOUT: %x.ref: ref {.a: i32} = name_ref x, %x diff --git a/toolchain/check/testdata/struct/reorder_fields.carbon b/toolchain/check/testdata/struct/reorder_fields.carbon index 70164400e1aa..a7588ce51cc4 100644 --- a/toolchain/check/testdata/struct/reorder_fields.carbon +++ b/toolchain/check/testdata/struct/reorder_fields.carbon @@ -16,16 +16,16 @@ fn F() -> {.a: i32, .b: f64} { // CHECK:STDOUT: --- reorder_fields.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10: type = ptr_type {.a: i32, .b: f64} -// CHECK:STDOUT: %.loc11_62.1: type = struct_type {.b: f64, .a: i32} -// CHECK:STDOUT: %.loc11_62.2: type = ptr_type {.b: f64, .a: i32} +// CHECK:STDOUT: %.loc10: type = ptr_type {.a: i32, .b: f64}, const +// CHECK:STDOUT: %.loc11_62.1: type = struct_type {.b: f64, .a: i32}, const +// CHECK:STDOUT: %.loc11_62.2: type = ptr_type {.b: f64, .a: i32}, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.MakeI32 = %MakeI32, .MakeF64 = %MakeF64, .F = %F} -// CHECK:STDOUT: %MakeI32: = fn_decl @MakeI32 -// CHECK:STDOUT: %MakeF64: = fn_decl @MakeF64 -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %MakeI32: = fn_decl @MakeI32, const +// CHECK:STDOUT: %MakeF64: = fn_decl @MakeF64, const +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @MakeI32() -> i32; @@ -34,10 +34,10 @@ fn F() -> {.a: i32, .b: f64} { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %return: {.a: i32, .b: f64} { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_27: type = struct_type {.a: i32, .b: f64} -// CHECK:STDOUT: %MakeF64.ref: = name_ref MakeF64, file.%MakeF64 +// CHECK:STDOUT: %.loc11_27: type = struct_type {.a: i32, .b: f64}, const +// CHECK:STDOUT: %MakeF64.ref: = name_ref MakeF64, file.%MakeF64, const = file.%MakeF64 // CHECK:STDOUT: %.loc11_44: init f64 = call %MakeF64.ref() -// CHECK:STDOUT: %MakeI32.ref: = name_ref MakeI32, file.%MakeI32 +// CHECK:STDOUT: %MakeI32.ref: = name_ref MakeI32, file.%MakeI32, const = file.%MakeI32 // CHECK:STDOUT: %.loc11_60: init i32 = call %MakeI32.ref() // CHECK:STDOUT: %.loc11_62.1: {.b: f64, .a: i32} = struct_literal (%.loc11_44, %.loc11_60) // CHECK:STDOUT: %.loc11_62.2: i32 = value_of_initializer %.loc11_60 @@ -47,7 +47,7 @@ fn F() -> {.a: i32, .b: f64} { // CHECK:STDOUT: %.loc11_62.6: {.a: i32, .b: f64} = struct_value (%.loc11_62.3, %.loc11_62.5) // CHECK:STDOUT: %.loc11_62.7: {.a: i32, .b: f64} = converted %.loc11_62.1, %.loc11_62.6 // CHECK:STDOUT: %x: {.a: i32, .b: f64} = bind_name x, %.loc11_62.7 -// CHECK:STDOUT: %.loc12_27: type = struct_type {.b: f64, .a: i32} +// CHECK:STDOUT: %.loc12_27: type = struct_type {.b: f64, .a: i32}, const // CHECK:STDOUT: %x.ref: {.a: i32, .b: f64} = name_ref x, %x // CHECK:STDOUT: %.loc12_31.1: f64 = struct_access %x.ref, element1 // CHECK:STDOUT: %.loc12_31.2: i32 = struct_access %x.ref, element0 diff --git a/toolchain/check/testdata/struct/tuple_as_element.carbon b/toolchain/check/testdata/struct/tuple_as_element.carbon index 7a81db00c214..27c30d6687f2 100644 --- a/toolchain/check/testdata/struct/tuple_as_element.carbon +++ b/toolchain/check/testdata/struct/tuple_as_element.carbon @@ -10,20 +10,22 @@ var y: {.a: i32, .b: (i32,)} = x; // CHECK:STDOUT: --- tuple_as_element.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_27.1: type = tuple_type (type) -// CHECK:STDOUT: %.loc7_27.2: type = tuple_type (i32) -// CHECK:STDOUT: %.loc7_28: type = ptr_type {.a: i32, .b: (i32,)} +// CHECK:STDOUT: %.loc7_27.1: type = tuple_type (type), const +// CHECK:STDOUT: %.loc7_27.2: type = tuple_type (i32), const +// CHECK:STDOUT: %.loc7_28: type = ptr_type {.a: i32, .b: (i32,)}, const +// CHECK:STDOUT: %.loc7_38: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc7_47: i32 = int_literal 2, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x, .y = %y} // CHECK:STDOUT: %.loc7_27.1: (type,) = tuple_literal (i32) // CHECK:STDOUT: %.loc7_27.2: type = converted %.loc7_27.1, constants.%.loc7_27.2 -// CHECK:STDOUT: %.loc7_28: type = struct_type {.a: i32, .b: (i32,)} +// CHECK:STDOUT: %.loc7_28: type = struct_type {.a: i32, .b: (i32,)}, const // CHECK:STDOUT: %x.var: ref {.a: i32, .b: (i32,)} = var x // CHECK:STDOUT: %x: ref {.a: i32, .b: (i32,)} = bind_name x, %x.var -// CHECK:STDOUT: %.loc7_38: i32 = int_literal 1 -// CHECK:STDOUT: %.loc7_47: i32 = int_literal 2 +// CHECK:STDOUT: %.loc7_38: i32 = int_literal 1, const = constants.%.loc7_38 +// CHECK:STDOUT: %.loc7_47: i32 = int_literal 2, const = constants.%.loc7_47 // CHECK:STDOUT: %.loc7_49.1: (i32,) = tuple_literal (%.loc7_47) // CHECK:STDOUT: %.loc7_50.1: {.a: i32, .b: (i32,)} = struct_literal (%.loc7_38, %.loc7_49.1) // CHECK:STDOUT: %.loc7_50.2: ref i32 = struct_access %x.var, element0 @@ -37,7 +39,7 @@ var y: {.a: i32, .b: (i32,)} = x; // CHECK:STDOUT: assign %x.var, %.loc7_50.7 // CHECK:STDOUT: %.loc8_27: (type,) = tuple_literal (i32) // CHECK:STDOUT: %.loc7_27.3: type = converted %.loc8_27, constants.%.loc7_27.2 -// CHECK:STDOUT: %.loc8_28: type = struct_type {.a: i32, .b: (i32,)} +// CHECK:STDOUT: %.loc8_28: type = struct_type {.a: i32, .b: (i32,)}, const // CHECK:STDOUT: %y.var: ref {.a: i32, .b: (i32,)} = var y // CHECK:STDOUT: %y: ref {.a: i32, .b: (i32,)} = bind_name y, %y.var // CHECK:STDOUT: %x.ref: ref {.a: i32, .b: (i32,)} = name_ref x, %x diff --git a/toolchain/check/testdata/struct/two_entries.carbon b/toolchain/check/testdata/struct/two_entries.carbon index 24078283f4d5..ed8ba974bae1 100644 --- a/toolchain/check/testdata/struct/two_entries.carbon +++ b/toolchain/check/testdata/struct/two_entries.carbon @@ -10,16 +10,18 @@ var y: {.a: i32, .b: i32} = x; // CHECK:STDOUT: --- two_entries.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7: type = ptr_type {.a: i32, .b: i32} +// CHECK:STDOUT: %.loc7_25: type = ptr_type {.a: i32, .b: i32}, const +// CHECK:STDOUT: %.loc7_35: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc7_43: i32 = int_literal 2, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x, .y = %y} -// CHECK:STDOUT: %.loc7_25: type = struct_type {.a: i32, .b: i32} +// CHECK:STDOUT: %.loc7_25: type = struct_type {.a: i32, .b: i32}, const // CHECK:STDOUT: %x.var: ref {.a: i32, .b: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32, .b: i32} = bind_name x, %x.var -// CHECK:STDOUT: %.loc7_35: i32 = int_literal 1 -// CHECK:STDOUT: %.loc7_43: i32 = int_literal 2 +// CHECK:STDOUT: %.loc7_35: i32 = int_literal 1, const = constants.%.loc7_35 +// CHECK:STDOUT: %.loc7_43: i32 = int_literal 2, const = constants.%.loc7_43 // CHECK:STDOUT: %.loc7_44.1: {.a: i32, .b: i32} = struct_literal (%.loc7_35, %.loc7_43) // CHECK:STDOUT: %.loc7_44.2: ref i32 = struct_access %x.var, element0 // CHECK:STDOUT: %.loc7_44.3: init i32 = initialize_from %.loc7_35 to %.loc7_44.2 @@ -28,7 +30,7 @@ var y: {.a: i32, .b: i32} = x; // CHECK:STDOUT: %.loc7_44.6: init {.a: i32, .b: i32} = struct_init (%.loc7_44.3, %.loc7_44.5) to %x.var // CHECK:STDOUT: %.loc7_44.7: init {.a: i32, .b: i32} = converted %.loc7_44.1, %.loc7_44.6 // CHECK:STDOUT: assign %x.var, %.loc7_44.7 -// CHECK:STDOUT: %.loc8_25: type = struct_type {.a: i32, .b: i32} +// CHECK:STDOUT: %.loc8_25: type = struct_type {.a: i32, .b: i32}, const // CHECK:STDOUT: %y.var: ref {.a: i32, .b: i32} = var y // CHECK:STDOUT: %y: ref {.a: i32, .b: i32} = bind_name y, %y.var // CHECK:STDOUT: %x.ref: ref {.a: i32, .b: i32} = name_ref x, %x diff --git a/toolchain/check/testdata/tuples/empty.carbon b/toolchain/check/testdata/tuples/empty.carbon index 368209511b75..5b0f62fdf94f 100644 --- a/toolchain/check/testdata/tuples/empty.carbon +++ b/toolchain/check/testdata/tuples/empty.carbon @@ -10,7 +10,7 @@ var y: () = x; // CHECK:STDOUT: --- empty.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7: type = tuple_type () +// CHECK:STDOUT: %.loc7: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { diff --git a/toolchain/check/testdata/tuples/fail_assign_empty.carbon b/toolchain/check/testdata/tuples/fail_assign_empty.carbon index 3f8a9f1aad67..c7fa58bf2109 100644 --- a/toolchain/check/testdata/tuples/fail_assign_empty.carbon +++ b/toolchain/check/testdata/tuples/fail_assign_empty.carbon @@ -12,9 +12,9 @@ var x: (i32,) = (); // CHECK:STDOUT: --- fail_assign_empty.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10_13.1: type = tuple_type (type) -// CHECK:STDOUT: %.loc10_13.2: type = tuple_type (i32) -// CHECK:STDOUT: %.loc10_18: type = tuple_type () +// CHECK:STDOUT: %.loc10_13.1: type = tuple_type (type), const +// CHECK:STDOUT: %.loc10_13.2: type = tuple_type (i32), const +// CHECK:STDOUT: %.loc10_18: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { diff --git a/toolchain/check/testdata/tuples/fail_assign_nested.carbon b/toolchain/check/testdata/tuples/fail_assign_nested.carbon index 1fca25c0b938..b3cd0ab9a6d1 100644 --- a/toolchain/check/testdata/tuples/fail_assign_nested.carbon +++ b/toolchain/check/testdata/tuples/fail_assign_nested.carbon @@ -12,15 +12,21 @@ var x: ((i32, i32), (i32, i32)) = ((1, 2, 3), (4, 5, 6)); // CHECK:STDOUT: --- fail_assign_nested.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10_18: type = tuple_type (type, type) -// CHECK:STDOUT: %.loc10_31.1: type = tuple_type ((type, type), (type, type)) -// CHECK:STDOUT: %.loc10_31.2: type = tuple_type (i32, i32) -// CHECK:STDOUT: %.loc10_31.3: type = tuple_type ((i32, i32), (i32, i32)) -// CHECK:STDOUT: %.loc10_31.4: type = ptr_type (i32, i32) -// CHECK:STDOUT: %.loc10_31.5: type = tuple_type ((i32, i32)*, (i32, i32)*) -// CHECK:STDOUT: %.loc10_31.6: type = ptr_type ((i32, i32)*, (i32, i32)*) -// CHECK:STDOUT: %.loc10_44: type = tuple_type (i32, i32, i32) -// CHECK:STDOUT: %.loc10_56: type = tuple_type ((i32, i32, i32), (i32, i32, i32)) +// CHECK:STDOUT: %.loc10_18: type = tuple_type (type, type), const +// CHECK:STDOUT: %.loc10_31.1: type = tuple_type ((type, type), (type, type)), const +// CHECK:STDOUT: %.loc10_31.2: type = tuple_type (i32, i32), const +// CHECK:STDOUT: %.loc10_31.3: type = tuple_type ((i32, i32), (i32, i32)), const +// CHECK:STDOUT: %.loc10_31.4: type = ptr_type (i32, i32), const +// CHECK:STDOUT: %.loc10_31.5: type = tuple_type ((i32, i32)*, (i32, i32)*), const +// CHECK:STDOUT: %.loc10_31.6: type = ptr_type ((i32, i32)*, (i32, i32)*), const +// CHECK:STDOUT: %.loc10_37: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc10_40: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc10_43: i32 = int_literal 3, const +// CHECK:STDOUT: %.loc10_44: type = tuple_type (i32, i32, i32), const +// CHECK:STDOUT: %.loc10_48: i32 = int_literal 4, const +// CHECK:STDOUT: %.loc10_51: i32 = int_literal 5, const +// CHECK:STDOUT: %.loc10_54: i32 = int_literal 6, const +// CHECK:STDOUT: %.loc10_56: type = tuple_type ((i32, i32, i32), (i32, i32, i32)), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -33,13 +39,13 @@ var x: ((i32, i32), (i32, i32)) = ((1, 2, 3), (4, 5, 6)); // CHECK:STDOUT: %.loc10_31.4: type = converted %.loc10_31.1, constants.%.loc10_31.3 // CHECK:STDOUT: %x.var: ref ((i32, i32), (i32, i32)) = var x // CHECK:STDOUT: %x: ref ((i32, i32), (i32, i32)) = bind_name x, %x.var -// CHECK:STDOUT: %.loc10_37: i32 = int_literal 1 -// CHECK:STDOUT: %.loc10_40: i32 = int_literal 2 -// CHECK:STDOUT: %.loc10_43: i32 = int_literal 3 +// CHECK:STDOUT: %.loc10_37: i32 = int_literal 1, const = constants.%.loc10_37 +// CHECK:STDOUT: %.loc10_40: i32 = int_literal 2, const = constants.%.loc10_40 +// CHECK:STDOUT: %.loc10_43: i32 = int_literal 3, const = constants.%.loc10_43 // CHECK:STDOUT: %.loc10_44: (i32, i32, i32) = tuple_literal (%.loc10_37, %.loc10_40, %.loc10_43) -// CHECK:STDOUT: %.loc10_48: i32 = int_literal 4 -// CHECK:STDOUT: %.loc10_51: i32 = int_literal 5 -// CHECK:STDOUT: %.loc10_54: i32 = int_literal 6 +// CHECK:STDOUT: %.loc10_48: i32 = int_literal 4, const = constants.%.loc10_48 +// CHECK:STDOUT: %.loc10_51: i32 = int_literal 5, const = constants.%.loc10_51 +// CHECK:STDOUT: %.loc10_54: i32 = int_literal 6, const = constants.%.loc10_54 // CHECK:STDOUT: %.loc10_55: (i32, i32, i32) = tuple_literal (%.loc10_48, %.loc10_51, %.loc10_54) // CHECK:STDOUT: %.loc10_56: ((i32, i32, i32), (i32, i32, i32)) = tuple_literal (%.loc10_44, %.loc10_55) // CHECK:STDOUT: assign %x.var, diff --git a/toolchain/check/testdata/tuples/fail_assign_to_empty.carbon b/toolchain/check/testdata/tuples/fail_assign_to_empty.carbon index 69947cfba51f..502b1d639f6d 100644 --- a/toolchain/check/testdata/tuples/fail_assign_to_empty.carbon +++ b/toolchain/check/testdata/tuples/fail_assign_to_empty.carbon @@ -12,16 +12,17 @@ var x: () = (66); // CHECK:STDOUT: --- fail_assign_to_empty.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10: type = tuple_type () +// CHECK:STDOUT: %.loc10_9: type = tuple_type (), const +// CHECK:STDOUT: %.loc10_14: i32 = int_literal 66, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x} // CHECK:STDOUT: %.loc10_9.1: () = tuple_literal () -// CHECK:STDOUT: %.loc10_9.2: type = converted %.loc10_9.1, constants.%.loc10 +// CHECK:STDOUT: %.loc10_9.2: type = converted %.loc10_9.1, constants.%.loc10_9 // CHECK:STDOUT: %x.var: ref () = var x // CHECK:STDOUT: %x: ref () = bind_name x, %x.var -// CHECK:STDOUT: %.loc10_14: i32 = int_literal 66 +// CHECK:STDOUT: %.loc10_14: i32 = int_literal 66, const = constants.%.loc10_14 // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/tuples/fail_element_type_mismatch.carbon b/toolchain/check/testdata/tuples/fail_element_type_mismatch.carbon index 21f9b2f5d8ff..cd9678c05d4a 100644 --- a/toolchain/check/testdata/tuples/fail_element_type_mismatch.carbon +++ b/toolchain/check/testdata/tuples/fail_element_type_mismatch.carbon @@ -12,10 +12,12 @@ var x: (i32, i32) = (2, 65.89); // CHECK:STDOUT: --- fail_element_type_mismatch.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10_17.1: type = tuple_type (type, type) -// CHECK:STDOUT: %.loc10_17.2: type = tuple_type (i32, i32) -// CHECK:STDOUT: %.loc10_17.3: type = ptr_type (i32, i32) -// CHECK:STDOUT: %.loc10_30: type = tuple_type (i32, f64) +// CHECK:STDOUT: %.loc10_17.1: type = tuple_type (type, type), const +// CHECK:STDOUT: %.loc10_17.2: type = tuple_type (i32, i32), const +// CHECK:STDOUT: %.loc10_17.3: type = ptr_type (i32, i32), const +// CHECK:STDOUT: %.loc10_22: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc10_25: f64 = real_literal 6589e-2, const +// CHECK:STDOUT: %.loc10_30: type = tuple_type (i32, f64), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -24,8 +26,8 @@ var x: (i32, i32) = (2, 65.89); // CHECK:STDOUT: %.loc10_17.2: type = converted %.loc10_17.1, constants.%.loc10_17.2 // CHECK:STDOUT: %x.var: ref (i32, i32) = var x // CHECK:STDOUT: %x: ref (i32, i32) = bind_name x, %x.var -// CHECK:STDOUT: %.loc10_22: i32 = int_literal 2 -// CHECK:STDOUT: %.loc10_25: f64 = real_literal 6589e-2 +// CHECK:STDOUT: %.loc10_22: i32 = int_literal 2, const = constants.%.loc10_22 +// CHECK:STDOUT: %.loc10_25: f64 = real_literal 6589e-2, const = constants.%.loc10_25 // CHECK:STDOUT: %.loc10_30.1: (i32, f64) = tuple_literal (%.loc10_22, %.loc10_25) // CHECK:STDOUT: %.loc10_30.2: ref i32 = tuple_access %x.var, element0 // CHECK:STDOUT: %.loc10_30.3: init i32 = initialize_from %.loc10_22 to %.loc10_30.2 diff --git a/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon b/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon index 019a48f842ce..363f838b6a16 100644 --- a/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon +++ b/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon @@ -22,26 +22,27 @@ var p: Incomplete* = &t[1]; // CHECK:STDOUT: --- fail_nested_incomplete.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc15_24.1: type = tuple_type (type, type) -// CHECK:STDOUT: %.loc15_24.2: type = tuple_type (i32, Incomplete) -// CHECK:STDOUT: %.loc20: type = ptr_type +// CHECK:STDOUT: %.loc15_24.1: type = tuple_type (type, type), const +// CHECK:STDOUT: %.loc15_24.2: type = tuple_type (i32, Incomplete), const +// CHECK:STDOUT: %.loc20_25: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc20_22: type = ptr_type , const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Incomplete = %Incomplete.decl, .t = %t, .p = %p} // CHECK:STDOUT: %Incomplete.decl = class_decl @Incomplete, () -// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete -// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete +// CHECK:STDOUT: %Incomplete: type = class_type @Incomplete, const +// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete, const = %Incomplete // CHECK:STDOUT: %.loc15_24.1: (type, type) = tuple_literal (i32, %Incomplete.ref.loc15) // CHECK:STDOUT: %.loc15_24.2: type = converted %.loc15_24.1, constants.%.loc15_24.2 // CHECK:STDOUT: %t.var: ref = var t // CHECK:STDOUT: %t: ref = bind_name t, %t.var -// CHECK:STDOUT: %Incomplete.ref.loc20: type = name_ref Incomplete, %Incomplete -// CHECK:STDOUT: %.loc20_18: type = ptr_type Incomplete +// CHECK:STDOUT: %Incomplete.ref.loc20: type = name_ref Incomplete, %Incomplete, const = %Incomplete +// CHECK:STDOUT: %.loc20_18: type = ptr_type Incomplete, const // CHECK:STDOUT: %p.var: ref Incomplete* = var p // CHECK:STDOUT: %p: ref Incomplete* = bind_name p, %p.var // CHECK:STDOUT: %t.ref: ref = name_ref t, %t -// CHECK:STDOUT: %.loc20_25: i32 = int_literal 1 +// CHECK:STDOUT: %.loc20_25: i32 = int_literal 1, const = constants.%.loc20_25 // CHECK:STDOUT: %.loc20_22: * = addr_of // CHECK:STDOUT: assign %p.var, // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuples/fail_too_few_element.carbon b/toolchain/check/testdata/tuples/fail_too_few_element.carbon index 59ed40e7bc56..58764be75f68 100644 --- a/toolchain/check/testdata/tuples/fail_too_few_element.carbon +++ b/toolchain/check/testdata/tuples/fail_too_few_element.carbon @@ -12,10 +12,11 @@ var x: (i32, i32) = (2, ); // CHECK:STDOUT: --- fail_too_few_element.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10_17.1: type = tuple_type (type, type) -// CHECK:STDOUT: %.loc10_17.2: type = tuple_type (i32, i32) -// CHECK:STDOUT: %.loc10_17.3: type = ptr_type (i32, i32) -// CHECK:STDOUT: %.loc10_25: type = tuple_type (i32) +// CHECK:STDOUT: %.loc10_17.1: type = tuple_type (type, type), const +// CHECK:STDOUT: %.loc10_17.2: type = tuple_type (i32, i32), const +// CHECK:STDOUT: %.loc10_17.3: type = ptr_type (i32, i32), const +// CHECK:STDOUT: %.loc10_22: i32 = int_literal 2, const +// CHECK:STDOUT: %.loc10_25: type = tuple_type (i32), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -24,7 +25,7 @@ var x: (i32, i32) = (2, ); // CHECK:STDOUT: %.loc10_17.2: type = converted %.loc10_17.1, constants.%.loc10_17.2 // CHECK:STDOUT: %x.var: ref (i32, i32) = var x // CHECK:STDOUT: %x: ref (i32, i32) = bind_name x, %x.var -// CHECK:STDOUT: %.loc10_22: i32 = int_literal 2 +// CHECK:STDOUT: %.loc10_22: i32 = int_literal 2, const = constants.%.loc10_22 // CHECK:STDOUT: %.loc10_25: (i32,) = tuple_literal (%.loc10_22) // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuples/fail_type_assign.carbon b/toolchain/check/testdata/tuples/fail_type_assign.carbon index 2dd4c3067a09..db4bc008756f 100644 --- a/toolchain/check/testdata/tuples/fail_type_assign.carbon +++ b/toolchain/check/testdata/tuples/fail_type_assign.carbon @@ -12,8 +12,8 @@ var x: (i32, ) = (i32, ); // CHECK:STDOUT: --- fail_type_assign.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10_14.1: type = tuple_type (type) -// CHECK:STDOUT: %.loc10_14.2: type = tuple_type (i32) +// CHECK:STDOUT: %.loc10_14.1: type = tuple_type (type), const +// CHECK:STDOUT: %.loc10_14.2: type = tuple_type (i32), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { diff --git a/toolchain/check/testdata/tuples/fail_value_as_type.carbon b/toolchain/check/testdata/tuples/fail_value_as_type.carbon index 9c3540a9c4fa..f219b65376ba 100644 --- a/toolchain/check/testdata/tuples/fail_value_as_type.carbon +++ b/toolchain/check/testdata/tuples/fail_value_as_type.carbon @@ -12,13 +12,14 @@ var x: (1, ); // CHECK:STDOUT: --- fail_value_as_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc10_12.1: type = tuple_type (i32) -// CHECK:STDOUT: %.loc10_12.2: type = tuple_type () +// CHECK:STDOUT: %.loc10_9: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc10_12.1: type = tuple_type (i32), const +// CHECK:STDOUT: %.loc10_12.2: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x} -// CHECK:STDOUT: %.loc10_9: i32 = int_literal 1 +// CHECK:STDOUT: %.loc10_9: i32 = int_literal 1, const = constants.%.loc10_9 // CHECK:STDOUT: %.loc10_12.1: (i32,) = tuple_literal (%.loc10_9) // CHECK:STDOUT: %.loc10_12.2: type = converted %.loc10_12.1, constants.%.loc10_12.2 // CHECK:STDOUT: %x.var: ref (,) = var x diff --git a/toolchain/check/testdata/tuples/nested_tuple.carbon b/toolchain/check/testdata/tuples/nested_tuple.carbon index e0eb204f4898..31459bfbc9f6 100644 --- a/toolchain/check/testdata/tuples/nested_tuple.carbon +++ b/toolchain/check/testdata/tuples/nested_tuple.carbon @@ -9,13 +9,16 @@ var x: ((i32, i32), i32) = ((12, 76), 6); // CHECK:STDOUT: --- nested_tuple.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_18: type = tuple_type (type, type) -// CHECK:STDOUT: %.loc7_24.1: type = tuple_type ((type, type), type) -// CHECK:STDOUT: %.loc7_24.2: type = tuple_type (i32, i32) -// CHECK:STDOUT: %.loc7_24.3: type = tuple_type ((i32, i32), i32) -// CHECK:STDOUT: %.loc7_24.4: type = ptr_type (i32, i32) -// CHECK:STDOUT: %.loc7_24.5: type = tuple_type ((i32, i32)*, i32) -// CHECK:STDOUT: %.loc7_24.6: type = ptr_type ((i32, i32)*, i32) +// CHECK:STDOUT: %.loc7_18: type = tuple_type (type, type), const +// CHECK:STDOUT: %.loc7_24.1: type = tuple_type ((type, type), type), const +// CHECK:STDOUT: %.loc7_24.2: type = tuple_type (i32, i32), const +// CHECK:STDOUT: %.loc7_24.3: type = tuple_type ((i32, i32), i32), const +// CHECK:STDOUT: %.loc7_24.4: type = ptr_type (i32, i32), const +// CHECK:STDOUT: %.loc7_24.5: type = tuple_type ((i32, i32)*, i32), const +// CHECK:STDOUT: %.loc7_24.6: type = ptr_type ((i32, i32)*, i32), const +// CHECK:STDOUT: %.loc7_30: i32 = int_literal 12, const +// CHECK:STDOUT: %.loc7_34: i32 = int_literal 76, const +// CHECK:STDOUT: %.loc7_39: i32 = int_literal 6, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -26,10 +29,10 @@ var x: ((i32, i32), i32) = ((12, 76), 6); // CHECK:STDOUT: %.loc7_24.3: type = converted %.loc7_24.1, constants.%.loc7_24.3 // CHECK:STDOUT: %x.var: ref ((i32, i32), i32) = var x // CHECK:STDOUT: %x: ref ((i32, i32), i32) = bind_name x, %x.var -// CHECK:STDOUT: %.loc7_30: i32 = int_literal 12 -// CHECK:STDOUT: %.loc7_34: i32 = int_literal 76 +// CHECK:STDOUT: %.loc7_30: i32 = int_literal 12, const = constants.%.loc7_30 +// CHECK:STDOUT: %.loc7_34: i32 = int_literal 76, const = constants.%.loc7_34 // CHECK:STDOUT: %.loc7_36.1: (i32, i32) = tuple_literal (%.loc7_30, %.loc7_34) -// CHECK:STDOUT: %.loc7_39: i32 = int_literal 6 +// CHECK:STDOUT: %.loc7_39: i32 = int_literal 6, const = constants.%.loc7_39 // CHECK:STDOUT: %.loc7_40.1: ((i32, i32), i32) = tuple_literal (%.loc7_36.1, %.loc7_39) // CHECK:STDOUT: %.loc7_40.2: ref (i32, i32) = tuple_access %x.var, element0 // CHECK:STDOUT: %.loc7_36.2: ref i32 = tuple_access %.loc7_40.2, element0 diff --git a/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon b/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon index a4cc408bbb18..14fde1e01932 100644 --- a/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon +++ b/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon @@ -17,24 +17,26 @@ fn H() { // CHECK:STDOUT: --- nested_tuple_in_place.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_25.1: type = tuple_type (type, type, type) -// CHECK:STDOUT: %.loc7_25.2: type = tuple_type (i32, i32, i32) -// CHECK:STDOUT: %.loc7_25.3: type = ptr_type (i32, i32, i32) -// CHECK:STDOUT: %.loc10_43.1: type = tuple_type ((type, type, type), (type, type, type)) -// CHECK:STDOUT: %.loc10_43.2: type = tuple_type ((i32, i32, i32), (i32, i32, i32)) -// CHECK:STDOUT: %.loc10_43.3: type = tuple_type ((i32, i32, i32)*, (i32, i32, i32)*) -// CHECK:STDOUT: %.loc10_43.4: type = ptr_type ((i32, i32, i32)*, (i32, i32, i32)*) -// CHECK:STDOUT: %.loc14_36.1: type = tuple_type (type, (type, type, type), type) -// CHECK:STDOUT: %.loc14_36.2: type = tuple_type (i32, (i32, i32, i32), i32) -// CHECK:STDOUT: %.loc14_36.3: type = tuple_type (i32, (i32, i32, i32)*, i32) -// CHECK:STDOUT: %.loc14_36.4: type = ptr_type (i32, (i32, i32, i32)*, i32) +// CHECK:STDOUT: %.loc7_25.1: type = tuple_type (type, type, type), const +// CHECK:STDOUT: %.loc7_25.2: type = tuple_type (i32, i32, i32), const +// CHECK:STDOUT: %.loc7_25.3: type = ptr_type (i32, i32, i32), const +// CHECK:STDOUT: %.loc10_43.1: type = tuple_type ((type, type, type), (type, type, type)), const +// CHECK:STDOUT: %.loc10_43.2: type = tuple_type ((i32, i32, i32), (i32, i32, i32)), const +// CHECK:STDOUT: %.loc10_43.3: type = tuple_type ((i32, i32, i32)*, (i32, i32, i32)*), const +// CHECK:STDOUT: %.loc10_43.4: type = ptr_type ((i32, i32, i32)*, (i32, i32, i32)*), const +// CHECK:STDOUT: %.loc14_36.1: type = tuple_type (type, (type, type, type), type), const +// CHECK:STDOUT: %.loc14_36.2: type = tuple_type (i32, (i32, i32, i32), i32), const +// CHECK:STDOUT: %.loc14_36.3: type = tuple_type (i32, (i32, i32, i32)*, i32), const +// CHECK:STDOUT: %.loc14_36.4: type = ptr_type (i32, (i32, i32, i32)*, i32), const +// CHECK:STDOUT: %.loc14_41: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc14_49: i32 = int_literal 2, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.F = %F, .G = %G, .H = %H} -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %H: = fn_decl @H +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %H: = fn_decl @H, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %return: (i32, i32, i32); @@ -49,10 +51,10 @@ fn H() { // CHECK:STDOUT: %.loc10_43.2: type = converted %.loc10_43.1, constants.%.loc10_43.2 // CHECK:STDOUT: %v.var: ref ((i32, i32, i32), (i32, i32, i32)) = var v // CHECK:STDOUT: %v: ref ((i32, i32, i32), (i32, i32, i32)) = bind_name v, %v.var -// CHECK:STDOUT: %F.ref.loc10_48: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref.loc10_48: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc10_56.1: ref (i32, i32, i32) = tuple_access %v.var, element0 // CHECK:STDOUT: %.loc10_49: init (i32, i32, i32) = call %F.ref.loc10_48() to %.loc10_56.1 -// CHECK:STDOUT: %F.ref.loc10_53: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref.loc10_53: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc10_56.2: ref (i32, i32, i32) = tuple_access %v.var, element1 // CHECK:STDOUT: %.loc10_54: init (i32, i32, i32) = call %F.ref.loc10_53() to %.loc10_56.2 // CHECK:STDOUT: %.loc10_56.3: ((i32, i32, i32), (i32, i32, i32)) = tuple_literal (%.loc10_49, %.loc10_54) @@ -70,11 +72,11 @@ fn H() { // CHECK:STDOUT: %.loc14_36.2: type = converted %.loc14_36.1, constants.%.loc14_36.2 // CHECK:STDOUT: %v.var: ref (i32, (i32, i32, i32), i32) = var v // CHECK:STDOUT: %v: ref (i32, (i32, i32, i32), i32) = bind_name v, %v.var -// CHECK:STDOUT: %.loc14_41: i32 = int_literal 1 -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F +// CHECK:STDOUT: %.loc14_41: i32 = int_literal 1, const = constants.%.loc14_41 +// CHECK:STDOUT: %F.ref: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc14_50.1: ref (i32, i32, i32) = tuple_access %v.var, element1 // CHECK:STDOUT: %.loc14_45: init (i32, i32, i32) = call %F.ref() to %.loc14_50.1 -// CHECK:STDOUT: %.loc14_49: i32 = int_literal 2 +// CHECK:STDOUT: %.loc14_49: i32 = int_literal 2, const = constants.%.loc14_49 // CHECK:STDOUT: %.loc14_50.2: (i32, (i32, i32, i32), i32) = tuple_literal (%.loc14_41, %.loc14_45, %.loc14_49) // CHECK:STDOUT: %.loc14_50.3: ref i32 = tuple_access %v.var, element0 // CHECK:STDOUT: %.loc14_50.4: init i32 = initialize_from %.loc14_41 to %.loc14_50.3 diff --git a/toolchain/check/testdata/tuples/one_element.carbon b/toolchain/check/testdata/tuples/one_element.carbon index a3861f7de0d7..f7956db8d510 100644 --- a/toolchain/check/testdata/tuples/one_element.carbon +++ b/toolchain/check/testdata/tuples/one_element.carbon @@ -10,8 +10,9 @@ var y: (i32,) = x; // CHECK:STDOUT: --- one_element.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_13.1: type = tuple_type (type) -// CHECK:STDOUT: %.loc7_13.2: type = tuple_type (i32) +// CHECK:STDOUT: %.loc7_13.1: type = tuple_type (type), const +// CHECK:STDOUT: %.loc7_13.2: type = tuple_type (i32), const +// CHECK:STDOUT: %.loc7_18: i32 = int_literal 4, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -20,7 +21,7 @@ var y: (i32,) = x; // CHECK:STDOUT: %.loc7_13.2: type = converted %.loc7_13.1, constants.%.loc7_13.2 // CHECK:STDOUT: %x.var: ref (i32,) = var x // CHECK:STDOUT: %x: ref (i32,) = bind_name x, %x.var -// CHECK:STDOUT: %.loc7_18: i32 = int_literal 4 +// CHECK:STDOUT: %.loc7_18: i32 = int_literal 4, const = constants.%.loc7_18 // CHECK:STDOUT: %.loc7_20.1: (i32,) = tuple_literal (%.loc7_18) // CHECK:STDOUT: %.loc7_20.2: init (i32,) = tuple_init (%.loc7_18) to %x.var // CHECK:STDOUT: %.loc7_20.3: init (i32,) = converted %.loc7_20.1, %.loc7_20.2 diff --git a/toolchain/check/testdata/tuples/two_elements.carbon b/toolchain/check/testdata/tuples/two_elements.carbon index 3869305837d0..96286bbdad62 100644 --- a/toolchain/check/testdata/tuples/two_elements.carbon +++ b/toolchain/check/testdata/tuples/two_elements.carbon @@ -10,9 +10,11 @@ var y: (i32, i32) = x; // CHECK:STDOUT: --- two_elements.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc7_17.1: type = tuple_type (type, type) -// CHECK:STDOUT: %.loc7_17.2: type = tuple_type (i32, i32) -// CHECK:STDOUT: %.loc7_17.3: type = ptr_type (i32, i32) +// CHECK:STDOUT: %.loc7_17.1: type = tuple_type (type, type), const +// CHECK:STDOUT: %.loc7_17.2: type = tuple_type (i32, i32), const +// CHECK:STDOUT: %.loc7_17.3: type = ptr_type (i32, i32), const +// CHECK:STDOUT: %.loc7_22: i32 = int_literal 4, const +// CHECK:STDOUT: %.loc7_25: i32 = int_literal 102, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { @@ -21,8 +23,8 @@ var y: (i32, i32) = x; // CHECK:STDOUT: %.loc7_17.2: type = converted %.loc7_17.1, constants.%.loc7_17.2 // CHECK:STDOUT: %x.var: ref (i32, i32) = var x // CHECK:STDOUT: %x: ref (i32, i32) = bind_name x, %x.var -// CHECK:STDOUT: %.loc7_22: i32 = int_literal 4 -// CHECK:STDOUT: %.loc7_25: i32 = int_literal 102 +// CHECK:STDOUT: %.loc7_22: i32 = int_literal 4, const = constants.%.loc7_22 +// CHECK:STDOUT: %.loc7_25: i32 = int_literal 102, const = constants.%.loc7_25 // CHECK:STDOUT: %.loc7_28.1: (i32, i32) = tuple_literal (%.loc7_22, %.loc7_25) // CHECK:STDOUT: %.loc7_28.2: ref i32 = tuple_access %x.var, element0 // CHECK:STDOUT: %.loc7_28.3: init i32 = initialize_from %.loc7_22 to %.loc7_28.2 diff --git a/toolchain/check/testdata/var/decl.carbon b/toolchain/check/testdata/var/decl.carbon index 329742c49dba..71ef5c40d714 100644 --- a/toolchain/check/testdata/var/decl.carbon +++ b/toolchain/check/testdata/var/decl.carbon @@ -12,7 +12,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/var/decl_with_init.carbon b/toolchain/check/testdata/var/decl_with_init.carbon index 95a57dbb2413..bd48b4a8b020 100644 --- a/toolchain/check/testdata/var/decl_with_init.carbon +++ b/toolchain/check/testdata/var/decl_with_init.carbon @@ -10,16 +10,20 @@ fn Main() { // CHECK:STDOUT: --- decl_with_init.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc8: i32 = int_literal 0, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 +// CHECK:STDOUT: %.loc8: i32 = int_literal 0, const = constants.%.loc8 // CHECK:STDOUT: assign %x.var, %.loc8 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/var/fail_duplicate_decl.carbon b/toolchain/check/testdata/var/fail_duplicate_decl.carbon index d03deb7ef620..66b0f0310350 100644 --- a/toolchain/check/testdata/var/fail_duplicate_decl.carbon +++ b/toolchain/check/testdata/var/fail_duplicate_decl.carbon @@ -18,20 +18,25 @@ fn Main() { // CHECK:STDOUT: --- fail_duplicate_decl.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc9: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc16: i32 = int_literal 0, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.var.loc9: ref i32 = var x // CHECK:STDOUT: %x.loc9: ref i32 = bind_name x, %x.var.loc9 -// CHECK:STDOUT: %.loc9: i32 = int_literal 0 +// CHECK:STDOUT: %.loc9: i32 = int_literal 0, const = constants.%.loc9 // CHECK:STDOUT: assign %x.var.loc9, %.loc9 // CHECK:STDOUT: %x.var.loc16: ref i32 = var x // CHECK:STDOUT: %x.loc16: ref i32 = bind_name x, %x.var.loc16 -// CHECK:STDOUT: %.loc16: i32 = int_literal 0 +// CHECK:STDOUT: %.loc16: i32 = int_literal 0, const = constants.%.loc16 // CHECK:STDOUT: assign %x.var.loc16, %.loc16 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/var/fail_generic.carbon b/toolchain/check/testdata/var/fail_generic.carbon index 66efcb3559a3..777236c7f654 100644 --- a/toolchain/check/testdata/var/fail_generic.carbon +++ b/toolchain/check/testdata/var/fail_generic.carbon @@ -13,16 +13,20 @@ fn Main() { // CHECK:STDOUT: --- fail_generic.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc11: i32 = int_literal 0, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: i32 = bind_symbolic_name x, %x.var -// CHECK:STDOUT: %.loc11: i32 = int_literal 0 +// CHECK:STDOUT: %.loc11: i32 = int_literal 0, const = constants.%.loc11 // CHECK:STDOUT: assign %x.var, %.loc11 // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/var/fail_init_type_mismatch.carbon b/toolchain/check/testdata/var/fail_init_type_mismatch.carbon index 2371066f6e36..98e7f70a17e7 100644 --- a/toolchain/check/testdata/var/fail_init_type_mismatch.carbon +++ b/toolchain/check/testdata/var/fail_init_type_mismatch.carbon @@ -13,16 +13,20 @@ fn Main() { // CHECK:STDOUT: --- fail_init_type_mismatch.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc11: f64 = real_literal 10e-1, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %.loc11: f64 = real_literal 10e-1 +// CHECK:STDOUT: %.loc11: f64 = real_literal 10e-1, const = constants.%.loc11 // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/var/fail_init_with_self.carbon b/toolchain/check/testdata/var/fail_init_with_self.carbon index 93b24b55b682..159e3f9b996b 100644 --- a/toolchain/check/testdata/var/fail_init_with_self.carbon +++ b/toolchain/check/testdata/var/fail_init_with_self.carbon @@ -15,7 +15,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/var/fail_lookup_outside_scope.carbon b/toolchain/check/testdata/var/fail_lookup_outside_scope.carbon index 34b5501c62a4..b6d4d1e2948a 100644 --- a/toolchain/check/testdata/var/fail_lookup_outside_scope.carbon +++ b/toolchain/check/testdata/var/fail_lookup_outside_scope.carbon @@ -17,7 +17,7 @@ var y: i32 = x; // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main, .y = %y} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: %y.var: ref i32 = var y // CHECK:STDOUT: %y: ref i32 = bind_name y, %y.var // CHECK:STDOUT: %x.ref: = name_ref x, diff --git a/toolchain/check/testdata/var/fail_not_copyable.carbon b/toolchain/check/testdata/var/fail_not_copyable.carbon index 06e94cf3fc26..f15bb8bafc21 100644 --- a/toolchain/check/testdata/var/fail_not_copyable.carbon +++ b/toolchain/check/testdata/var/fail_not_copyable.carbon @@ -25,17 +25,18 @@ fn F(x: X) { // CHECK:STDOUT: --- fail_not_copyable.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc8_1.1: type = struct_type {} -// CHECK:STDOUT: %.loc8_1.2: type = tuple_type () -// CHECK:STDOUT: %.loc7: type = ptr_type {} -// CHECK:STDOUT: %.1: type = ptr_type String +// CHECK:STDOUT: %.loc8_1.1: type = struct_type {}, const +// CHECK:STDOUT: %.loc8_1.2: type = tuple_type (), const +// CHECK:STDOUT: %.loc7: type = ptr_type {}, const +// CHECK:STDOUT: %.1: type = ptr_type String, const +// CHECK:STDOUT: %.loc16: String = string_literal "hello", const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.X = %X.decl, .F = %F} // CHECK:STDOUT: %X.decl = class_decl @X, () -// CHECK:STDOUT: %X: type = class_type @X -// CHECK:STDOUT: %F: = fn_decl @F +// CHECK:STDOUT: %X: type = class_type @X, const +// CHECK:STDOUT: %F: = fn_decl @F, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @X { @@ -47,9 +48,9 @@ fn F(x: X) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %s.var: ref String = var s // CHECK:STDOUT: %s: ref String = bind_name s, %s.var -// CHECK:STDOUT: %.loc16: String = string_literal "hello" +// CHECK:STDOUT: %.loc16: String = string_literal "hello", const = constants.%.loc16 // CHECK:STDOUT: assign %s.var, -// CHECK:STDOUT: %X.ref: type = name_ref X, file.%X +// CHECK:STDOUT: %X.ref: type = name_ref X, file.%X, const = file.%X // CHECK:STDOUT: %y.var: ref X = var y // CHECK:STDOUT: %y: ref X = bind_name y, %y.var // CHECK:STDOUT: %x.ref: X = name_ref x, %x diff --git a/toolchain/check/testdata/var/fail_storage_is_literal.carbon b/toolchain/check/testdata/var/fail_storage_is_literal.carbon index 57e6b7afef12..1992af196c0c 100644 --- a/toolchain/check/testdata/var/fail_storage_is_literal.carbon +++ b/toolchain/check/testdata/var/fail_storage_is_literal.carbon @@ -13,17 +13,22 @@ fn Main() { // CHECK:STDOUT: --- fail_storage_is_literal.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc11_10: i32 = int_literal 1, const +// CHECK:STDOUT: %.loc11_14: i32 = int_literal 1, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_10: i32 = int_literal 1 +// CHECK:STDOUT: %.loc11_10: i32 = int_literal 1, const = constants.%.loc11_10 // CHECK:STDOUT: %x.var: ref = var x // CHECK:STDOUT: %x: ref = bind_name x, %x.var -// CHECK:STDOUT: %.loc11_14: i32 = int_literal 1 +// CHECK:STDOUT: %.loc11_14: i32 = int_literal 1, const = constants.%.loc11_14 // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/var/global_decl_with_init.carbon b/toolchain/check/testdata/var/global_decl_with_init.carbon index a3c17015f451..274b2b43f1d9 100644 --- a/toolchain/check/testdata/var/global_decl_with_init.carbon +++ b/toolchain/check/testdata/var/global_decl_with_init.carbon @@ -8,11 +8,15 @@ var x: i32 = 0; // CHECK:STDOUT: --- global_decl_with_init.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc7: i32 = int_literal 0, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x} // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %.loc7: i32 = int_literal 0 +// CHECK:STDOUT: %.loc7: i32 = int_literal 0, const = constants.%.loc7 // CHECK:STDOUT: assign %x.var, %.loc7 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/var/global_lookup.carbon b/toolchain/check/testdata/var/global_lookup.carbon index 0f9f5e4d293f..225ae734d901 100644 --- a/toolchain/check/testdata/var/global_lookup.carbon +++ b/toolchain/check/testdata/var/global_lookup.carbon @@ -9,11 +9,15 @@ var y: i32 = x; // CHECK:STDOUT: --- global_lookup.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc7: i32 = int_literal 0, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x, .y = %y} // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %.loc7: i32 = int_literal 0 +// CHECK:STDOUT: %.loc7: i32 = int_literal 0, const = constants.%.loc7 // CHECK:STDOUT: assign %x.var, %.loc7 // CHECK:STDOUT: %y.var: ref i32 = var y // CHECK:STDOUT: %y: ref i32 = bind_name y, %y.var diff --git a/toolchain/check/testdata/var/global_lookup_in_scope.carbon b/toolchain/check/testdata/var/global_lookup_in_scope.carbon index 7eba2df96a58..7af5e02de7b0 100644 --- a/toolchain/check/testdata/var/global_lookup_in_scope.carbon +++ b/toolchain/check/testdata/var/global_lookup_in_scope.carbon @@ -12,13 +12,17 @@ fn Main() { // CHECK:STDOUT: --- global_lookup_in_scope.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc7: i32 = int_literal 0, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.x = %x, .Main = %Main} // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %.loc7: i32 = int_literal 0 +// CHECK:STDOUT: %.loc7: i32 = int_literal 0, const = constants.%.loc7 // CHECK:STDOUT: assign %x.var, %.loc7 -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { diff --git a/toolchain/check/testdata/var/lookup.carbon b/toolchain/check/testdata/var/lookup.carbon index 1004b92c89cb..d665619afbb4 100644 --- a/toolchain/check/testdata/var/lookup.carbon +++ b/toolchain/check/testdata/var/lookup.carbon @@ -11,16 +11,20 @@ fn Main() { // CHECK:STDOUT: --- lookup.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc8: i32 = int_literal 0, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 +// CHECK:STDOUT: %.loc8: i32 = int_literal 0, const = constants.%.loc8 // CHECK:STDOUT: assign %x.var, %.loc8 // CHECK:STDOUT: %x.ref: ref i32 = name_ref x, %x // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/var/shadowing.carbon b/toolchain/check/testdata/var/shadowing.carbon index 20628d8c618b..5468f0b8db64 100644 --- a/toolchain/check/testdata/var/shadowing.carbon +++ b/toolchain/check/testdata/var/shadowing.carbon @@ -16,27 +16,34 @@ fn Main() { // CHECK:STDOUT: --- shadowing.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc8: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc9: bool = bool_literal true, const +// CHECK:STDOUT: %.loc10: i32 = int_literal 0, const +// CHECK:STDOUT: %.loc13: i32 = int_literal 1, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Main = %Main} -// CHECK:STDOUT: %Main: = fn_decl @Main +// CHECK:STDOUT: %Main: = fn_decl @Main, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %x.var.loc8: ref i32 = var x // CHECK:STDOUT: %x.loc8: ref i32 = bind_name x, %x.var.loc8 -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 +// CHECK:STDOUT: %.loc8: i32 = int_literal 0, const = constants.%.loc8 // CHECK:STDOUT: assign %x.var.loc8, %.loc8 -// CHECK:STDOUT: %.loc9: bool = bool_literal true +// CHECK:STDOUT: %.loc9: bool = bool_literal true, const = constants.%.loc9 // CHECK:STDOUT: if %.loc9 br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: // CHECK:STDOUT: %x.var.loc10: ref i32 = var x // CHECK:STDOUT: %x.loc10: ref i32 = bind_name x, %x.var.loc10 -// CHECK:STDOUT: %.loc10: i32 = int_literal 0 +// CHECK:STDOUT: %.loc10: i32 = int_literal 0, const = constants.%.loc10 // CHECK:STDOUT: assign %x.var.loc10, %.loc10 // CHECK:STDOUT: %x.ref: ref i32 = name_ref x, %x.loc10 -// CHECK:STDOUT: %.loc13: i32 = int_literal 1 +// CHECK:STDOUT: %.loc13: i32 = int_literal 1, const = constants.%.loc13 // CHECK:STDOUT: assign %x.ref, %.loc13 // CHECK:STDOUT: br !if.else // CHECK:STDOUT: diff --git a/toolchain/check/testdata/while/break_continue.carbon b/toolchain/check/testdata/while/break_continue.carbon index e38c74dd5afd..a4a2161fd603 100644 --- a/toolchain/check/testdata/while/break_continue.carbon +++ b/toolchain/check/testdata/while/break_continue.carbon @@ -30,15 +30,15 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.A = %A, .B = %B, .C = %C, .D = %D, .E = %E, .F = %F, .G = %G, .H = %H, .While = %While} -// CHECK:STDOUT: %A: = fn_decl @A -// CHECK:STDOUT: %B: = fn_decl @B -// CHECK:STDOUT: %C: = fn_decl @C -// CHECK:STDOUT: %D: = fn_decl @D -// CHECK:STDOUT: %E: = fn_decl @E -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %H: = fn_decl @H -// CHECK:STDOUT: %While: = fn_decl @While +// CHECK:STDOUT: %A: = fn_decl @A, const +// CHECK:STDOUT: %B: = fn_decl @B, const +// CHECK:STDOUT: %C: = fn_decl @C, const +// CHECK:STDOUT: %D: = fn_decl @D, const +// CHECK:STDOUT: %E: = fn_decl @E, const +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %H: = fn_decl @H, const +// CHECK:STDOUT: %While: = fn_decl @While, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> bool; @@ -62,14 +62,14 @@ fn While() { // CHECK:STDOUT: br !while.cond.loc17 // CHECK:STDOUT: // CHECK:STDOUT: !while.cond.loc17: -// CHECK:STDOUT: %A.ref: = name_ref A, file.%A +// CHECK:STDOUT: %A.ref: = name_ref A, file.%A, const = file.%A // CHECK:STDOUT: %.loc17_11: init bool = call %A.ref() // CHECK:STDOUT: %.loc17_13.1: bool = value_of_initializer %.loc17_11 // CHECK:STDOUT: %.loc17_13.2: bool = converted %.loc17_11, %.loc17_13.1 // CHECK:STDOUT: if %.loc17_13.2 br !while.body.loc17 else br !while.done.loc17 // CHECK:STDOUT: // CHECK:STDOUT: !while.body.loc17: -// CHECK:STDOUT: %B.ref: = name_ref B, file.%B +// CHECK:STDOUT: %B.ref: = name_ref B, file.%B, const = file.%B // CHECK:STDOUT: %.loc18_10: init bool = call %B.ref() // CHECK:STDOUT: %.loc18_12.1: bool = value_of_initializer %.loc18_10 // CHECK:STDOUT: %.loc18_12.2: bool = converted %.loc18_10, %.loc18_12.1 @@ -79,7 +79,7 @@ fn While() { // CHECK:STDOUT: br !while.cond.loc17 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc18: -// CHECK:STDOUT: %C.ref: = name_ref C, file.%C +// CHECK:STDOUT: %C.ref: = name_ref C, file.%C, const = file.%C // CHECK:STDOUT: %.loc19_10: init bool = call %C.ref() // CHECK:STDOUT: %.loc19_12.1: bool = value_of_initializer %.loc19_10 // CHECK:STDOUT: %.loc19_12.2: bool = converted %.loc19_10, %.loc19_12.1 @@ -92,14 +92,14 @@ fn While() { // CHECK:STDOUT: br !while.cond.loc20 // CHECK:STDOUT: // CHECK:STDOUT: !while.cond.loc20: -// CHECK:STDOUT: %D.ref: = name_ref D, file.%D +// CHECK:STDOUT: %D.ref: = name_ref D, file.%D, const = file.%D // CHECK:STDOUT: %.loc20_13: init bool = call %D.ref() // CHECK:STDOUT: %.loc20_15.1: bool = value_of_initializer %.loc20_13 // CHECK:STDOUT: %.loc20_15.2: bool = converted %.loc20_13, %.loc20_15.1 // CHECK:STDOUT: if %.loc20_15.2 br !while.body.loc20 else br !while.done.loc20 // CHECK:STDOUT: // CHECK:STDOUT: !while.body.loc20: -// CHECK:STDOUT: %E.ref: = name_ref E, file.%E +// CHECK:STDOUT: %E.ref: = name_ref E, file.%E, const = file.%E // CHECK:STDOUT: %.loc21_12: init bool = call %E.ref() // CHECK:STDOUT: %.loc21_14.1: bool = value_of_initializer %.loc21_12 // CHECK:STDOUT: %.loc21_14.2: bool = converted %.loc21_12, %.loc21_14.1 @@ -109,7 +109,7 @@ fn While() { // CHECK:STDOUT: br !while.cond.loc20 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc21: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc22_12: init bool = call %F.ref() // CHECK:STDOUT: %.loc22_14.1: bool = value_of_initializer %.loc22_12 // CHECK:STDOUT: %.loc22_14.2: bool = converted %.loc22_12, %.loc22_14.1 @@ -122,7 +122,7 @@ fn While() { // CHECK:STDOUT: br !while.cond.loc20 // CHECK:STDOUT: // CHECK:STDOUT: !while.done.loc20: -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G +// CHECK:STDOUT: %G.ref: = name_ref G, file.%G, const = file.%G // CHECK:STDOUT: %.loc24_10: init bool = call %G.ref() // CHECK:STDOUT: %.loc24_12.1: bool = value_of_initializer %.loc24_10 // CHECK:STDOUT: %.loc24_12.2: bool = converted %.loc24_10, %.loc24_12.1 @@ -132,7 +132,7 @@ fn While() { // CHECK:STDOUT: br !while.cond.loc17 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc24: -// CHECK:STDOUT: %H.ref: = name_ref H, file.%H +// CHECK:STDOUT: %H.ref: = name_ref H, file.%H, const = file.%H // CHECK:STDOUT: %.loc25_10: init bool = call %H.ref() // CHECK:STDOUT: %.loc25_12.1: bool = value_of_initializer %.loc25_10 // CHECK:STDOUT: %.loc25_12.2: bool = converted %.loc25_10, %.loc25_12.1 diff --git a/toolchain/check/testdata/while/fail_bad_condition.carbon b/toolchain/check/testdata/while/fail_bad_condition.carbon index d3f6a5a93270..4f2b9901c291 100644 --- a/toolchain/check/testdata/while/fail_bad_condition.carbon +++ b/toolchain/check/testdata/while/fail_bad_condition.carbon @@ -14,12 +14,13 @@ fn While() { // CHECK:STDOUT: --- fail_bad_condition.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.1: type = ptr_type String +// CHECK:STDOUT: %.1: type = ptr_type String, const +// CHECK:STDOUT: %.loc11: String = string_literal "Hello", const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.While = %While} -// CHECK:STDOUT: %While: = fn_decl @While +// CHECK:STDOUT: %While: = fn_decl @While, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @While() { @@ -27,7 +28,7 @@ fn While() { // CHECK:STDOUT: br !while.cond // CHECK:STDOUT: // CHECK:STDOUT: !while.cond: -// CHECK:STDOUT: %.loc11: String = string_literal "Hello" +// CHECK:STDOUT: %.loc11: String = string_literal "Hello", const = constants.%.loc11 // CHECK:STDOUT: if br !while.body else br !while.done // CHECK:STDOUT: // CHECK:STDOUT: !while.body: diff --git a/toolchain/check/testdata/while/fail_break_continue.carbon b/toolchain/check/testdata/while/fail_break_continue.carbon index 3c90a3ee6607..d4650e5f2a08 100644 --- a/toolchain/check/testdata/while/fail_break_continue.carbon +++ b/toolchain/check/testdata/while/fail_break_continue.carbon @@ -29,9 +29,13 @@ fn While() { // CHECK:STDOUT: --- fail_break_continue.carbon // CHECK:STDOUT: +// CHECK:STDOUT: constants { +// CHECK:STDOUT: %.loc16: bool = bool_literal false, const +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.While = %While} -// CHECK:STDOUT: %While: = fn_decl @While +// CHECK:STDOUT: %While: = fn_decl @While, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @While() { diff --git a/toolchain/check/testdata/while/unreachable_end.carbon b/toolchain/check/testdata/while/unreachable_end.carbon index 06d5d5769501..7becad53c573 100644 --- a/toolchain/check/testdata/while/unreachable_end.carbon +++ b/toolchain/check/testdata/while/unreachable_end.carbon @@ -22,16 +22,16 @@ fn While() { // CHECK:STDOUT: --- unreachable_end.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc14: type = tuple_type () +// CHECK:STDOUT: %.loc14: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Cond = %Cond, .F = %F, .G = %G, .H = %H, .While = %While} -// CHECK:STDOUT: %Cond: = fn_decl @Cond -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %H: = fn_decl @H -// CHECK:STDOUT: %While: = fn_decl @While +// CHECK:STDOUT: %Cond: = fn_decl @Cond, const +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %H: = fn_decl @H, const +// CHECK:STDOUT: %While: = fn_decl @While, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Cond() -> bool; @@ -44,24 +44,24 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: fn @While() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc14: init () = call %F.ref() // CHECK:STDOUT: br !while.cond // CHECK:STDOUT: // CHECK:STDOUT: !while.cond: -// CHECK:STDOUT: %Cond.ref: = name_ref Cond, file.%Cond +// CHECK:STDOUT: %Cond.ref: = name_ref Cond, file.%Cond, const = file.%Cond // CHECK:STDOUT: %.loc15_14: init bool = call %Cond.ref() // CHECK:STDOUT: %.loc15_16.1: bool = value_of_initializer %.loc15_14 // CHECK:STDOUT: %.loc15_16.2: bool = converted %.loc15_14, %.loc15_16.1 // CHECK:STDOUT: if %.loc15_16.2 br !while.body else br !while.done // CHECK:STDOUT: // CHECK:STDOUT: !while.body: -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G +// CHECK:STDOUT: %G.ref: = name_ref G, file.%G, const = file.%G // CHECK:STDOUT: %.loc16: init () = call %G.ref() // CHECK:STDOUT: return // CHECK:STDOUT: // CHECK:STDOUT: !while.done: -// CHECK:STDOUT: %H.ref: = name_ref H, file.%H +// CHECK:STDOUT: %H.ref: = name_ref H, file.%H, const = file.%H // CHECK:STDOUT: %.loc19: init () = call %H.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/while/while.carbon b/toolchain/check/testdata/while/while.carbon index 0233afda9050..103369be6258 100644 --- a/toolchain/check/testdata/while/while.carbon +++ b/toolchain/check/testdata/while/while.carbon @@ -21,16 +21,16 @@ fn While() { // CHECK:STDOUT: --- while.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { -// CHECK:STDOUT: %.loc14: type = tuple_type () +// CHECK:STDOUT: %.loc14: type = tuple_type (), const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace package, {.Cond = %Cond, .F = %F, .G = %G, .H = %H, .While = %While} -// CHECK:STDOUT: %Cond: = fn_decl @Cond -// CHECK:STDOUT: %F: = fn_decl @F -// CHECK:STDOUT: %G: = fn_decl @G -// CHECK:STDOUT: %H: = fn_decl @H -// CHECK:STDOUT: %While: = fn_decl @While +// CHECK:STDOUT: %Cond: = fn_decl @Cond, const +// CHECK:STDOUT: %F: = fn_decl @F, const +// CHECK:STDOUT: %G: = fn_decl @G, const +// CHECK:STDOUT: %H: = fn_decl @H, const +// CHECK:STDOUT: %While: = fn_decl @While, const // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Cond() -> bool; @@ -43,24 +43,24 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: fn @While() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %F.ref: = name_ref F, file.%F +// CHECK:STDOUT: %F.ref: = name_ref F, file.%F, const = file.%F // CHECK:STDOUT: %.loc14: init () = call %F.ref() // CHECK:STDOUT: br !while.cond // CHECK:STDOUT: // CHECK:STDOUT: !while.cond: -// CHECK:STDOUT: %Cond.ref: = name_ref Cond, file.%Cond +// CHECK:STDOUT: %Cond.ref: = name_ref Cond, file.%Cond, const = file.%Cond // CHECK:STDOUT: %.loc15_14: init bool = call %Cond.ref() // CHECK:STDOUT: %.loc15_16.1: bool = value_of_initializer %.loc15_14 // CHECK:STDOUT: %.loc15_16.2: bool = converted %.loc15_14, %.loc15_16.1 // CHECK:STDOUT: if %.loc15_16.2 br !while.body else br !while.done // CHECK:STDOUT: // CHECK:STDOUT: !while.body: -// CHECK:STDOUT: %G.ref: = name_ref G, file.%G +// CHECK:STDOUT: %G.ref: = name_ref G, file.%G, const = file.%G // CHECK:STDOUT: %.loc16: init () = call %G.ref() // CHECK:STDOUT: br !while.cond // CHECK:STDOUT: // CHECK:STDOUT: !while.done: -// CHECK:STDOUT: %H.ref: = name_ref H, file.%H +// CHECK:STDOUT: %H.ref: = name_ref H, file.%H, const = file.%H // CHECK:STDOUT: %.loc18: init () = call %H.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/sem_ir/file.cpp b/toolchain/sem_ir/file.cpp index 000f5deccb17..c594d9aee505 100644 --- a/toolchain/sem_ir/file.cpp +++ b/toolchain/sem_ir/file.cpp @@ -166,6 +166,7 @@ auto File::OutputYaml(bool include_builtins) const -> Yaml::OutputMapping { Yaml::OutputScalar(insts_.Get(id))); } })); + map.Add("constant_values", constant_values_.OutputYaml()); map.Add("inst_blocks", inst_blocks_.OutputYaml()); })); }); diff --git a/toolchain/sem_ir/file.h b/toolchain/sem_ir/file.h index 3d615ffee90b..9ddefad610d9 100644 --- a/toolchain/sem_ir/file.h +++ b/toolchain/sem_ir/file.h @@ -286,6 +286,10 @@ class File : public Printable { } auto insts() -> InstStore& { return insts_; } auto insts() const -> const InstStore& { return insts_; } + auto constant_values() -> ConstantValueStore& { return constant_values_; } + auto constant_values() const -> const ConstantValueStore& { + return constant_values_; + } auto inst_blocks() -> InstBlockStore& { return inst_blocks_; } auto inst_blocks() const -> const InstBlockStore& { return inst_blocks_; } auto constants() -> ConstantStore& { return constants_; } @@ -350,6 +354,9 @@ class File : public Printable { // builtins, at indices matching BuiltinKind ordering. InstStore insts_; + // Constant values for instructions. + ConstantValueStore constant_values_; + // Instruction blocks within the IR. These reference entries in // insts_. Storage for the data is provided by allocator_. InstBlockStore inst_blocks_; diff --git a/toolchain/sem_ir/formatter.cpp b/toolchain/sem_ir/formatter.cpp index 44ffafc5facc..6960aae595a8 100644 --- a/toolchain/sem_ir/formatter.cpp +++ b/toolchain/sem_ir/formatter.cpp @@ -768,6 +768,14 @@ class Formatter { FormatInstructionLHS(inst_id, inst); out_ << InstT::Kind.ir_name(); FormatInstructionRHS(inst); + if (auto const_id = sem_ir_.constant_values().Get(inst_id); + const_id.is_valid()) { + out_ << ", const"; + if (const_id != inst_id) { + out_ << " = "; + FormatInstName(const_id); + } + } out_ << "\n"; } diff --git a/toolchain/sem_ir/value_stores.h b/toolchain/sem_ir/value_stores.h index 616703893642..37862f4aba69 100644 --- a/toolchain/sem_ir/value_stores.h +++ b/toolchain/sem_ir/value_stores.h @@ -53,6 +53,51 @@ class InstStore { ValueStore values_; }; +// Provides a ValueStore wrapper for tracking the constant values of +// instructions. +class ConstantValueStore : public Yaml::Printable { + public: + // Returns the constant value of the requested instruction, or InstId::Invalid + // if it is not constant. + auto Get(InstId inst_id) const -> InstId { + CARBON_CHECK(inst_id.index >= 0); + return static_cast(inst_id.index) >= values_.size() + ? InstId::Invalid + : values_[inst_id.index]; + } + + // Sets the constant value of the given instruction. + auto Set(InstId inst_id, InstId const_id) -> void { + CARBON_CHECK(inst_id.index >= 0); + CARBON_CHECK(const_id.is_valid()); + if (static_cast(inst_id.index) >= values_.size()) { + values_.resize(inst_id.index + 1, InstId::Invalid); + } + values_[inst_id.index] = const_id; + } + + // Outputs the store as YAML. Because this is modeled as a sparse mapping, + // non-constant elements are skipped in the output. + auto OutputYaml() const -> Yaml::OutputMapping { + return Yaml::OutputMapping([&](Yaml::OutputMapping::Map map) { + for (auto [id, value] : llvm::enumerate(values_)) { + if (value.is_valid()) { + map.Add(PrintToString(InstId(id)), Yaml::OutputScalar(value)); + } + } + }); + } + + private: + // A mapping from `InstId::index` to the corresponding constant value. This is + // expected to be sparse, and may be smaller than the list of instructions if + // there are trailing non-constant instructions. + // + // Set inline size to 0 because these will typically be too large for the + // stack, while this does make File smaller. + llvm::SmallVector values_; +}; + // Provides storage for instructions representing global constants. class ConstantStore { public: diff --git a/toolchain/sem_ir/yaml_test.cpp b/toolchain/sem_ir/yaml_test.cpp index 8ec1614b31e3..d71f0f35c0f2 100644 --- a/toolchain/sem_ir/yaml_test.cpp +++ b/toolchain/sem_ir/yaml_test.cpp @@ -74,6 +74,8 @@ TEST(SemIRTest, YAML) { _, Yaml::Mapping(ElementsAre(Pair("kind", "Assign"), Pair("arg0", inst_id), Pair("arg1", inst_id)))))))), + Pair("constant_values", + Yaml::Mapping(AllOf(Each(Pair(inst_id, inst_id))))), // This production has only two instruction blocks. Pair("inst_blocks", Yaml::Mapping(ElementsAre(