Don't print repl output if there were errors

This commit is contained in:
Richard Feldman 2022-10-30 05:57:21 -04:00
parent 062d532fa4
commit a574dff481
No known key found for this signature in database
GPG key ID: F1F21AA5B1D9E43B

View file

@ -425,7 +425,10 @@ fn format_output(
if let Some(ReplOutput { expr, expr_type }) = opt_output {
// If expr was empty, it was a type annotation or ability declaration;
// don't print anything!
if !expr.is_empty() {
//
// Also, for now we also don't print anything if there was a compile-time error.
// In the future, it would be great to run anyway and print useful output here!
if !expr.is_empty() && problems.errors.is_empty() {
const EXPR_TYPE_SEPARATOR: &str = " : "; // e.g. in "5 : Num *"
// Print the expr and its type