Emit NameBindingDecl after the initializer (if any) (#7467)

In some cases the pattern block can depend on the initializer, so it
must be sequenced after it. See #7469 for a more detailed explanation of
why this is necessary.
This commit is contained in:
Geoff Romer
2026-07-07 19:18:33 +00:00
committed by GitHub
parent ae3c4266d4
commit 8945305dfc
310 changed files with 3375 additions and 3366 deletions
+4 -4
View File
@@ -135,10 +135,6 @@ fn F(b: bool, n: i32, m: i32) -> i32 {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F(%b.param: bool, %n.param: %i32, %m.param: %i32) -> out %return.param: %i32 {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %x.patt: %pattern_type.97e = ref_binding_pattern x [concrete = constants.%x.patt]
// CHECK:STDOUT: %x.var_patt: %pattern_type.97e = var_pattern %x.patt [concrete = constants.%x.var_patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %x.var: ref %array_type = var_storage %x.var_patt
// CHECK:STDOUT: %int_0.loc16_27: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
// CHECK:STDOUT: %.loc16_29.1: %tuple.type.985 = tuple_literal (%int_0.loc16_27) [concrete = constants.%tuple.4f2]
@@ -160,6 +156,10 @@ fn F(b: bool, n: i32, m: i32) -> i32 {
// CHECK:STDOUT: %array_type: type = array_type %int_1, %i32.loc16 [concrete = constants.%array_type]
// CHECK:STDOUT: }
// CHECK:STDOUT: %x: ref %array_type = wrapper_binding x, %x.var
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %x.patt: %pattern_type.97e = ref_binding_pattern x [concrete = constants.%x.patt]
// CHECK:STDOUT: %x.var_patt: %pattern_type.97e = var_pattern %x.patt [concrete = constants.%x.var_patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %b.ref: bool = name_ref b, %b
// CHECK:STDOUT: if %b.ref br !if.expr.then else br !if.expr.else
// CHECK:STDOUT: