authorgravatar for ihier@uber.comIsaac Hier <ihier@uber.com> 2018-07-02 16:56:40-04:00
committergravatar for isaachier@gmail.comIsaac Hier <isaachier@gmail.com> 2018-07-04 12:47:35-04:00
log9395162a7c41689bcd1c0c48f9eabffc1485fc74
tree8d3e4428c6c706fd7533874be030640799237966
parent8c39cdc89f2ae7fc25c3856e7c4c6b4662ac8a80

Debug enum issue


3 files changed, 13 insertions(+), 0 deletions(-)

src/ir.cpp+1
...@@ -19149,6 +19149,7 @@ static TypeTableEntry *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira...@@ -19149,6 +19149,7 @@ static TypeTableEntry *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira
19149 if (!end_val)19149 if (!end_val)
19150 return ira->codegen->builtin_types.entry_invalid;19150 return ira->codegen->builtin_types.entry_invalid;
1915119151
19152 printf("%s\n", buf_ptr(&start_val->type->name));
19152 assert(start_val->type->id == TypeTableEntryIdInt || start_val->type->id == TypeTableEntryIdComptimeInt);19153 assert(start_val->type->id == TypeTableEntryIdInt || start_val->type->id == TypeTableEntryIdComptimeInt);
19153 assert(end_val->type->id == TypeTableEntryIdInt || end_val->type->id == TypeTableEntryIdComptimeInt);19154 assert(end_val->type->id == TypeTableEntryIdInt || end_val->type->id == TypeTableEntryIdComptimeInt);
19154 AstNode *prev_node = rangeset_add_range(&rs, &start_val->data.x_bigint, &end_val->data.x_bigint,19155 AstNode *prev_node = rangeset_add_range(&rs, &start_val->data.x_bigint, &end_val->data.x_bigint,
test/behavior.zig+1
...@@ -52,6 +52,7 @@ comptime {...@@ -52,6 +52,7 @@ comptime {
52 _ = @import("cases/switch.zig");52 _ = @import("cases/switch.zig");
53 _ = @import("cases/switch_prong_err_enum.zig");53 _ = @import("cases/switch_prong_err_enum.zig");
54 _ = @import("cases/switch_prong_implicit_cast.zig");54 _ = @import("cases/switch_prong_implicit_cast.zig");
55 _ = @import("cases/switch_usize_enum_prongs.zig");
55 _ = @import("cases/syntax.zig");56 _ = @import("cases/syntax.zig");
56 _ = @import("cases/this.zig");57 _ = @import("cases/this.zig");
57 _ = @import("cases/try.zig");58 _ = @import("cases/try.zig");
test/cases/switch_usize_enum_prongs.zig created+11
...@@ -0,0 +1,11 @@
1const E = enum(usize) { One, Two };
2
3test "aoeou" {
4 foo(1);
5}
6
7fn foo(x: usize) void {
8 switch (x) {
9 E.One => {},
10 }
11}