This commit is contained in:
gingerBill
2024-06-09 13:35:22 +01:00
parent 8fcfd8c506
commit 4b52f7fe2b
+8 -9
View File
@@ -3336,11 +3336,12 @@ gb_internal void check_cast(CheckerContext *c, Operand *x, Type *type) {
} }
if (is_type_untyped(x->type)) { if (is_type_untyped(x->type)) {
Type *final_type = type; convert_to_typed(c, x, type);
if (is_const_expr && !is_type_constant_type(type)) { // Type *final_type = type;
final_type = default_type(x->type); // if (is_const_expr && !is_type_constant_type(type)) {
} // final_type = default_type(x->type);
update_untyped_expr_type(c, x->expr, final_type, true); // }
// update_untyped_expr_type(c, x->expr, final_type, true);
} else { } else {
Type *src = core_type(x->type); Type *src = core_type(x->type);
Type *dst = core_type(type); Type *dst = core_type(type);
@@ -4286,7 +4287,8 @@ gb_internal void convert_to_typed(CheckerContext *c, Operand *operand, Type *tar
} else { } else {
switch (operand->type->Basic.kind) { switch (operand->type->Basic.kind) {
case Basic_UntypedBool: case Basic_UntypedBool:
if (!is_type_boolean(target_type)) { if (!is_type_boolean(target_type) &&
!is_type_integer(target_type)) {
operand->mode = Addressing_Invalid; operand->mode = Addressing_Invalid;
convert_untyped_error(c, operand, target_type); convert_untyped_error(c, operand, target_type);
return; return;
@@ -7527,9 +7529,6 @@ gb_internal ExprKind check_call_expr(CheckerContext *c, Operand *operand, Ast *c
} }
operand->type = t; operand->type = t;
operand->expr = call; operand->expr = call;
if (operand->mode != Addressing_Invalid) {
update_untyped_expr_type(c, arg, t, false);
}
break; break;
} }
} }