authorgravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2019-11-17 02:46:44+11:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-11-17 22:29:49+00:00
log4e28d7a5f7d6346acc42a7524dd77fa5f9322029
tree510e517a76dd45320081692775a9485ad647c599
parent8e3370367bbbcae43670380cb4ca841a9e5ada33

fix bug on empty error union


2 files changed, 4 insertions(+), 1 deletions(-)

src/ir.cpp-1
...@@ -8128,7 +8128,6 @@ static ZigType *get_error_set_union(CodeGen *g, ErrorTableEntry **errors, ZigTyp...@@ -8128,7 +8128,6 @@ static ZigType *get_error_set_union(CodeGen *g, ErrorTableEntry **errors, ZigTyp
8128 }8128 }
8129 }8129 }
8130 assert(index == count);8130 assert(index == count);
8131 assert(count != 0);
81328131
8133 if (type_name == nullptr) {8132 if (type_name == nullptr) {
8134 buf_appendf(&err_set_type->name, "}");8133 buf_appendf(&err_set_type->name, "}");
test/stage1/behavior/error.zig+4
...@@ -160,6 +160,10 @@ fn testErrToIntWithOnePossibleValue(...@@ -160,6 +160,10 @@ fn testErrToIntWithOnePossibleValue(
160 }160 }
161}161}
162162
163test "empty error union" {
164 const x = error{} || error{};
165}
166
163test "error union peer type resolution" {167test "error union peer type resolution" {
164 testErrorUnionPeerTypeResolution(1);168 testErrorUnionPeerTypeResolution(1);
165}169}