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

checker: fix regression for generics_test.v

This commit is contained in:
Delyan Angelov 2021-05-08 18:23:12 +03:00
parent d8d6e9b901
commit cbf30bd13a
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -2276,6 +2276,13 @@ pub fn (mut c Checker) fn_call(mut call_expr ast.CallExpr) ast.Type {
if !found { if !found {
if v := call_expr.scope.find_var(fn_name) { if v := call_expr.scope.find_var(fn_name) {
if v.typ != 0 { if v.typ != 0 {
generic_vts := c.table.get_type_symbol(v.typ)
if generic_vts.kind == .function {
info := generic_vts.info as ast.FnType
func = info.func
found = true
found_in_args = true
} else {
vts := c.table.get_type_symbol(c.unwrap_generic(v.typ)) vts := c.table.get_type_symbol(c.unwrap_generic(v.typ))
if vts.kind == .function { if vts.kind == .function {
info := vts.info as ast.FnType info := vts.info as ast.FnType
@ -2286,6 +2293,7 @@ pub fn (mut c Checker) fn_call(mut call_expr ast.CallExpr) ast.Type {
} }
} }
} }
}
if !found { if !found {
c.error('unknown function: $fn_name', call_expr.pos) c.error('unknown function: $fn_name', call_expr.pos)
return ast.void_type return ast.void_type