authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-01-15 22:34:20-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-01-15 22:34:20-05:00
log0b6cf0aa637b5cd7551aca295832f06d56315921
tree725813bcd97d86f1a48df5c7ec74fd67fdcd897a
parent8106f9846aea806350d319535e0181104299ba5d

fix handling of invalid enumeration


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

src/ir.cpp+3-2
...@@ -7936,9 +7936,10 @@ static TypeTableEntry *ir_analyze_maybe(IrAnalyze *ira, IrInstructionUnOp *un_op...@@ -7936,9 +7936,10 @@ static TypeTableEntry *ir_analyze_maybe(IrAnalyze *ira, IrInstructionUnOp *un_op
7936 IrInstruction *value = un_op_instruction->value->other;7936 IrInstruction *value = un_op_instruction->value->other;
7937 TypeTableEntry *type_entry = ir_resolve_type(ira, value);7937 TypeTableEntry *type_entry = ir_resolve_type(ira, value);
7938 TypeTableEntry *canon_type = get_underlying_type(type_entry);7938 TypeTableEntry *canon_type = get_underlying_type(type_entry);
7939 if (type_is_invalid(canon_type))
7940 return ira->codegen->builtin_types.entry_invalid;
7939 switch (canon_type->id) {7941 switch (canon_type->id) {
7940 case TypeTableEntryIdInvalid:7942 case TypeTableEntryIdInvalid:
7941 return ira->codegen->builtin_types.entry_invalid;
7942 case TypeTableEntryIdVar:7943 case TypeTableEntryIdVar:
7943 case TypeTableEntryIdTypeDecl:7944 case TypeTableEntryIdTypeDecl:
7944 zig_unreachable();7945 zig_unreachable();
...@@ -9997,7 +9998,7 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira...@@ -9997,7 +9998,7 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira
9997static TypeTableEntry *ir_analyze_instruction_container_init_fields(IrAnalyze *ira, IrInstructionContainerInitFields *instruction) {9998static TypeTableEntry *ir_analyze_instruction_container_init_fields(IrAnalyze *ira, IrInstructionContainerInitFields *instruction) {
9998 IrInstruction *container_type_value = instruction->container_type->other;9999 IrInstruction *container_type_value = instruction->container_type->other;
9999 TypeTableEntry *container_type = ir_resolve_type(ira, container_type_value);10000 TypeTableEntry *container_type = ir_resolve_type(ira, container_type_value);
10000 if (container_type->id == TypeTableEntryIdInvalid)10001 if (type_is_invalid(container_type))
10001 return ira->codegen->builtin_types.entry_invalid;10002 return ira->codegen->builtin_types.entry_invalid;
1000210003
10003 bool depends_on_compile_var = container_type_value->value.depends_on_compile_var;10004 bool depends_on_compile_var = container_type_value->value.depends_on_compile_var;
test/run_tests.cpp+1-3
...@@ -1521,9 +1521,7 @@ fn foo() {...@@ -1521,9 +1521,7 @@ fn foo() {
1521 jll.init(1234);1521 jll.init(1234);
1522 var jd = JsonNode {.kind = JsonType.JSONArray , .jobject = JsonOA.JSONArray {jll} };1522 var jd = JsonNode {.kind = JsonType.JSONArray , .jobject = JsonOA.JSONArray {jll} };
1523}1523}
1524 )SOURCE", 2,1524 )SOURCE", 1, ".tmp_source.zig:6:16: error: use of undeclared identifier 'JsonList'");
1525 ".tmp_source.zig:6:16: error: use of undeclared identifier 'JsonList'",
1526 ".tmp_source.zig:27:8: error: no member named 'init' in 'JsonNode'");
15271525
1528 add_compile_fail_case("method call with first arg type primitive", R"SOURCE(1526 add_compile_fail_case("method call with first arg type primitive", R"SOURCE(
1529const Foo = struct {1527const Foo = struct {