aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-12-06 13:54:37 -0500
committerBruce Hill <bruce@bruce-hill.com>2025-12-06 13:54:37 -0500
commita13b39f1e1ea220a868d99508796d06492a40611 (patch)
tree74ebf34d5cb9ef661165b4815aa37de5aafc5c9c /src
parent129f2c794cd388b99d573697965117e12b89f2fe (diff)
Allow discarding Empty() values
Diffstat (limited to 'src')
-rw-r--r--src/compile/statements.c2
-rw-r--r--src/typecheck.c2
2 files changed, 1 insertions, 3 deletions
diff --git a/src/compile/statements.c b/src/compile/statements.c
index 638f1341..4bb8b432 100644
--- a/src/compile/statements.c
+++ b/src/compile/statements.c
@@ -218,8 +218,6 @@ static Text_t _compile_statement(env_t *env, ast_t *ast) {
}
case Metadata: return EMPTY_TEXT;
default:
- // print("Is discardable: ", ast_to_sexp_str(ast), " ==> ",
- // is_discardable(env, ast));
if (!is_discardable(env, ast))
code_err(ast, "The ", type_to_text(get_type(env, ast)), " result of this statement cannot be discarded");
return Texts("(void)", compile(env, ast), ";");
diff --git a/src/typecheck.c b/src/typecheck.c
index e432759b..6f8fa0ba 100644
--- a/src/typecheck.c
+++ b/src/typecheck.c
@@ -1539,7 +1539,7 @@ PUREFUNC bool is_discardable(env_t *env, ast_t *ast) {
default: break;
}
type_t *t = get_type(env, ast);
- return (t->tag == VoidType || t->tag == AbortType || t->tag == ReturnType);
+ return (t->tag == VoidType || t->tag == AbortType || t->tag == ReturnType || t == EMPTY_TYPE);
}
type_t *get_arg_ast_type(env_t *env, arg_ast_t *arg) {