From a634444f99dca486673b8575a136dd99886ffb8a Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 5 Nov 2019 19:37:19 +0000 Subject: Fix "Polymorphic parameter declared in return type doesn't compile #464" by giving a conversion error (code wasn't handling polymorphic result types as intended) --- src/check_type.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/check_type.cpp') diff --git a/src/check_type.cpp b/src/check_type.cpp index 9f8310e44..c733cfb4c 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -2507,6 +2507,16 @@ bool check_procedure_type(CheckerContext *ctx, Type *type, Ast *proc_type_node, break; } } + for (isize i = 0; i < result_count; i++) { + Entity *e = results->Tuple.variables[i]; + if (e->kind != Entity_Variable) { + is_polymorphic = true; + break; + } else if (is_type_polymorphic(e->type)) { + is_polymorphic = true; + break; + } + } type->Proc.is_polymorphic = is_polymorphic; return success; -- cgit v1.2.3