From a78f062499c7f0112558872a500904e6fbc6761b Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 28 Jan 2024 23:49:59 +0000 Subject: [PATCH] Fix semantics for casting between polymorphic specialized procedures --- src/check_expr.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/check_expr.cpp b/src/check_expr.cpp index f8c5540f4..4f47ba523 100644 --- a/src/check_expr.cpp +++ b/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;