gingerBill 1 year ago
parent
commit
15b40a4f29
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/check_expr.cpp

+ 3 - 1
src/check_expr.cpp

@@ -2988,6 +2988,9 @@ gb_internal bool check_is_castable_to(CheckerContext *c, Operand *operand, Type
 	}
 	// proc <-> proc
 	if (is_type_proc(src) && is_type_proc(dst)) {
+		if (is_type_polymorphic(src) || is_type_polymorphic(dst)) {
+			return false;
+		}
 		return true;
 	}
 
@@ -3067,7 +3070,6 @@ gb_internal void check_cast(CheckerContext *c, Operand *x, Type *type) {
 
 	bool is_const_expr = x->mode == Addressing_Constant;
 	bool can_convert = check_cast_internal(c, x, type);
-
 	if (!can_convert) {
 		TEMPORARY_ALLOCATOR_GUARD();
 		gbString expr_str  = expr_to_string(x->expr, temporary_allocator());