gingerBill 2 年之前
父節點
當前提交
d55248ab0f
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/check_expr.cpp

+ 1 - 1
src/check_expr.cpp

@@ -7535,7 +7535,7 @@ gb_internal ExprKind check_ternary_if_expr(CheckerContext *c, Operand *o, Ast *n
 
 
 	o->mode = Addressing_Value;
 	o->mode = Addressing_Value;
 	o->expr = node;
 	o->expr = node;
-	if (type_hint != nullptr && is_type_untyped(o->type)) {
+	if (type_hint != nullptr && is_type_untyped(o->type) && !is_type_any(type_hint)) {
 		if (check_cast_internal(c, &x, type_hint) &&
 		if (check_cast_internal(c, &x, type_hint) &&
 		    check_cast_internal(c, &y, type_hint)) {
 		    check_cast_internal(c, &y, type_hint)) {
 			convert_to_typed(c, o, type_hint);
 			convert_to_typed(c, o, type_hint);