fix bug on empty error union

master
daurnimator 2019-11-17 02:46:44 +11:00 committed by Andrew Kelley
parent 8e3370367b
commit 4e28d7a5f7
2 changed files with 4 additions and 1 deletions

View File

@ -8128,7 +8128,6 @@ static ZigType *get_error_set_union(CodeGen *g, ErrorTableEntry **errors, ZigTyp
} }
} }
assert(index == count); assert(index == count);
assert(count != 0);
if (type_name == nullptr) { if (type_name == nullptr) {
buf_appendf(&err_set_type->name, "}"); buf_appendf(&err_set_type->name, "}");

View File

@ -160,6 +160,10 @@ fn testErrToIntWithOnePossibleValue(
} }
} }
test "empty error union" {
const x = error{} || error{};
}
test "error union peer type resolution" { test "error union peer type resolution" {
testErrorUnionPeerTypeResolution(1); testErrorUnionPeerTypeResolution(1);
} }