diff --git a/src/compiler/number.c b/src/compiler/number.c index a32f9a0b8..21fa2c527 100644 --- a/src/compiler/number.c +++ b/src/compiler/number.c @@ -53,7 +53,7 @@ void expr_contract_array(ExprConst *expr_const, ConstKind contract_type) { if (expr_const->const_kind == CONST_SLICE && !expr_const->slice_init) { - *expr_const = (ExprConst) { .const_kind = contract_type }; + *expr_const = (ExprConst) { .const_kind = contract_type, .bytes.ptr = NULL, .bytes.len = 0 }; return; } ASSERT(expr_const->const_kind == CONST_INITIALIZER || expr_const->const_kind == CONST_SLICE); diff --git a/src/compiler/sema_const.c b/src/compiler/sema_const.c index bdbc9d798..b7a0198c5 100644 --- a/src/compiler/sema_const.c +++ b/src/compiler/sema_const.c @@ -145,6 +145,7 @@ static bool sema_concat_bytes_and_other(SemaContext *context, Expr *expr, Expr * { ArraySize len = left->const_expr.bytes.len; bool is_bytes = left->const_expr.const_kind == CONST_BYTES; + ASSERT(is_bytes || left->const_expr.const_kind == CONST_STRING); Type *indexed = type_get_indexed_type(left->type); const char *left_bytes = left->const_expr.bytes.ptr; RETRY:;