checker: fixed type inference over a generic function
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>pull/13824/head
parent
8d63db9731
commit
ae4bb3aa88
|
|
@ -535,7 +535,7 @@ pub fn (mut c Checker) infer_fn_generic_types(func ast.Fn, mut node ast.CallExpr
|
||||||
for i, param in func.params {
|
for i, param in func.params {
|
||||||
mut to_set := ast.void_type
|
mut to_set := ast.void_type
|
||||||
// resolve generic struct receiver
|
// resolve generic struct receiver
|
||||||
if i == 0 && node.is_method && param.typ.has_flag(.generic) {
|
if node.is_method && param.typ.has_flag(.generic) {
|
||||||
sym := c.table.sym(node.receiver_type)
|
sym := c.table.sym(node.receiver_type)
|
||||||
match sym.info {
|
match sym.info {
|
||||||
ast.Struct, ast.Interface, ast.SumType {
|
ast.Struct, ast.Interface, ast.SumType {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import datatypes
|
import datatypes
|
||||||
|
|
||||||
struct KeyVal<T> {
|
struct KeyVal<T> {
|
||||||
mut:
|
|
||||||
key string
|
key string
|
||||||
val T
|
val T
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue