Skip to content

Commit

Permalink
Convert array bounds to IntLiteral. (#4526)
Browse files Browse the repository at this point in the history
Instead of leaving array bounds as whatever integer type they arrive as,
convert them to the `IntLiteral` type as part of forming an `ArrayType`.
This ensures that array types canonicalize properly even when the bounds
are specified with different types.

Create an empty generic definition for a generic builtin function to
avoid this causing "use of undefined generic function" errors.
  • Loading branch information
zygoloid authored Nov 15, 2024
1 parent a65cde6 commit 980ce6b
Show file tree
Hide file tree
Showing 62 changed files with 2,867 additions and 1,430 deletions.
18 changes: 12 additions & 6 deletions toolchain/check/handle_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "toolchain/check/convert.h"
#include "toolchain/check/handle.h"
#include "toolchain/parse/node_kind.h"
#include "toolchain/sem_ir/builtin_inst_kind.h"

namespace Carbon::Check {

Expand Down Expand Up @@ -33,24 +34,29 @@ auto HandleParseNode(Context& context, Parse::ArrayExprId node_id) -> bool {
auto [element_type_node_id, element_type_inst_id] =
context.node_stack().PopExprWithNodeId();

// The array bound must be a constant.
auto element_type_id =
ExprAsType(context, element_type_node_id, element_type_inst_id).type_id;

// The array bound must be a constant. Diagnose this prior to conversion
// because conversion to `IntLiteral` will produce a generic "non-constant
// call to compile-time-only function" error.
//
// TODO: Should we support runtime-phase bounds in cases such as:
// comptime fn F(n: i32) -> type { return [i32; n]; }
auto bound_inst = context.constant_values().Get(bound_inst_id);
if (!bound_inst.is_constant()) {
if (!context.constant_values().Get(bound_inst_id).is_constant()) {
CARBON_DIAGNOSTIC(InvalidArrayExpr, Error, "array bound is not a constant");
context.emitter().Emit(bound_inst_id, InvalidArrayExpr);
context.node_stack().Push(node_id, SemIR::InstId::BuiltinError);
return true;
}

bound_inst_id = ConvertToValueOfType(
context, context.insts().GetLocId(bound_inst_id), bound_inst_id,
context.GetBuiltinType(SemIR::BuiltinInstKind::IntLiteralType));
context.AddInstAndPush<SemIR::ArrayType>(
node_id, {.type_id = SemIR::TypeId::TypeType,
.bound_id = bound_inst_id,
.element_type_id = ExprAsType(context, element_type_node_id,
element_type_inst_id)
.type_id});
.element_type_id = element_type_id});
return true;
}

Expand Down
3 changes: 3 additions & 0 deletions toolchain/check/handle_function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,9 @@ auto HandleParseNode(Context& context,
auto& function = context.functions().Get(function_id);
if (IsValidBuiltinDeclaration(context, function, builtin_kind)) {
function.builtin_function_kind = builtin_kind;
// Build an empty generic definition if this is a generic builtin.
StartGenericDefinition(context);
FinishGenericDefinition(context, function.generic_id);
} else {
CARBON_DIAGNOSTIC(InvalidBuiltinSignature, Error,
"invalid signature for builtin function \"{0}\"",
Expand Down
36 changes: 24 additions & 12 deletions toolchain/check/testdata/array/array_in_place.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,22 @@ fn G() {
// CHECK:STDOUT: %G.type: type = fn_type @G [template]
// CHECK:STDOUT: %G: %G.type = struct_value () [template]
// CHECK:STDOUT: %.1: i32 = int_value 2 [template]
// CHECK:STDOUT: %.2: type = array_type %.1, %tuple.type.2 [template]
// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template]
// CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template]
// CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template]
// CHECK:STDOUT: %.25: <witness> = interface_witness (%Convert.15) [template]
// CHECK:STDOUT: %.26: <bound method> = bound_method %.1, %Convert.15 [template]
// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 2 [template]
// CHECK:STDOUT: %.28: type = array_type %.27, %tuple.type.2 [template]
// CHECK:STDOUT: %tuple.type.3: type = tuple_type (%tuple.type.2, %tuple.type.2) [template]
// CHECK:STDOUT: %.5: i32 = int_value 0 [template]
// CHECK:STDOUT: %.6: i32 = int_value 1 [template]
// CHECK:STDOUT: %.31: i32 = int_value 0 [template]
// CHECK:STDOUT: %.32: i32 = int_value 1 [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
// CHECK:STDOUT: .Int32 = %import_ref
// CHECK:STDOUT: .Int32 = %import_ref.1
// CHECK:STDOUT: .ImplicitAs = %import_ref.2
// CHECK:STDOUT: import Core//prelude
// CHECK:STDOUT: import Core//prelude/...
// CHECK:STDOUT: }
Expand Down Expand Up @@ -76,32 +83,37 @@ fn G() {
// CHECK:STDOUT: %int.make_type_32.loc14_17: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %int.make_type_32.loc14_22: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc14_25.1: %tuple.type.1 = tuple_literal (%int.make_type_32.loc14_12, %int.make_type_32.loc14_17, %int.make_type_32.loc14_22)
// CHECK:STDOUT: %.loc14_28: i32 = int_value 2 [template = constants.%.1]
// CHECK:STDOUT: %.loc14_28.1: i32 = int_value 2 [template = constants.%.1]
// CHECK:STDOUT: %.loc14_25.2: type = value_of_initializer %int.make_type_32.loc14_12 [template = i32]
// CHECK:STDOUT: %.loc14_25.3: type = converted %int.make_type_32.loc14_12, %.loc14_25.2 [template = i32]
// CHECK:STDOUT: %.loc14_25.4: type = value_of_initializer %int.make_type_32.loc14_17 [template = i32]
// CHECK:STDOUT: %.loc14_25.5: type = converted %int.make_type_32.loc14_17, %.loc14_25.4 [template = i32]
// CHECK:STDOUT: %.loc14_25.6: type = value_of_initializer %int.make_type_32.loc14_22 [template = i32]
// CHECK:STDOUT: %.loc14_25.7: type = converted %int.make_type_32.loc14_22, %.loc14_25.6 [template = i32]
// CHECK:STDOUT: %.loc14_25.8: type = converted %.loc14_25.1, constants.%tuple.type.2 [template = constants.%tuple.type.2]
// CHECK:STDOUT: %.loc14_29: type = array_type %.loc14_28, %tuple.type.2 [template = constants.%.2]
// CHECK:STDOUT: %v.var: ref %.2 = var v
// CHECK:STDOUT: %v: ref %.2 = bind_name v, %v.var
// CHECK:STDOUT: %.loc14_28.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15]
// CHECK:STDOUT: %.loc14_28.3: <bound method> = bound_method %.loc14_28.1, %.loc14_28.2 [template = constants.%.26]
// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc14_28.3(%.loc14_28.1) [template = constants.%.27]
// CHECK:STDOUT: %.loc14_28.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.27]
// CHECK:STDOUT: %.loc14_28.5: Core.IntLiteral = converted %.loc14_28.1, %.loc14_28.4 [template = constants.%.27]
// CHECK:STDOUT: %.loc14_29: type = array_type %.loc14_28.5, %tuple.type.2 [template = constants.%.28]
// CHECK:STDOUT: %v.var: ref %.28 = var v
// CHECK:STDOUT: %v: ref %.28 = bind_name v, %v.var
// CHECK:STDOUT: %F.ref.loc14_34: %F.type = name_ref F, file.%F.decl [template = constants.%F]
// CHECK:STDOUT: %.loc14_42.3: ref %tuple.type.2 = splice_block %.loc14_42.2 {
// CHECK:STDOUT: %.loc14_42.1: i32 = int_value 0 [template = constants.%.5]
// CHECK:STDOUT: %.loc14_42.1: i32 = int_value 0 [template = constants.%.31]
// CHECK:STDOUT: %.loc14_42.2: ref %tuple.type.2 = array_index %v.var, %.loc14_42.1
// CHECK:STDOUT: }
// CHECK:STDOUT: %F.call.loc14_35: init %tuple.type.2 = call %F.ref.loc14_34() to %.loc14_42.3
// CHECK:STDOUT: %F.ref.loc14_39: %F.type = name_ref F, file.%F.decl [template = constants.%F]
// CHECK:STDOUT: %.loc14_42.6: ref %tuple.type.2 = splice_block %.loc14_42.5 {
// CHECK:STDOUT: %.loc14_42.4: i32 = int_value 1 [template = constants.%.6]
// CHECK:STDOUT: %.loc14_42.4: i32 = int_value 1 [template = constants.%.32]
// CHECK:STDOUT: %.loc14_42.5: ref %tuple.type.2 = array_index %v.var, %.loc14_42.4
// CHECK:STDOUT: }
// CHECK:STDOUT: %F.call.loc14_40: init %tuple.type.2 = call %F.ref.loc14_39() to %.loc14_42.6
// CHECK:STDOUT: %.loc14_42.7: %tuple.type.3 = tuple_literal (%F.call.loc14_35, %F.call.loc14_40)
// CHECK:STDOUT: %.loc14_42.8: init %.2 = array_init (%F.call.loc14_35, %F.call.loc14_40) to %v.var
// CHECK:STDOUT: %.loc14_43: init %.2 = converted %.loc14_42.7, %.loc14_42.8
// CHECK:STDOUT: %.loc14_42.8: init %.28 = array_init (%F.call.loc14_35, %F.call.loc14_40) to %v.var
// CHECK:STDOUT: %.loc14_43: init %.28 = converted %.loc14_42.7, %.loc14_42.8
// CHECK:STDOUT: assign %v.var, %.loc14_43
// CHECK:STDOUT: return
// CHECK:STDOUT: }
Expand Down
60 changes: 36 additions & 24 deletions toolchain/check/testdata/array/array_vs_tuple.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,26 @@ fn G() {
// CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
// CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
// CHECK:STDOUT: %.1: i32 = int_value 3 [template]
// CHECK:STDOUT: %.2: type = array_type %.1, i32 [template]
// CHECK:STDOUT: %.4: i32 = int_value 1 [template]
// CHECK:STDOUT: %.5: i32 = int_value 2 [template]
// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template]
// CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template]
// CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template]
// CHECK:STDOUT: %.25: <witness> = interface_witness (%Convert.15) [template]
// CHECK:STDOUT: %.26: <bound method> = bound_method %.1, %Convert.15 [template]
// CHECK:STDOUT: %.27: Core.IntLiteral = int_value 3 [template]
// CHECK:STDOUT: %.28: type = array_type %.27, i32 [template]
// CHECK:STDOUT: %.30: i32 = int_value 1 [template]
// CHECK:STDOUT: %.31: i32 = int_value 2 [template]
// CHECK:STDOUT: %tuple.type.1: type = tuple_type (i32, i32, i32) [template]
// CHECK:STDOUT: %.6: i32 = int_value 0 [template]
// CHECK:STDOUT: %array: %.2 = tuple_value (%.4, %.5, %.1) [template]
// CHECK:STDOUT: %.32: i32 = int_value 0 [template]
// CHECK:STDOUT: %array: %.28 = tuple_value (%.30, %.31, %.1) [template]
// CHECK:STDOUT: %tuple.type.2: type = tuple_type (type, type, type) [template]
// CHECK:STDOUT: %tuple: %tuple.type.1 = tuple_value (%.4, %.5, %.1) [template]
// CHECK:STDOUT: %tuple: %tuple.type.1 = tuple_value (%.30, %.31, %.1) [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
// CHECK:STDOUT: .Int32 = %import_ref
// CHECK:STDOUT: .Int32 = %import_ref.1
// CHECK:STDOUT: .ImplicitAs = %import_ref.2
// CHECK:STDOUT: import Core//prelude
// CHECK:STDOUT: import Core//prelude/...
// CHECK:STDOUT: }
Expand All @@ -52,27 +59,32 @@ fn G() {
// CHECK:STDOUT: fn @G() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc13_16: i32 = int_value 3 [template = constants.%.1]
// CHECK:STDOUT: %.loc13_16.1: i32 = int_value 3 [template = constants.%.1]
// CHECK:STDOUT: %.loc13_11.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32]
// CHECK:STDOUT: %.loc13_11.2: type = converted %int.make_type_32.loc13, %.loc13_11.1 [template = i32]
// CHECK:STDOUT: %.loc13_17: type = array_type %.loc13_16, i32 [template = constants.%.2]
// CHECK:STDOUT: %a.var: ref %.2 = var a
// CHECK:STDOUT: %a: ref %.2 = bind_name a, %a.var
// CHECK:STDOUT: %.loc13_22: i32 = int_value 1 [template = constants.%.4]
// CHECK:STDOUT: %.loc13_25: i32 = int_value 2 [template = constants.%.5]
// CHECK:STDOUT: %.loc13_16.2: %Convert.type.2 = interface_witness_access constants.%.25, element0 [template = constants.%Convert.15]
// CHECK:STDOUT: %.loc13_16.3: <bound method> = bound_method %.loc13_16.1, %.loc13_16.2 [template = constants.%.26]
// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc13_16.3(%.loc13_16.1) [template = constants.%.27]
// CHECK:STDOUT: %.loc13_16.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.27]
// CHECK:STDOUT: %.loc13_16.5: Core.IntLiteral = converted %.loc13_16.1, %.loc13_16.4 [template = constants.%.27]
// CHECK:STDOUT: %.loc13_17: type = array_type %.loc13_16.5, i32 [template = constants.%.28]
// CHECK:STDOUT: %a.var: ref %.28 = var a
// CHECK:STDOUT: %a: ref %.28 = bind_name a, %a.var
// CHECK:STDOUT: %.loc13_22: i32 = int_value 1 [template = constants.%.30]
// CHECK:STDOUT: %.loc13_25: i32 = int_value 2 [template = constants.%.31]
// CHECK:STDOUT: %.loc13_28: i32 = int_value 3 [template = constants.%.1]
// CHECK:STDOUT: %.loc13_29.1: %tuple.type.1 = tuple_literal (%.loc13_22, %.loc13_25, %.loc13_28)
// CHECK:STDOUT: %.loc13_29.2: i32 = int_value 0 [template = constants.%.6]
// CHECK:STDOUT: %.loc13_29.2: i32 = int_value 0 [template = constants.%.32]
// CHECK:STDOUT: %.loc13_29.3: ref i32 = array_index %a.var, %.loc13_29.2
// CHECK:STDOUT: %.loc13_29.4: init i32 = initialize_from %.loc13_22 to %.loc13_29.3 [template = constants.%.4]
// CHECK:STDOUT: %.loc13_29.5: i32 = int_value 1 [template = constants.%.4]
// CHECK:STDOUT: %.loc13_29.4: init i32 = initialize_from %.loc13_22 to %.loc13_29.3 [template = constants.%.30]
// CHECK:STDOUT: %.loc13_29.5: i32 = int_value 1 [template = constants.%.30]
// CHECK:STDOUT: %.loc13_29.6: ref i32 = array_index %a.var, %.loc13_29.5
// CHECK:STDOUT: %.loc13_29.7: init i32 = initialize_from %.loc13_25 to %.loc13_29.6 [template = constants.%.5]
// CHECK:STDOUT: %.loc13_29.8: i32 = int_value 2 [template = constants.%.5]
// CHECK:STDOUT: %.loc13_29.7: init i32 = initialize_from %.loc13_25 to %.loc13_29.6 [template = constants.%.31]
// CHECK:STDOUT: %.loc13_29.8: i32 = int_value 2 [template = constants.%.31]
// CHECK:STDOUT: %.loc13_29.9: ref i32 = array_index %a.var, %.loc13_29.8
// CHECK:STDOUT: %.loc13_29.10: init i32 = initialize_from %.loc13_28 to %.loc13_29.9 [template = constants.%.1]
// CHECK:STDOUT: %.loc13_29.11: init %.2 = array_init (%.loc13_29.4, %.loc13_29.7, %.loc13_29.10) to %a.var [template = constants.%array]
// CHECK:STDOUT: %.loc13_30: init %.2 = converted %.loc13_29.1, %.loc13_29.11 [template = constants.%array]
// CHECK:STDOUT: %.loc13_29.11: init %.28 = array_init (%.loc13_29.4, %.loc13_29.7, %.loc13_29.10) to %a.var [template = constants.%array]
// CHECK:STDOUT: %.loc13_30: init %.28 = converted %.loc13_29.1, %.loc13_29.11 [template = constants.%array]
// CHECK:STDOUT: assign %a.var, %.loc13_30
// CHECK:STDOUT: %int.make_type_32.loc14_11: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %int.make_type_32.loc14_16: init type = call constants.%Int32() [template = i32]
Expand All @@ -87,14 +99,14 @@ fn G() {
// CHECK:STDOUT: %.loc14_24.8: type = converted %.loc14_24.1, constants.%tuple.type.1 [template = constants.%tuple.type.1]
// CHECK:STDOUT: %b.var: ref %tuple.type.1 = var b
// CHECK:STDOUT: %b: ref %tuple.type.1 = bind_name b, %b.var
// CHECK:STDOUT: %.loc14_29: i32 = int_value 1 [template = constants.%.4]
// CHECK:STDOUT: %.loc14_32: i32 = int_value 2 [template = constants.%.5]
// CHECK:STDOUT: %.loc14_29: i32 = int_value 1 [template = constants.%.30]
// CHECK:STDOUT: %.loc14_32: i32 = int_value 2 [template = constants.%.31]
// CHECK:STDOUT: %.loc14_35: i32 = int_value 3 [template = constants.%.1]
// CHECK:STDOUT: %.loc14_36.1: %tuple.type.1 = tuple_literal (%.loc14_29, %.loc14_32, %.loc14_35)
// CHECK:STDOUT: %.loc14_36.2: ref i32 = tuple_access %b.var, element0
// CHECK:STDOUT: %.loc14_36.3: init i32 = initialize_from %.loc14_29 to %.loc14_36.2 [template = constants.%.4]
// CHECK:STDOUT: %.loc14_36.3: init i32 = initialize_from %.loc14_29 to %.loc14_36.2 [template = constants.%.30]
// CHECK:STDOUT: %.loc14_36.4: ref i32 = tuple_access %b.var, element1
// CHECK:STDOUT: %.loc14_36.5: init i32 = initialize_from %.loc14_32 to %.loc14_36.4 [template = constants.%.5]
// CHECK:STDOUT: %.loc14_36.5: init i32 = initialize_from %.loc14_32 to %.loc14_36.4 [template = constants.%.31]
// CHECK:STDOUT: %.loc14_36.6: ref i32 = tuple_access %b.var, element2
// CHECK:STDOUT: %.loc14_36.7: init i32 = initialize_from %.loc14_35 to %.loc14_36.6 [template = constants.%.1]
// CHECK:STDOUT: %.loc14_36.8: init %tuple.type.1 = tuple_init (%.loc14_36.3, %.loc14_36.5, %.loc14_36.7) to %b.var [template = constants.%tuple]
Expand Down
28 changes: 20 additions & 8 deletions toolchain/check/testdata/array/assign_return_value.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,19 @@ fn Run() {
// CHECK:STDOUT: %Run.type: type = fn_type @Run [template]
// CHECK:STDOUT: %Run: %Run.type = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_value 1 [template]
// CHECK:STDOUT: %.3: type = array_type %.2, i32 [template]
// CHECK:STDOUT: %Convert.type.2: type = fn_type @Convert.1, @ImplicitAs(Core.IntLiteral) [template]
// CHECK:STDOUT: %Convert.type.15: type = fn_type @Convert.11 [template]
// CHECK:STDOUT: %Convert.15: %Convert.type.15 = struct_value () [template]
// CHECK:STDOUT: %.26: <witness> = interface_witness (%Convert.15) [template]
// CHECK:STDOUT: %.27: <bound method> = bound_method %.2, %Convert.15 [template]
// CHECK:STDOUT: %.28: Core.IntLiteral = int_value 1 [template]
// CHECK:STDOUT: %.29: type = array_type %.28, i32 [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
// CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
// CHECK:STDOUT: .Int32 = %import_ref
// CHECK:STDOUT: .Int32 = %import_ref.1
// CHECK:STDOUT: .ImplicitAs = %import_ref.2
// CHECK:STDOUT: import Core//prelude
// CHECK:STDOUT: import Core//prelude/...
// CHECK:STDOUT: }
Expand Down Expand Up @@ -73,12 +80,17 @@ fn Run() {
// CHECK:STDOUT: fn @Run() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc14_16: i32 = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc14_16.1: i32 = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc14_11.1: type = value_of_initializer %int.make_type_32 [template = i32]
// CHECK:STDOUT: %.loc14_11.2: type = converted %int.make_type_32, %.loc14_11.1 [template = i32]
// CHECK:STDOUT: %.loc14_17: type = array_type %.loc14_16, i32 [template = constants.%.3]
// CHECK:STDOUT: %t.var: ref %.3 = var t
// CHECK:STDOUT: %t: ref %.3 = bind_name t, %t.var
// CHECK:STDOUT: %.loc14_16.2: %Convert.type.2 = interface_witness_access constants.%.26, element0 [template = constants.%Convert.15]
// CHECK:STDOUT: %.loc14_16.3: <bound method> = bound_method %.loc14_16.1, %.loc14_16.2 [template = constants.%.27]
// CHECK:STDOUT: %int.convert_checked: init Core.IntLiteral = call %.loc14_16.3(%.loc14_16.1) [template = constants.%.28]
// CHECK:STDOUT: %.loc14_16.4: Core.IntLiteral = value_of_initializer %int.convert_checked [template = constants.%.28]
// CHECK:STDOUT: %.loc14_16.5: Core.IntLiteral = converted %.loc14_16.1, %.loc14_16.4 [template = constants.%.28]
// CHECK:STDOUT: %.loc14_17: type = array_type %.loc14_16.5, i32 [template = constants.%.29]
// CHECK:STDOUT: %t.var: ref %.29 = var t
// CHECK:STDOUT: %t: ref %.29 = bind_name t, %t.var
// CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [template = constants.%F]
// CHECK:STDOUT: %F.call: init %tuple.type.2 = call %F.ref()
// CHECK:STDOUT: %.loc14_22.1: ref %tuple.type.2 = temporary_storage
Expand All @@ -88,8 +100,8 @@ fn Run() {
// CHECK:STDOUT: %.loc14_22.5: i32 = int_value 0 [template = constants.%.1]
// CHECK:STDOUT: %.loc14_22.6: ref i32 = array_index %t.var, %.loc14_22.5
// CHECK:STDOUT: %.loc14_22.7: init i32 = initialize_from %.loc14_22.4 to %.loc14_22.6
// CHECK:STDOUT: %.loc14_22.8: init %.3 = array_init (%.loc14_22.7) to %t.var
// CHECK:STDOUT: %.loc14_24: init %.3 = converted %F.call, %.loc14_22.8
// CHECK:STDOUT: %.loc14_22.8: init %.29 = array_init (%.loc14_22.7) to %t.var
// CHECK:STDOUT: %.loc14_24: init %.29 = converted %F.call, %.loc14_22.8
// CHECK:STDOUT: assign %t.var, %.loc14_24
// CHECK:STDOUT: return
// CHECK:STDOUT: }
Expand Down
Loading

0 comments on commit 980ce6b

Please sign in to comment.