Convert the scrutinee of a binding pattern to the right category. (#5662)

When the binding pattern appears within a `var` pattern, convert to a
reference. Otherwise, convert to a value.

This gets the advent of code examples to produce the right answers again
:)

---------

Co-authored-by: Geoff Romer <gromer@google.com>
This commit is contained in:
Richard Smith
2025-06-17 16:45:19 +00:00
committed by GitHub
co-authored by Geoff Romer
parent 1c09de9b87
commit 80529aaef9
29 changed files with 317 additions and 260 deletions
@@ -77,9 +77,10 @@ fn F(T:! type) {
// CHECK:STDOUT: }
// CHECK:STDOUT: %p.ref: ref @F.%ptr.loc16_11.2 (%ptr) = name_ref p, %p
// CHECK:STDOUT: %.loc17_15: @F.%ptr.loc16_11.2 (%ptr) = bind_value %p.ref
// CHECK:STDOUT: %.loc17_14: ref @F.%T.loc15_6.2 (%T) = deref %.loc17_15
// CHECK:STDOUT: %.loc17_14.1: ref @F.%T.loc15_6.2 (%T) = deref %.loc17_15
// CHECK:STDOUT: %T.ref.loc17: type = name_ref T, %T.loc15_6.1 [symbolic = %T.loc15_6.2 (constants.%T)]
// CHECK:STDOUT: %n: ref @F.%T.loc15_6.2 (%T) = bind_name n, %.loc17_14
// CHECK:STDOUT: %.loc17_14.2: @F.%T.loc15_6.2 (%T) = bind_value %.loc17_14.1
// CHECK:STDOUT: %n: @F.%T.loc15_6.2 (%T) = bind_name n, %.loc17_14.2
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT: }