Browse Source

Fix semantics for casting between polymorphic specialized procedures

gingerBill 1 year ago
parent
commit
a78f062499
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/check_expr.cpp

+ 5 - 1
src/check_expr.cpp

@@ -2988,7 +2988,11 @@ 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)) {
+		if (is_type_polymorphic(dst)) {
+			if (is_type_polymorphic(src) &&
+			    operand->mode == Addressing_Variable) {
+				return true;
+			}
 			return false;
 		}
 		return true;