Separate binding insts for refs and values (#6235)

This resolves a TODO in `expr_info.cpp` by using the inst kind rather
than the bound value to track the binding's category.

Since we're churning all the `bind_name` insts in testdata anyway, I'm
also taking this opportunity to align the inst naming with the design's
terminology, by calling these insts "bindings" (this aspect of the PR is
dependent on #6231 resolving an ambiguity in that terminology). For
consistency we'll need to rename several other insts as well (see the
TODO on `RefBinding`); I'm deferring that to a separate PR to minimize
the review load, but I think those name changes are in-scope for this
review.
This commit is contained in:
Geoff Romer
2025-10-23 01:46:24 +00:00
committed by GitHub
parent c0879b2200
commit 09710d102f
435 changed files with 4380 additions and 4306 deletions
@@ -172,7 +172,7 @@ fn F() {
// CHECK:STDOUT: fn @F() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %n.patt: %pattern_type.b6e = binding_pattern n [concrete]
// CHECK:STDOUT: %n.patt: %pattern_type.b6e = ref_binding_pattern n [concrete]
// CHECK:STDOUT: %n.var_patt: %pattern_type.b6e = var_pattern %n.patt [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %n.var: ref %array_type = var %n.var_patt
@@ -182,7 +182,7 @@ fn F() {
// CHECK:STDOUT: %int_42: Core.IntLiteral = int_value 42 [concrete = constants.%int_42]
// CHECK:STDOUT: %array_type: type = array_type %int_42, %i32.loc10 [concrete = constants.%array_type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %n: ref %array_type = bind_name n, %n.var
// CHECK:STDOUT: %n: ref %array_type = ref_binding n, %n.var
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesArray.ref: %TakesArray.cpp_overload_set.type = name_ref TakesArray, imports.%TakesArray.cpp_overload_set.value [concrete = constants.%TakesArray.cpp_overload_set.value]
// CHECK:STDOUT: %n.ref: ref %array_type = name_ref n, %n
@@ -290,7 +290,7 @@ fn F() {
// CHECK:STDOUT: %Cpp.ref.loc26_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Function.ref: %Function.cpp_overload_set.type = name_ref Function, imports.%Function.cpp_overload_set.value [concrete = constants.%Function.cpp_overload_set.value]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %n.patt: %pattern_type.b6e = binding_pattern n [concrete]
// CHECK:STDOUT: %n.patt: %pattern_type.b6e = ref_binding_pattern n [concrete]
// CHECK:STDOUT: %n.var_patt: %pattern_type.b6e = var_pattern %n.patt [concrete]
// CHECK:STDOUT: }
// CHECK:STDOUT: %n.var: ref %array_type = var %n.var_patt
@@ -300,7 +300,7 @@ fn F() {
// CHECK:STDOUT: %int_42: Core.IntLiteral = int_value 42 [concrete = constants.%int_42]
// CHECK:STDOUT: %array_type: type = array_type %int_42, %i32.loc28 [concrete = constants.%array_type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %n: ref %array_type = bind_name n, %n.var
// CHECK:STDOUT: %n: ref %array_type = ref_binding n, %n.var
// CHECK:STDOUT: %Cpp.ref.loc37: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesFunction.ref.loc37: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value]
// CHECK:STDOUT: %n.ref: ref %array_type = name_ref n, %n