Validate vector types for @Vector

This commit is contained in:
Tadeo Kondrak 2020-04-28 00:24:28 -06:00
parent 01605a7742
commit 249938dde0
No known key found for this signature in database
GPG Key ID: D41E092CA43F1D8B

View File

@ -25426,6 +25426,10 @@ static ZigType *type_info_to_type(IrAnalyze *ira, IrInst *source_instr, ZigTypeI
assert(payload->type == ir_type_info_get_type(ira, "Vector", nullptr));
BigInt *len = get_const_field_lit_int(ira, source_instr->source_node, payload, "len", 0);
ZigType *child_type = get_const_field_meta_type(ira, source_instr->source_node, payload, "child", 1);
Error err;
if ((err = ir_validate_vector_elem_type(ira, source_instr->source_node, child_type))) {
return ira->codegen->invalid_inst_gen->value->type;
}
return get_vector_type(ira->codegen, bigint_as_u32(len), child_type);
}
case ZigTypeIdAnyFrame: {