Browse Source

Hack: Convert `0` to `nil`

gingerBill 1 year ago
parent
commit
5187bb68bb
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/check_expr.cpp

+ 4 - 1
src/check_expr.cpp

@@ -4470,7 +4470,10 @@ gb_internal void convert_to_typed(CheckerContext *c, Operand *operand, Type *tar
 				if (is_exact_value_zero(operand->value) &&
 				if (is_exact_value_zero(operand->value) &&
 				    (operand->value.kind == ExactValue_Integer ||
 				    (operand->value.kind == ExactValue_Integer ||
 				     operand->value.kind == ExactValue_Float)) {
 				     operand->value.kind == ExactValue_Float)) {
-					update_untyped_expr_value(c, operand->expr, empty_exact_value);
+					operand->mode = Addressing_Value;
+					target_type = t_untyped_nil;
+				     	operand->value = empty_exact_value;
+					update_untyped_expr_value(c, operand->expr, operand->value);
 					break;
 					break;
 				}
 				}
 			}
 			}