@@ -1540,6 +1540,7 @@ pub fn (mut t Table) resolve_generic_to_concrete(generic_type Type, generic_name
1540
1540
pub fn (mut t Table) unwrap_generic_type (typ Type, generic_names []string , concrete_types []Type) Type {
1541
1541
mut final_concrete_types := []Type{}
1542
1542
mut fields := []StructField{}
1543
+ mut needs_unwrap_types := []Type{}
1543
1544
mut nrt := ''
1544
1545
mut c_nrt := ''
1545
1546
ts := t.sym (typ)
@@ -1627,6 +1628,20 @@ pub fn (mut t Table) unwrap_generic_type(typ Type, generic_names []string, concr
1627
1628
}
1628
1629
if final_concrete_types.len > 0 {
1629
1630
for method in ts.methods {
1631
+ for i in 1 .. method.params.len {
1632
+ if method.params[i].typ.has_flag (.generic)
1633
+ && method.params[i].typ != method.params[0 ].typ {
1634
+ if method.params[i].typ ! in needs_unwrap_types {
1635
+ needs_unwrap_types << method.params[i].typ
1636
+ }
1637
+ }
1638
+ if method.return_type.has_flag (.generic)
1639
+ && method.return_type != method.params[0 ].typ {
1640
+ if method.return_type ! in needs_unwrap_types {
1641
+ needs_unwrap_types << method.return_type
1642
+ }
1643
+ }
1644
+ }
1630
1645
t.register_fn_concrete_types (method.fkey (), final_concrete_types)
1631
1646
}
1632
1647
}
@@ -1648,6 +1663,9 @@ pub fn (mut t Table) unwrap_generic_type(typ Type, generic_names []string, concr
1648
1663
mod: ts.mod
1649
1664
info: info
1650
1665
)
1666
+ for typ_ in needs_unwrap_types {
1667
+ t.unwrap_generic_type (typ_, generic_names, concrete_types)
1668
+ }
1651
1669
return new_type (new_idx).derive (typ).clear_flag (.generic)
1652
1670
}
1653
1671
Interface {
0 commit comments