Skip to content

Commit

Permalink
correctly resolve element type of array literal
Browse files Browse the repository at this point in the history
  • Loading branch information
Techatrix committed Feb 19, 2024
1 parent 54eaba2 commit 47ddbc3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/analysis.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1541,9 +1541,9 @@ fn resolveTypeOfNodeUncached(analyser: *Analyser, node_handle: NodeWithHandle) e
}

// try to infer the array type
const maybe_elem_ty = try analyser.resolveTypeOfNodeInternal(.{ .node = array_init_info.ast.elements[0], .handle = handle });
const elem_ty = if (maybe_elem_ty) |elem_ty| elem_ty.typeOf(analyser) else try Type.typeValFromIP(analyser, .type_type);

const elem_ty = try analyser.resolveTypeOfNodeInternal(.{ .node = array_init_info.ast.elements[0], .handle = handle }) orelse
try Type.typeValFromIP(analyser, .unknown_type);
const elem_ty_ptr = try analyser.arena.allocator().create(Type);
elem_ty_ptr.* = elem_ty;

Expand Down

0 comments on commit 47ddbc3

Please sign in to comment.