Add a Core.Array class type, and make array refer to it. (#7892)

As described in proposal #4682, make `array(T, N)` be syntactic sugar
for the type `Core.Array` defined in the standard library. This provides
a home for impls that are specific to `Core.Array`.

Assisted-by: Gemini and Claude via Antigravity
This commit is contained in:
Richard Smith authored and GitHub committed 2026-10-06 17:23:49 +00:00
1 parent a50feb64ce
commit 947c1eb527
131 files changed
+9007 -8238

No files matched your search

+3 -8
View File
@@ -17,6 +17,7 @@
#include "toolchain/check/custom_witness.h"
#include "toolchain/check/function.h"
#include "toolchain/check/inst.h"
#include "toolchain/check/literal.h"
#include "toolchain/check/name_lookup.h"
#include "toolchain/check/pattern.h"
#include "toolchain/check/type.h"
@@ -255,15 +256,9 @@ static auto MakeCppStdInitializerListMake(Context& context, SemIR::LocId loc_id,
.type_id = GetSingletonType(
context, SemIR::IntLiteralType::TypeInstId),
.int_id = context.ints().Add(size)}));
auto array_type_inst_id = AddTypeInst(
context,
SemIR::LocIdAndInst::RuntimeVerified(
context.sem_ir(), loc_id,
SemIR::ArrayType{.type_id = SemIR::TypeType::TypeId,
.bound_id = bound_id,
.element_type_inst_id = element_type_inst_id}));
auto array_type_id =
context.types().GetTypeIdForTypeInstId(array_type_inst_id);
MakeArrayType(context, loc_id, element_type_inst_id, bound_id).type_id;
TryToCompleteType(context, array_type_id, loc_id);
// Create a builtin function to perform the conversion from array type to
// initializer list type. We name the synthesized function as if it were a