Browse Source

Fix polymorphic record parameter determination bug caused by polymorphic constants not being handled correctly #447

gingerBill 5 years ago
parent
commit
a20c31d6b5
2 changed files with 4 additions and 2 deletions
  1. 0 2
      src/check_expr.cpp
  2. 4 0
      src/check_type.cpp

+ 0 - 2
src/check_expr.cpp

@@ -6344,8 +6344,6 @@ CallArgumentError check_polymorphic_record_type(CheckerContext *c, Operand *oper
 			return err;
 			return err;
 		}
 		}
 
 
-
-
 		String generated_name = make_string_c(expr_to_string(call));
 		String generated_name = make_string_c(expr_to_string(call));
 
 
 		CheckerContext ctx = *c;
 		CheckerContext ctx = *c;

+ 4 - 0
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 = alloc_entity_type_name(scope, token, operand.type);
 							e->TypeName.is_type_alias = true;
 							e->TypeName.is_type_alias = true;
 						} else {
 						} 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);
 							e = alloc_entity_constant(scope, token, operand.type, operand.value);
 						}
 						}
 					} else {
 					} else {