turn panics into compile errors, require at least 1 field in non-exhaustive enum

This commit is contained in:
Vexu
2020-01-16 09:04:11 +02:00
parent 02e5cb1cd4
commit d84569895c
4 changed files with 25 additions and 24 deletions

View File

@@ -5065,8 +5065,11 @@ static LLVMValueRef ir_render_enum_tag_name(CodeGen *g, IrExecutable *executable
{
ZigType *enum_type = instruction->target->value->type;
assert(enum_type->id == ZigTypeIdEnum);
if (enum_type->data.enumeration.non_exhaustive)
zig_panic("TODO @tagName on non-exhaustive enum");
if (enum_type->data.enumeration.non_exhaustive) {
add_node_error(g, instruction->base.source_node,
buf_sprintf("TODO @tagName on non-exhaustive enum https://github.com/ziglang/zig/issues/3991"));
codegen_report_errors_and_exit(g);
}
LLVMValueRef enum_name_function = get_enum_tag_name_function(g, enum_type);