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

ast, checker: fix checking generic struct type mismatch (#16701)

This commit is contained in:
yuyi
2022-12-18 16:29:44 +08:00
committed by GitHub
parent 9f1239c56e
commit ba07e48691
2 changed files with 7 additions and 5 deletions

View File

@ -1799,7 +1799,12 @@ pub fn (mut t Table) generic_type_names(generic_type Type) []string {
}
Struct, Interface, SumType {
if sym.info.is_generic {
names << sym.info.generic_types.map(t.sym(it).name)
if sym.generic_types.len > 0 {
// Foo[U] (declaration: Foo[T])
names << sym.generic_types.map(t.sym(it).name)
} else {
names << sym.info.generic_types.map(t.sym(it).name)
}
}
}
else {}