Sema: zirArrayType does need source location

This commit is contained in:
Veikka Tuominen 2022-05-26 12:42:50 +03:00
parent ab88165326
commit 92c4e4f2c2
2 changed files with 15 additions and 2 deletions

View File

@ -5814,8 +5814,10 @@ fn zirArrayType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
defer tracy.end();
const bin_inst = sema.code.instructions.items(.data)[inst].bin;
const len = try sema.resolveInt(block, .unneeded, bin_inst.lhs, Type.usize);
const elem_type = try sema.resolveType(block, .unneeded, bin_inst.rhs);
const len_src = sema.src; // TODO better source location
const elem_src = sema.src; // TODO better source location
const len = try sema.resolveInt(block, len_src, bin_inst.lhs, Type.usize);
const elem_type = try sema.resolveType(block, elem_src, bin_inst.rhs);
const array_ty = try Type.array(sema.arena, len, null, elem_type, sema.mod);
return sema.addType(array_ty);

View File

@ -0,0 +1,11 @@
pub fn S() type {
return struct {};
}
pub export fn entry() void {
_ = [0]S;
}
// error
// backend=stage2,llvm
//
// :4:1: error: expected type, found fn() type