From 4e28d7a5f7d6346acc42a7524dd77fa5f9322029 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Sun, 17 Nov 2019 02:46:44 +1100 Subject: [PATCH] fix bug on empty error union --- src/ir.cpp | 1 - test/stage1/behavior/error.zig | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ir.cpp b/src/ir.cpp index d50229925c..7bca551852 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -8128,7 +8128,6 @@ static ZigType *get_error_set_union(CodeGen *g, ErrorTableEntry **errors, ZigTyp } } assert(index == count); - assert(count != 0); if (type_name == nullptr) { buf_appendf(&err_set_type->name, "}"); diff --git a/test/stage1/behavior/error.zig b/test/stage1/behavior/error.zig index 8ee1b30907..9b7904e9cf 100644 --- a/test/stage1/behavior/error.zig +++ b/test/stage1/behavior/error.zig @@ -160,6 +160,10 @@ fn testErrToIntWithOnePossibleValue( } } +test "empty error union" { + const x = error{} || error{}; +} + test "error union peer type resolution" { testErrorUnionPeerTypeResolution(1); }