diff --git a/releasenotes.md b/releasenotes.md index 2fdb8c2b8..26ba1843b 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -15,6 +15,7 @@ - Crash when reading an empty 'manifest.json'. - "optsize" did not work correctly in project.json. - `l[0].a = 1` now supported for overloads due to better lvalue handling #1357. +- Asserts are retained regardless of optimization when running tests. ### Stdlib changes - Additional init functions for hashmap. diff --git a/src/compiler/llvm_codegen_stmt.c b/src/compiler/llvm_codegen_stmt.c index 78fad4aab..1f6f6f072 100644 --- a/src/compiler/llvm_codegen_stmt.c +++ b/src/compiler/llvm_codegen_stmt.c @@ -1176,7 +1176,7 @@ static inline void llvm_emit_assert_stmt(GenContext *c, Ast *ast) { ExprId exprid = ast->assert_stmt.expr; Expr *assert_expr = exprptr(exprid); - if (safe_mode_enabled()) + if (safe_mode_enabled() || compiler.build.testing) { BEValue value; llvm_emit_expr(c, &value, assert_expr);