From 33f996bb163568c9bb10e5044ed9df53599a917f Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 26 Jun 2019 14:00:44 -0400 Subject: [PATCH] all tests passing on linux --- doc/langref.html.in | 2 +- src/all_types.hpp | 5 +++-- src/codegen.cpp | 4 +++- src/ir.cpp | 4 +++- std/event/lock.zig | 3 +-- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/doc/langref.html.in b/doc/langref.html.in index a8673a3d779c348da4d3500a0515dd12519bc23b..92c1aeba8e4acf40136db76e1b61e48131f9c5e7 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -5096,7 +5096,7 @@ fn gimmeTheBiggerInteger(a: u64, b: u64) u64 {

For example, if we were to introduce another function to the above snippet:

- {#code_begin|test_err|values of type 'type' must be comptime known#} + {#code_begin|test_err|cannot store runtime value in type 'type'#} fn max(comptime T: type, a: T, b: T) T { return if (a > b) a else b; } diff --git a/src/all_types.hpp b/src/all_types.hpp index 5b75d9f96af0e24bc5fc946bfe9cefc58917df9d..4be6f57593e8c412cca8d886a4e713233bbd7031 100644 --- a/src/all_types.hpp +++ b/src/all_types.hpp @@ -335,8 +335,9 @@ struct ConstExprValue { RuntimeHintSlice rh_slice; } data; - ConstExprValue(const ConstExprValue &other) = delete; // plz zero initialize with {} - ConstExprValue& operator= (const ConstExprValue &other) = delete; // use copy_const_val + // uncomment these to find bugs. can't leave them uncommented because of a gcc-9 warning + //ConstExprValue(const ConstExprValue &other) = delete; // plz zero initialize with {} + //ConstExprValue& operator= (const ConstExprValue &other) = delete; // use copy_const_val }; enum ReturnKnowledge { diff --git a/src/codegen.cpp b/src/codegen.cpp index 2e430a60e0ab07e5398d310815a8fe52a8ba6be2..0942c671ffe66e1148748a209258a67612c992a9 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -691,7 +691,9 @@ static ZigLLVMDIScope *get_di_scope(CodeGen *g, Scope *scope) { is_definition, scope_line, flags, is_optimized, nullptr); scope->di_scope = ZigLLVMSubprogramToScope(subprogram); - ZigLLVMFnSetSubprogram(fn_llvm_value(g, fn_table_entry), subprogram); + if (!g->strip_debug_symbols) { + ZigLLVMFnSetSubprogram(fn_llvm_value(g, fn_table_entry), subprogram); + } return scope->di_scope; } case ScopeIdDecls: diff --git a/src/ir.cpp b/src/ir.cpp index 794d41ce220af0dddd1eee9d30dd7cf2ed9a831a..480493d2ceef34f6278ea30e3f674ccfd90f1606 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -10726,6 +10726,8 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT } else if (prev_inst->value.type->id == ZigTypeIdOptional) { return prev_inst->value.type; } else { + if ((err = type_resolve(ira->codegen, prev_inst->value.type, ResolveStatusSizeKnown))) + return ira->codegen->builtin_types.entry_invalid; return get_optional_type(ira->codegen, prev_inst->value.type); } } else { @@ -21547,7 +21549,7 @@ static IrInstruction *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstru IrInstruction *result_loc = ir_resolve_result(ira, &instruction->base, instruction->result_loc, dest_slice_type, nullptr, true, false); - if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) { + if (result_loc != nullptr && (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc))) { return result_loc; } diff --git a/std/event/lock.zig b/std/event/lock.zig index 6e7a2bbda73572c3a8b91c6f7cdc03d928c875dd..6c2b29b8131f845e19e05d4791f2322e5ce68567 100644 --- a/std/event/lock.zig +++ b/std/event/lock.zig @@ -123,8 +123,7 @@ pub const Lock = struct { }; test "std.event.Lock" { - // https://github.com/ziglang/zig/issues/2377 - //if (true) return error.SkipZigTest; + if (builtin.single_threaded) return error.SkipZigTest; const allocator = std.heap.direct_allocator; -- 2.54.0