aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2024-06-09 13:35:22 +0100
committergingerBill <bill@gingerbill.org>2024-06-09 13:35:22 +0100
commit4b52f7fe2bd68d74efffa55ef8b4582164c1e268 (patch)
tree4ebdc84a8b319e6a6dce0f06e0e70ca82981d14b
parent8fcfd8c506752d3e0d65e4d9ef7856486a65ca5f (diff)
Fix #3713
-rw-r--r--src/check_expr.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index ad546858c..4115cd1e9 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -3336,11 +3336,12 @@ gb_internal void check_cast(CheckerContext *c, Operand *x, Type *type) {
}
if (is_type_untyped(x->type)) {
- Type *final_type = 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);
+ convert_to_typed(c, x, type);
+ // Type *final_type = 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);
} else {
Type *src = core_type(x->type);
Type *dst = core_type(type);
@@ -4286,7 +4287,8 @@ gb_internal void convert_to_typed(CheckerContext *c, Operand *operand, Type *tar
} else {
switch (operand->type->Basic.kind) {
case Basic_UntypedBool:
- if (!is_type_boolean(target_type)) {
+ if (!is_type_boolean(target_type) &&
+ !is_type_integer(target_type)) {
operand->mode = Addressing_Invalid;
convert_untyped_error(c, operand, target_type);
return;
@@ -7527,9 +7529,6 @@ gb_internal ExprKind check_call_expr(CheckerContext *c, Operand *operand, Ast *c
}
operand->type = t;
operand->expr = call;
- if (operand->mode != Addressing_Invalid) {
- update_untyped_expr_type(c, arg, t, false);
- }
break;
}
}