From a13b39f1e1ea220a868d99508796d06492a40611 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 6 Dec 2025 13:54:37 -0500 Subject: Allow discarding Empty() values --- src/compile/statements.c | 2 -- src/typecheck.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'src') 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) { -- cgit v1.2.3