mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: fix multi generic args (#8347)
This commit is contained in:
parent
69c37402d4
commit
7bb9c0e7b3
|
@ -429,12 +429,12 @@ pub fn (mut c Checker) infer_fn_types(f table.Fn, mut call_expr ast.CallExpr) {
|
||||||
} else {
|
} else {
|
||||||
call_expr.args[i]
|
call_expr.args[i]
|
||||||
}
|
}
|
||||||
if param.typ.has_flag(.generic) {
|
param_type_sym := c.table.get_type_symbol(param.typ)
|
||||||
|
if param.typ.has_flag(.generic) && param_type_sym.name == gt_name {
|
||||||
typ = arg.typ
|
typ = arg.typ
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
arg_sym := c.table.get_type_symbol(arg.typ)
|
arg_sym := c.table.get_type_symbol(arg.typ)
|
||||||
param_type_sym := c.table.get_type_symbol(param.typ)
|
|
||||||
if arg_sym.kind == .array && param_type_sym.kind == .array {
|
if arg_sym.kind == .array && param_type_sym.kind == .array {
|
||||||
mut arg_elem_info := arg_sym.info as table.Array
|
mut arg_elem_info := arg_sym.info as table.Array
|
||||||
mut param_elem_info := param_type_sym.info as table.Array
|
mut param_elem_info := param_type_sym.info as table.Array
|
||||||
|
|
|
@ -377,3 +377,12 @@ fn test_multi_return() {
|
||||||
multi_return<Foo1, Foo2>()
|
multi_return<Foo1, Foo2>()
|
||||||
multi_return<Foo3, Foo4>()
|
multi_return<Foo3, Foo4>()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn multi_generic_args<T, V>(t T, v V) bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test_multi_generic_args() {
|
||||||
|
assert multi_generic_args("Super", 2021)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user