From cd7e260f4e77ea992115b3dd26d7b92d99bae0f7 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Fri, 15 Jun 2018 22:49:06 +0100 Subject: Fix cyclic polymorphic procedure usage and improve its error message --- src/check_type.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/check_type.cpp') diff --git a/src/check_type.cpp b/src/check_type.cpp index 7751dca59..9a2493aed 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -401,6 +401,11 @@ void check_struct_type(CheckerContext *ctx, Type *struct_type, AstNode *node, Ar is_poly_specialized = false; break; } + if (struct_type == o.type) { + // NOTE(bill): Cycle + is_poly_specialized = false; + break; + } } } @@ -604,7 +609,7 @@ void check_enum_type(CheckerContext *ctx, Type *enum_type, Type *named_type, Ast if (et->is_export) { Scope *parent = ctx->scope->parent; if (parent->is_file) { - // NOTE(bhall): Use package scope + // NOTE(bill): Use package scope parent = parent->parent; } for_array(i, fields) { -- cgit v1.2.3