~sircmpwn/harec

401980723ae0fc7b82f558ec56b74c390285a457 — Sebastian 2 months ago 954733a
check: fix even more spurious errors

Signed-off-by: Sebastian <sebastian@sebsite.pw>
1 files changed, 9 insertions(+), 0 deletions(-)

M src/check.c
M src/check.c => src/check.c +9 -0
@@ 701,6 701,10 @@ check_assert(struct context *ctx,
		expr->assert.cond = xcalloc(1, sizeof(struct expression));
		check_expression(ctx, e.cond, expr->assert.cond, &builtin_type_bool);
		loc = e.cond->loc;
		if (expr->assert.cond->result->storage == STORAGE_ERROR) {
			mkerror(loc, expr);
			return;
		}
		if (type_dealias(ctx, expr->assert.cond->result)->storage != STORAGE_BOOL) {
			error(ctx, loc, expr, "Assertion condition must be boolean");
			return;


@@ 1127,6 1131,11 @@ check_expr_binarithm(struct context *ctx,
		*rvalue = xcalloc(1, sizeof(struct expression));
	check_expression(ctx, aexpr->binarithm.lvalue, lvalue, NULL);
	check_expression(ctx, aexpr->binarithm.rvalue, rvalue, NULL);
	if (lvalue->result->storage == STORAGE_ERROR
			|| rvalue->result->storage == STORAGE_ERROR) {
		mkerror(aexpr->loc, expr);
		return;
	}

	expr->result = type_promote(ctx->store, lvalue->result, rvalue->result);
	if (expr->result == NULL) {