Debug enum issue

This commit is contained in:
Isaac Hier 2018-07-02 16:56:40 -04:00 committed by Isaac Hier
parent 8c39cdc89f
commit 9395162a7c
3 changed files with 13 additions and 0 deletions

View File

@ -19149,6 +19149,7 @@ static TypeTableEntry *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira
if (!end_val)
return ira->codegen->builtin_types.entry_invalid;
printf("%s\n", buf_ptr(&start_val->type->name));
assert(start_val->type->id == TypeTableEntryIdInt || start_val->type->id == TypeTableEntryIdComptimeInt);
assert(end_val->type->id == TypeTableEntryIdInt || end_val->type->id == TypeTableEntryIdComptimeInt);
AstNode *prev_node = rangeset_add_range(&rs, &start_val->data.x_bigint, &end_val->data.x_bigint,

View File

@ -52,6 +52,7 @@ comptime {
_ = @import("cases/switch.zig");
_ = @import("cases/switch_prong_err_enum.zig");
_ = @import("cases/switch_prong_implicit_cast.zig");
_ = @import("cases/switch_usize_enum_prongs.zig");
_ = @import("cases/syntax.zig");
_ = @import("cases/this.zig");
_ = @import("cases/try.zig");

View File

@ -0,0 +1,11 @@
const E = enum(usize) { One, Two };
test "aoeou" {
foo(1);
}
fn foo(x: usize) void {
switch (x) {
E.One => {},
}
}