mirror of
https://github.com/ziglang/zig.git
synced 2026-02-14 05:20:34 +00:00
Sema: zirArrayType does need source location
This commit is contained in:
parent
ab88165326
commit
92c4e4f2c2
@ -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);
|
||||
|
||||
11
test/cases/compile_errors/invalid_array_elem_ty.zig
Normal file
11
test/cases/compile_errors/invalid_array_elem_ty.zig
Normal 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
|
||||
Loading…
x
Reference in New Issue
Block a user