authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-05-31 16:21:36+03:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-05-31 16:22:00+03:00
logfebc7d3cd63eefe91c7aaa95e3a274a0b44e353e
tree67ef6d579402767c8c359fabd98f11026a03eac0
parent83beed09e1ce5a15e2b9801a50cf601352d8383e

Sema: take `dbg_stmt` into account in `zirResolveInferredAlloc`


2 files changed, 11 insertions(+), 1 deletions(-)

src/Sema.zig+1-1
...@@ -2976,7 +2976,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com...@@ -2976,7 +2976,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com
29762976
2977 // Even though we reuse the constant instruction, we still remove it from the2977 // Even though we reuse the constant instruction, we still remove it from the
2978 // block so that codegen does not see it.2978 // block so that codegen does not see it.
2979 block.instructions.shrinkRetainingCapacity(block.instructions.items.len - 3);2979 block.instructions.shrinkRetainingCapacity(search_index);
2980 sema.air_values.items[value_index] = try Value.Tag.decl_ref.create(sema.arena, new_decl_index);2980 sema.air_values.items[value_index] = try Value.Tag.decl_ref.create(sema.arena, new_decl_index);
2981 // if bitcast ty ref needs to be made const, make_ptr_const2981 // if bitcast ty ref needs to be made const, make_ptr_const
2982 // ZIR handles it later, so we can just use the ty ref here.2982 // ZIR handles it later, so we can just use the ty ref here.
test/behavior/basic.zig+10
...@@ -977,3 +977,13 @@ test "weird array and tuple initializations" {...@@ -977,3 +977,13 @@ test "weird array and tuple initializations" {
977 .b = if (a) .{ .e = .a } else .{ .e = .b },977 .b = if (a) .{ .e = .a } else .{ .e = .b },
978 };978 };
979}979}
980
981test "array type comes from generic function" {
982 const S = struct {
983 fn A() type {
984 return struct { a: u8 = 0 };
985 }
986 };
987 const args = [_]S.A(){.{}};
988 _ = args;
989}