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
79367936 IrInstruction *value = un_op_instruction->value->other;
79377937 TypeTableEntry *type_entry = ir_resolve_type(ira, value);
79387938 TypeTableEntry *canon_type = get_underlying_type(type_entry);
7939 if (type_is_invalid(canon_type))
7940 return ira->codegen->builtin_types.entry_invalid;
79397941 switch (canon_type->id) {
79407942 case TypeTableEntryIdInvalid:
7941 return ira->codegen->builtin_types.entry_invalid;
79427943 case TypeTableEntryIdVar:
79437944 case TypeTableEntryIdTypeDecl:
79447945 zig_unreachable();
......@@ -9997,7 +9998,7 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira
99979998static TypeTableEntry *ir_analyze_instruction_container_init_fields(IrAnalyze *ira, IrInstructionContainerInitFields *instruction) {
99989999 IrInstruction *container_type_value = instruction->container_type->other;
999910000 TypeTableEntry *container_type = ir_resolve_type(ira, container_type_value);
10000 if (container_type->id == TypeTableEntryIdInvalid)
10001 if (type_is_invalid(container_type))
1000110002 return ira->codegen->builtin_types.entry_invalid;
1000210003
1000310004 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() {
15211521 jll.init(1234);
15221522 var jd = JsonNode {.kind = JsonType.JSONArray , .jobject = JsonOA.JSONArray {jll} };
15231523}
1524 )SOURCE", 2,
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'");
1524 )SOURCE", 1, ".tmp_source.zig:6:16: error: use of undeclared identifier 'JsonList'");
15271525
15281526 add_compile_fail_case("method call with first arg type primitive", R"SOURCE(
15291527const Foo = struct {