From a20c31d6b509076141fe69f33d2fe3b465122f78 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Thu, 31 Oct 2019 22:58:38 +0000 Subject: [PATCH] Fix polymorphic record parameter determination bug caused by polymorphic constants not being handled correctly #447 --- src/check_expr.cpp | 2 -- src/check_type.cpp | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 254a7ce51..fae38fa01 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -6344,8 +6344,6 @@ CallArgumentError check_polymorphic_record_type(CheckerContext *c, Operand *oper return err; } - - String generated_name = make_string_c(expr_to_string(call)); CheckerContext ctx = *c; diff --git a/src/check_type.cpp b/src/check_type.cpp index cf5855a3e..9f8310e44 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -461,6 +461,10 @@ void check_struct_type(CheckerContext *ctx, Type *struct_type, Ast *node, Array< e = alloc_entity_type_name(scope, token, operand.type); e->TypeName.is_type_alias = true; } else { + if (is_type_polymorphic(base_type(operand.type))) { + is_polymorphic = true; + can_check_fields = false; + } e = alloc_entity_constant(scope, token, operand.type, operand.value); } } else {