Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial support for binding patterns in SemIR #4221

Merged
merged 21 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions toolchain/check/eval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1401,6 +1401,14 @@ auto TryEvalInstInContext(EvalContext& eval_context, SemIR::InstId inst_id,
return MakeConstantResult(eval_context.context(), bind, Phase::Symbolic);
}

// TODO: Does it make sense to evaluate both BindSymbolicName and
// BindingPattern?
case CARBON_KIND(SemIR::BindingPattern pattern): {
auto bind_inst = eval_context.insts().Get(pattern.bind_inst_id);
return TryEvalInstInContext(eval_context, pattern.bind_inst_id,
bind_inst);
}

// These semantic wrappers don't change the constant value.
case CARBON_KIND(SemIR::AsCompatible inst): {
return eval_context.GetConstantValue(inst.source_id);
Expand Down
31 changes: 26 additions & 5 deletions toolchain/check/handle_binding_pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ static auto HandleAnyBindingPattern(Context& context, Parse::NodeId node_id,
auto push_bind_name = [&](SemIR::InstId bind_id) {
context.node_stack().Push(node_id, bind_id);
if (is_generic && !is_associated_constant) {
// TODO: this is a temporary workaround until bind_id has a more
// consistent kind.
if (auto binding_pattern =
context.insts().TryGetAs<SemIR::BindingPattern>(bind_id)) {
bind_id = binding_pattern->bind_inst_id;
}
context.scope_stack().PushCompileTimeBinding(bind_id);
}
};
Expand Down Expand Up @@ -158,8 +164,15 @@ static auto HandleAnyBindingPattern(Context& context, Parse::NodeId node_id,
// parameters.
auto param_id = context.AddInst<SemIR::Param>(
name_node, {.type_id = cast_type_id, .name_id = name_id});
auto bind_id = context.AddInst(make_bind_name(cast_type_id, param_id));
push_bind_name(bind_id);
SemIR::LocIdAndInst bind_name = make_bind_name(cast_type_id, param_id);
auto bind_id = context.AddInstInNoBlock(bind_name);
SemIR::InstId pattern_id = context.AddInst<SemIR::BindingPattern>(
name_node,
{.type_id = cast_type_id,
.entity_name_id =
bind_name.inst.As<SemIR::AnyBindName>().entity_name_id,
.bind_inst_id = bind_id});
push_bind_name(pattern_id);
// TODO: Bindings should come into scope immediately in other contexts
// too.
context.AddNameToLookup(name_id, bind_id);
Expand All @@ -178,8 +191,16 @@ static auto HandleAnyBindingPattern(Context& context, Parse::NodeId node_id,
// formed its initializer.
// TODO: For general pattern parsing, we'll need to create a block to hold
// the `let` pattern before we see the initializer.
auto bind_id = context.AddPlaceholderInstInNoBlock(
make_bind_name(cast_type_id, SemIR::InstId::Invalid));
SemIR::LocIdAndInst bind_name =
make_bind_name(cast_type_id, SemIR::InstId::Invalid);
auto bind_id = context.AddPlaceholderInstInNoBlock(bind_name);
if (!is_generic) {
context.AddInst<SemIR::BindingPattern>(
name_node, {.type_id = cast_type_id,
.entity_name_id =
bind_name.inst.As<SemIR::BindName>().entity_name_id,
.bind_inst_id = bind_id});
}
push_bind_name(bind_id);
break;
}
Expand All @@ -204,7 +225,7 @@ auto HandleParseNode(Context& context,
auto HandleParseNode(Context& context, Parse::AddrId node_id) -> bool {
auto self_param_id = context.node_stack().PopPattern();
if (auto self_param =
context.insts().TryGetAs<SemIR::AnyBindName>(self_param_id);
context.insts().TryGetAs<SemIR::BindingPattern>(self_param_id);
self_param &&
context.entity_names().Get(self_param->entity_name_id).name_id ==
SemIR::NameId::SelfValue) {
Expand Down
14 changes: 13 additions & 1 deletion toolchain/check/handle_pattern_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,19 @@ auto HandleParseNode(Context& context, Parse::TuplePatternId node_id) -> bool {
// make use of it.
auto refs_id = context.param_and_arg_refs_stack().EndAndPop(
Parse::NodeKind::TuplePatternStart);
context.node_stack().Push(node_id, refs_id);
// TODO: do this at full-pattern level.
llvm::SmallVector<SemIR::InstId> inner_param_insts;
auto refs_block = context.inst_blocks().Get(refs_id);
inner_param_insts.reserve(refs_block.size());
for (SemIR::InstId inst_id : refs_block) {
// TODO: generalize for other pattern kinds.
auto binding_pattern =
context.insts().GetAs<SemIR::BindingPattern>(inst_id);
context.inst_block_stack().AddInstId(binding_pattern.bind_inst_id);
inner_param_insts.push_back(binding_pattern.bind_inst_id);
}
auto inner_param_block = context.inst_blocks().Add(inner_param_insts);
context.node_stack().Push(node_id, inner_param_block);
return true;
}

Expand Down
30 changes: 29 additions & 1 deletion toolchain/check/import_ref.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,12 @@ class ImportRefResolver {
bind_id = addr->inner_id;
bind_inst = import_ir_.insts().Get(bind_id);
}

if (auto pattern = bind_inst.TryAs<SemIR::BindingPattern>()) {
bind_id = pattern->bind_inst_id;
bind_inst = import_ir_.insts().Get(bind_id);
}

auto bind_const_id = bind_inst.Is<SemIR::BindSymbolicName>()
? GetLocalConstantId(bind_id)
: SemIR::ConstantId::Invalid;
Expand Down Expand Up @@ -684,11 +690,20 @@ class ImportRefResolver {
auto inst = import_ir_.insts().Get(ref_id);
auto addr_inst = inst.TryAs<SemIR::AddrPattern>();

auto pattern_id = ref_id;
auto bind_id = ref_id;
auto param_id = ref_id;

if (addr_inst) {
bind_id = addr_inst->inner_id;
pattern_id = addr_inst->inner_id;
bind_id = pattern_id;
param_id = pattern_id;
inst = import_ir_.insts().Get(bind_id);
}

auto binding_pattern = inst.TryAs<SemIR::BindingPattern>();
if (binding_pattern) {
bind_id = binding_pattern->bind_inst_id;
param_id = bind_id;
inst = import_ir_.insts().Get(bind_id);
}
Expand Down Expand Up @@ -740,6 +755,16 @@ class ImportRefResolver {
}
}
}
if (binding_pattern) {
SemIR::EntityNameId new_name_id =
context_.insts()
.GetAs<SemIR::AnyBindName>(new_param_id)
.entity_name_id;
new_param_id = context_.AddInstInNoBlock<SemIR::BindingPattern>(
AddImportIRInst(pattern_id), {.type_id = type_id,
.entity_name_id = new_name_id,
.bind_inst_id = new_param_id});
}
if (addr_inst) {
new_param_id = context_.AddInstInNoBlock<SemIR::AddrPattern>(
AddImportIRInst(ref_id),
Expand Down Expand Up @@ -984,6 +1009,9 @@ class ImportRefResolver {
case CARBON_KIND(SemIR::BindSymbolicName inst): {
return TryResolveTypedInst(inst);
}
case CARBON_KIND(SemIR::BindingPattern inst): {
return TryResolveInst(inst.bind_inst_id, const_id);
}
case CARBON_KIND(SemIR::ClassDecl inst): {
return TryResolveTypedInst(inst, const_id);
}
Expand Down
11 changes: 11 additions & 0 deletions toolchain/check/merge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,17 @@ static auto CheckRedeclParam(Context& context,
}
}

if (new_param_ref.Is<SemIR::BindingPattern>()) {
new_param_ref = context.insts().Get(
new_param_ref.As<SemIR::BindingPattern>().bind_inst_id);
prev_param_ref = context.insts().Get(
prev_param_ref.As<SemIR::BindingPattern>().bind_inst_id);
if (new_param_ref.kind() != prev_param_ref.kind()) {
diagnose();
return false;
}
}

if (new_param_ref.Is<SemIR::AnyBindName>()) {
new_param_ref =
context.insts().Get(new_param_ref.As<SemIR::AnyBindName>().value_id);
Expand Down
1 change: 1 addition & 0 deletions toolchain/check/testdata/alias/fail_bool_value.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ let a_test: bool = a;
// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [template = bool]
// CHECK:STDOUT: %.loc15_13.1: type = value_of_initializer %bool.make_type [template = bool]
// CHECK:STDOUT: %.loc15_13.2: type = converted %bool.make_type, %.loc15_13.1 [template = bool]
// CHECK:STDOUT: %.loc15_5: bool = binding_pattern a_test, @__global_init.%a_test
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Bool() -> type = "bool.make_type";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ let d: c = {};
// CHECK:STDOUT: %b.ref: type = name_ref b, %b [template = constants.%C]
// CHECK:STDOUT: %c: type = bind_alias c, %b [template = constants.%C]
// CHECK:STDOUT: %c.ref: type = name_ref c, %c [template = constants.%C]
// CHECK:STDOUT: %.loc15: %C = binding_pattern d, @__global_init.%d
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: class @C {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ let c_var: c = d;
// CHECK:STDOUT: %d.var: ref %D = var d
// CHECK:STDOUT: %d: ref %D = bind_name d, %d.var
// CHECK:STDOUT: %c.ref: type = name_ref c, %c [template = constants.%C]
// CHECK:STDOUT: %.loc20: %C = binding_pattern c_var, @__global_init.%c_var
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: class @C {
Expand Down
7 changes: 4 additions & 3 deletions toolchain/check/testdata/alias/no_prelude/fail_params.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ alias A(T:! type) = T*;
// CHECK:STDOUT: .A = %A
// CHECK:STDOUT: }
// CHECK:STDOUT: %T.loc18_9.1: type = param T
// CHECK:STDOUT: %T.loc18_9.2: type = bind_symbolic_name T 0, %T.loc18_9.1 [symbolic = constants.%T]
// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc18_9.2 [symbolic = constants.%T]
// CHECK:STDOUT: %.loc18: type = ptr_type %T [symbolic = constants.%.1]
// CHECK:STDOUT: %.loc18_9: type = binding_pattern T 0, %T.loc18_9.3 [symbolic = constants.%T]
// CHECK:STDOUT: %T.loc18_9.3: type = bind_symbolic_name T 0, %T.loc18_9.1 [symbolic = constants.%T]
// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc18_9.3 [symbolic = constants.%T]
// CHECK:STDOUT: %.loc18_22: type = ptr_type %T [symbolic = constants.%.1]
// CHECK:STDOUT: %A: <error> = bind_alias A, <error> [template = <error>]
// CHECK:STDOUT: }
// CHECK:STDOUT:
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ fn F() -> NS.a {
// CHECK:STDOUT: %a: type = bind_alias a, %C.decl [template = constants.%C]
// CHECK:STDOUT: %NS.ref.loc16: <namespace> = name_ref NS, %NS [template = %NS]
// CHECK:STDOUT: %a.ref.loc16: type = name_ref a, %a [template = constants.%C]
// CHECK:STDOUT: %.loc16: %C = binding_pattern b, @__global_init.%b
// CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
// CHECK:STDOUT: %NS.ref.loc18: <namespace> = name_ref NS, %NS [template = %NS]
// CHECK:STDOUT: %a.ref.loc18: type = name_ref a, %a [template = constants.%C]
Expand Down
2 changes: 1 addition & 1 deletion toolchain/check/testdata/array/base.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var c: [(); 5] = ((), (), (), (), (),);
// CHECK:STDOUT: import Core//prelude/types/bool
// CHECK:STDOUT: }
// CHECK:STDOUT: %import_ref.1: %Int32.type = import_ref Core//prelude/types, inst+4, loaded [template = constants.%Int32]
// CHECK:STDOUT: %import_ref.2: %Float.type = import_ref Core//prelude/types, inst+32, loaded [template = constants.%Float]
// CHECK:STDOUT: %import_ref.2: %Float.type = import_ref Core//prelude/types, inst+35, loaded [template = constants.%Float]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
Expand Down
5 changes: 4 additions & 1 deletion toolchain/check/testdata/array/canonicalize_index.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@ let b: [i32; 3]* = &a;
// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32.loc11_11 [template = i32]
// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32.loc11_11, %.loc11_11.1 [template = i32]
// CHECK:STDOUT: %a.loc11_8.1: i32 = param a
// CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc11_8.1
// CHECK:STDOUT: %.loc11_8: i32 = binding_pattern a, @Add.%a
// CHECK:STDOUT: %int.make_type_32.loc11_19: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc11_19.1: type = value_of_initializer %int.make_type_32.loc11_19 [template = i32]
// CHECK:STDOUT: %.loc11_19.2: type = converted %int.make_type_32.loc11_19, %.loc11_19.1 [template = i32]
// CHECK:STDOUT: %b.loc11_16.1: i32 = param b
// CHECK:STDOUT: %.loc11_16: i32 = binding_pattern b, @Add.%b
// CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc11_8.1
// CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc11_16.1
// CHECK:STDOUT: %int.make_type_32.loc11_27: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc11_27.1: type = value_of_initializer %int.make_type_32.loc11_27 [template = i32]
Expand All @@ -85,6 +87,7 @@ let b: [i32; 3]* = &a;
// CHECK:STDOUT: %.loc14_9.2: type = converted %int.make_type_32.loc14, %.loc14_9.1 [template = i32]
// CHECK:STDOUT: %.loc14_15: type = array_type %.loc14_14, i32 [template = constants.%.5]
// CHECK:STDOUT: %.loc14_16: type = ptr_type %.5 [template = constants.%.6]
// CHECK:STDOUT: %.loc14_5: %.6 = binding_pattern b, @__global_init.%b
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
Expand Down
1 change: 1 addition & 0 deletions toolchain/check/testdata/array/fail_bound_negative.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ var a: [i32; Negate(1)];
// CHECK:STDOUT: %.loc11_14.1: type = value_of_initializer %int.make_type_32.loc11_14 [template = i32]
// CHECK:STDOUT: %.loc11_14.2: type = converted %int.make_type_32.loc11_14, %.loc11_14.1 [template = i32]
// CHECK:STDOUT: %n.loc11_11.1: i32 = param n
// CHECK:STDOUT: %.loc11_11: i32 = binding_pattern n, @Negate.%n
// CHECK:STDOUT: @Negate.%n: i32 = bind_name n, %n.loc11_11.1
// CHECK:STDOUT: %int.make_type_32.loc11_22: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc11_22.1: type = value_of_initializer %int.make_type_32.loc11_22 [template = i32]
Expand Down
4 changes: 3 additions & 1 deletion toolchain/check/testdata/array/function_param.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ fn G() -> i32 {
// CHECK:STDOUT: %.loc11_12.2: type = converted %int.make_type_32.loc11_12, %.loc11_12.1 [template = i32]
// CHECK:STDOUT: %.loc11_18: type = array_type %.loc11_17, i32 [template = constants.%.3]
// CHECK:STDOUT: %arr.loc11_6.1: %.3 = param arr
// CHECK:STDOUT: @F.%arr: %.3 = bind_name arr, %arr.loc11_6.1
// CHECK:STDOUT: %.loc11_6: %.3 = binding_pattern arr, @F.%arr
// CHECK:STDOUT: %int.make_type_32.loc11_24: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc11_24.1: type = value_of_initializer %int.make_type_32.loc11_24 [template = i32]
// CHECK:STDOUT: %.loc11_24.2: type = converted %int.make_type_32.loc11_24, %.loc11_24.1 [template = i32]
// CHECK:STDOUT: %i.loc11_21.1: i32 = param i
// CHECK:STDOUT: %.loc11_21: i32 = binding_pattern i, @F.%i
// CHECK:STDOUT: @F.%arr: %.3 = bind_name arr, %arr.loc11_6.1
// CHECK:STDOUT: @F.%i: i32 = bind_name i, %i.loc11_21.1
// CHECK:STDOUT: %int.make_type_32.loc11_32: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc11_32.1: type = value_of_initializer %int.make_type_32.loc11_32 [template = i32]
Expand Down
1 change: 1 addition & 0 deletions toolchain/check/testdata/array/generic_empty.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ fn G(T:! type) {
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
// CHECK:STDOUT: %T.loc11_6.1: type = param T
// CHECK:STDOUT: %.loc11: type = binding_pattern T 0, @G.%T.loc11 [symbolic = @G.%T.1 (constants.%T)]
// CHECK:STDOUT: @G.%T.loc11: type = bind_symbolic_name T 0, %T.loc11_6.1 [symbolic = @G.%T.1 (constants.%T)]
// CHECK:STDOUT: }
// CHECK:STDOUT: }
Expand Down
9 changes: 8 additions & 1 deletion toolchain/check/testdata/as/adapter_conversion.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,12 @@ var b: B = {.x = 1} as B;
// CHECK:STDOUT: %a_ref.var: ref %A = var a_ref
// CHECK:STDOUT: %a_ref: ref %A = bind_name a_ref, %a_ref.var
// CHECK:STDOUT: %A.ref.loc18: type = name_ref A, %A.decl [template = constants.%A]
// CHECK:STDOUT: %.loc18: %A = binding_pattern a_val, @__global_init.%a_val
// CHECK:STDOUT: %B.ref.loc21: type = name_ref B, %B.decl [template = constants.%B]
// CHECK:STDOUT: %.loc21: %B = binding_pattern b_val, @__global_init.%b_val
// CHECK:STDOUT: %B.ref.loc22: type = name_ref B, %B.decl [template = constants.%B]
// CHECK:STDOUT: %.loc22: type = ptr_type %B [template = constants.%.7]
// CHECK:STDOUT: %.loc22_13: type = ptr_type %B [template = constants.%.7]
// CHECK:STDOUT: %.loc22_5: %.7 = binding_pattern b_ptr, @__global_init.%b_ptr
// CHECK:STDOUT: %B.ref.loc24: type = name_ref B, %B.decl [template = constants.%B]
// CHECK:STDOUT: %b_factory.var: ref %B = var b_factory
// CHECK:STDOUT: %b_factory: ref %B = bind_name b_factory, %b_factory.var
Expand Down Expand Up @@ -277,9 +280,11 @@ var b: B = {.x = 1} as B;
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {}
// CHECK:STDOUT: %A.ref: type = name_ref A, %A.decl [template = constants.%A]
// CHECK:STDOUT: %.loc8: %A = binding_pattern a, @__global_init.%a
// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc9_8.1: type = value_of_initializer %int.make_type_32 [template = i32]
// CHECK:STDOUT: %.loc9_8.2: type = converted %int.make_type_32, %.loc9_8.1 [template = i32]
// CHECK:STDOUT: %.loc9_5: i32 = binding_pattern n, @__global_init.%n
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: class @A {
Expand Down Expand Up @@ -353,6 +358,7 @@ var b: B = {.x = 1} as B;
// CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {}
// CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {}
// CHECK:STDOUT: %D.ref: type = name_ref D, %D.decl [template = constants.%D]
// CHECK:STDOUT: %.loc9: %D = binding_pattern d, @__global_init.%d
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: class @A {
Expand Down Expand Up @@ -441,6 +447,7 @@ var b: B = {.x = 1} as B;
// CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {}
// CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {}
// CHECK:STDOUT: %B.ref.loc13: type = name_ref B, %B.decl [template = constants.%B]
// CHECK:STDOUT: %.loc13: %B = binding_pattern b_value, @__global_init.%b_value
// CHECK:STDOUT: %B.ref.loc24: type = name_ref B, %B.decl [template = constants.%B]
// CHECK:STDOUT: %b_init.var: ref %B = var b_init
// CHECK:STDOUT: %b_init: ref %B = bind_name b_init, %b_init.var
Expand Down
1 change: 1 addition & 0 deletions toolchain/check/testdata/as/as_type.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ let t: type = (i32, i32) as type;
// CHECK:STDOUT: .t = @__global_init.%t
// CHECK:STDOUT: }
// CHECK:STDOUT: %Core.import = import Core
// CHECK:STDOUT: %.loc11: type = binding_pattern t, @__global_init.%t
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
Expand Down
1 change: 1 addition & 0 deletions toolchain/check/testdata/as/fail_no_conversion.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ let n: (i32, i32) = 1 as (i32, i32);
// CHECK:STDOUT: %.loc14_17.4: type = value_of_initializer %int.make_type_32.loc14_14 [template = i32]
// CHECK:STDOUT: %.loc14_17.5: type = converted %int.make_type_32.loc14_14, %.loc14_17.4 [template = i32]
// CHECK:STDOUT: %.loc14_17.6: type = converted %.loc14_17.1, constants.%.3 [template = constants.%.3]
// CHECK:STDOUT: %.loc14_5: %.3 = binding_pattern n, @__global_init.%n
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
Expand Down
1 change: 1 addition & 0 deletions toolchain/check/testdata/as/fail_not_type.carbon
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ let n: i32 = 1 as 2;
// CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc14_8.1: type = value_of_initializer %int.make_type_32 [template = i32]
// CHECK:STDOUT: %.loc14_8.2: type = converted %int.make_type_32, %.loc14_8.1 [template = i32]
// CHECK:STDOUT: %.loc14_5: i32 = binding_pattern n, @__global_init.%n
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
Expand Down
Loading