Convert array bounds to IntLiteral. (#4526)

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.
This commit is contained in:
Richard Smith
2024-11-15 22:09:31 +00:00
committed by GitHub
parent a65cde6ae2
commit 980ce6b25a
62 changed files with 2869 additions and 1432 deletions
@@ -47,6 +47,8 @@ fn F(n: i32, a: [i32; n]*);
// CHECK:STDOUT: %.loc14_9.2: type = converted %int.make_type_32.loc14_9, %.loc14_9.1 [template = i32]
// CHECK:STDOUT: %int.make_type_32.loc14_18: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %n.ref: i32 = name_ref n, %n
// CHECK:STDOUT: %.loc14_18.1: type = value_of_initializer %int.make_type_32.loc14_18 [template = i32]
// CHECK:STDOUT: %.loc14_18.2: type = converted %int.make_type_32.loc14_18, %.loc14_18.1 [template = i32]
// CHECK:STDOUT: %.loc14_25: type = ptr_type <error> [template = <error>]
// CHECK:STDOUT: %n.param: i32 = value_param runtime_param0
// CHECK:STDOUT: %n: i32 = bind_name n, %n.param