Index: runtime/vm/compiler.cc |
diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc |
index 731699811a6446281dbc04293786c9b702ef7ae5..150bd0af715b05e39fc9b4e39b2bcae74e6fcf0a 100644 |
--- a/runtime/vm/compiler.cc |
+++ b/runtime/vm/compiler.cc |
@@ -1138,7 +1138,9 @@ static RawError* CompileFunctionHelper(CompilationPipeline* pipeline, |
// We got an error during compilation. |
error = isolate->object_store()->sticky_error(); |
isolate->object_store()->clear_sticky_error(); |
- ASSERT(!optimized); |
+ // Unoptimized compilation or precompilation may encounter compile-time |
+ // errors, but regular optimized compilation should not. |
+ ASSERT(!optimized || Compiler::always_optimize()); |
// Do not attempt to optimize functions that can cause errors. |
function.set_is_optimizable(false); |
return error.raw(); |