From ca7692c839e838fbb83869493d32ecce9e930080 Mon Sep 17 00:00:00 2001 From: joe-conigliaro Date: Wed, 2 Dec 2020 20:53:40 +1100 Subject: [PATCH] error on unknown generic struct init. closes #7085 --- vlib/v/builder/generics.v | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vlib/v/builder/generics.v b/vlib/v/builder/generics.v index 49e040a940..3eeddbe8b0 100644 --- a/vlib/v/builder/generics.v +++ b/vlib/v/builder/generics.v @@ -2,6 +2,9 @@ module builder import v.table +// NOTE: Think about generic struct implementation +// this might not be the best strategy. - joe-c +// // generic struct instantiations to concrete types pub fn (b &Builder) generic_struct_insts_to_concrete() { for idx, _ in b.table.types { @@ -9,6 +12,10 @@ pub fn (b &Builder) generic_struct_insts_to_concrete() { if typ.kind == .generic_struct_inst { info := typ.info as table.GenericStructInst parent := b.table.types[info.parent_idx] + if parent.kind == .placeholder { + typ.kind = .placeholder + continue + } mut parent_info := parent.info as table.Struct mut fields := parent_info.fields.clone() for i, _ in fields {