sema: strip @splat operand result type before checking it
This commit is contained in:
committed by
Matthew Lugg
parent
6e90ce2536
commit
8e02f9f70d
@@ -2697,7 +2697,7 @@ fn addEnsureResult(gz: *GenZir, maybe_unused_result: Zir.Inst.Ref, statement: As
|
||||
.array_type_sentinel,
|
||||
.elem_type,
|
||||
.indexable_ptr_elem_type,
|
||||
.vec_arr_elem_type,
|
||||
.splat_op_result_ty,
|
||||
.vector_type,
|
||||
.indexable_ptr_len,
|
||||
.anyframe_type,
|
||||
@@ -9526,10 +9526,9 @@ fn builtinCall(
|
||||
});
|
||||
return rvalue(gz, ri, result, node);
|
||||
},
|
||||
|
||||
.splat => {
|
||||
const result_type = try ri.rl.resultTypeForCast(gz, node, builtin_name);
|
||||
const elem_type = try gz.addUnNode(.vec_arr_elem_type, result_type, node);
|
||||
const elem_type = try gz.addUnNode(.splat_op_result_ty, result_type, node);
|
||||
const scalar = try expr(gz, scope, .{ .rl = .{ .ty = elem_type } }, params[0]);
|
||||
const result = try gz.addPlNode(.splat, node, Zir.Inst.Bin{
|
||||
.lhs = result_type,
|
||||
|
||||
@@ -273,9 +273,13 @@ pub const Inst = struct {
|
||||
/// element type. Emits a compile error if the type is not an indexable pointer.
|
||||
/// Uses the `un_node` field.
|
||||
indexable_ptr_elem_type,
|
||||
/// Given a vector or array type, returns its element type.
|
||||
/// Given a vector or array type, strips off any error unions or
|
||||
/// optionals layered on top and returns its element type.
|
||||
///
|
||||
/// `!?[N]T` -> `T`
|
||||
///
|
||||
/// Uses the `un_node` field.
|
||||
vec_arr_elem_type,
|
||||
splat_op_result_ty,
|
||||
/// Given a pointer to an indexable object, returns the len property. This is
|
||||
/// used by for loops. This instruction also emits a for-loop specific compile
|
||||
/// error if the indexable object is not indexable.
|
||||
@@ -1098,7 +1102,7 @@ pub const Inst = struct {
|
||||
.vector_type,
|
||||
.elem_type,
|
||||
.indexable_ptr_elem_type,
|
||||
.vec_arr_elem_type,
|
||||
.splat_op_result_ty,
|
||||
.indexable_ptr_len,
|
||||
.anyframe_type,
|
||||
.as_node,
|
||||
@@ -1395,7 +1399,7 @@ pub const Inst = struct {
|
||||
.vector_type,
|
||||
.elem_type,
|
||||
.indexable_ptr_elem_type,
|
||||
.vec_arr_elem_type,
|
||||
.splat_op_result_ty,
|
||||
.indexable_ptr_len,
|
||||
.anyframe_type,
|
||||
.as_node,
|
||||
@@ -1630,7 +1634,7 @@ pub const Inst = struct {
|
||||
.vector_type = .pl_node,
|
||||
.elem_type = .un_node,
|
||||
.indexable_ptr_elem_type = .un_node,
|
||||
.vec_arr_elem_type = .un_node,
|
||||
.splat_op_result_ty = .un_node,
|
||||
.indexable_ptr_len = .un_node,
|
||||
.anyframe_type = .un_node,
|
||||
.as_node = .pl_node,
|
||||
@@ -4173,7 +4177,7 @@ fn findTrackableInner(
|
||||
.vector_type,
|
||||
.elem_type,
|
||||
.indexable_ptr_elem_type,
|
||||
.vec_arr_elem_type,
|
||||
.splat_op_result_ty,
|
||||
.indexable_ptr_len,
|
||||
.anyframe_type,
|
||||
.as_node,
|
||||
|
||||
Reference in New Issue
Block a user