parent
3e94650ef7
commit
a76a72469b
@ -15474,6 +15474,8 @@ static TypeTableEntry *ir_analyze_instruction_asm(IrAnalyze *ira, IrInstructionA
|
|||||||
static TypeTableEntry *ir_analyze_instruction_array_type(IrAnalyze *ira,
|
static TypeTableEntry *ir_analyze_instruction_array_type(IrAnalyze *ira,
|
||||||
IrInstructionArrayType *array_type_instruction)
|
IrInstructionArrayType *array_type_instruction)
|
||||||
{
|
{
|
||||||
|
Error err;
|
||||||
|
|
||||||
IrInstruction *size_value = array_type_instruction->size->other;
|
IrInstruction *size_value = array_type_instruction->size->other;
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
if (!ir_resolve_usize(ira, size_value, &size))
|
if (!ir_resolve_usize(ira, size_value, &size))
|
||||||
@ -15515,6 +15517,8 @@ static TypeTableEntry *ir_analyze_instruction_array_type(IrAnalyze *ira,
|
|||||||
case TypeTableEntryIdBoundFn:
|
case TypeTableEntryIdBoundFn:
|
||||||
case TypeTableEntryIdPromise:
|
case TypeTableEntryIdPromise:
|
||||||
{
|
{
|
||||||
|
if ((err = ensure_complete_type(ira->codegen, child_type)))
|
||||||
|
return ira->codegen->builtin_types.entry_invalid;
|
||||||
TypeTableEntry *result_type = get_array_type(ira->codegen, child_type, size);
|
TypeTableEntry *result_type = get_array_type(ira->codegen, child_type, size);
|
||||||
ConstExprValue *out_val = ir_build_const_from(ira, &array_type_instruction->base);
|
ConstExprValue *out_val = ir_build_const_from(ira, &array_type_instruction->base);
|
||||||
out_val->data.x_type = result_type;
|
out_val->data.x_type = result_type;
|
||||||
|
@ -1,6 +1,19 @@
|
|||||||
const tests = @import("tests.zig");
|
const tests = @import("tests.zig");
|
||||||
|
|
||||||
pub fn addCases(cases: *tests.CompileErrorContext) void {
|
pub fn addCases(cases: *tests.CompileErrorContext) void {
|
||||||
|
cases.add(
|
||||||
|
"invalid type used in array type",
|
||||||
|
\\const Item = struct {
|
||||||
|
\\ field: SomeNonexistentType,
|
||||||
|
\\};
|
||||||
|
\\var items: [100]Item = undefined;
|
||||||
|
\\export fn entry() void {
|
||||||
|
\\ const a = items[0];
|
||||||
|
\\}
|
||||||
|
,
|
||||||
|
".tmp_source.zig:2:12: error: use of undeclared identifier 'SomeNonexistentType'",
|
||||||
|
);
|
||||||
|
|
||||||
cases.add(
|
cases.add(
|
||||||
"@noInlineCall on an inline function",
|
"@noInlineCall on an inline function",
|
||||||
\\inline fn foo() void {}
|
\\inline fn foo() void {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user