1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

error on unknown generic struct init. closes #7085

This commit is contained in:
joe-conigliaro 2020-12-02 20:53:40 +11:00
parent d8b8aca51e
commit ca7692c839
No known key found for this signature in database
GPG Key ID: C12F7136C08206F1

View File

@ -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 {