mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: fn_call fixes (#9994)
This commit is contained in:
parent
1e856c0f94
commit
177f8f585b
@ -2135,7 +2135,7 @@ pub fn (mut c Checker) fn_call(mut call_expr ast.CallExpr) ast.Type {
|
|||||||
concrete_types << concrete_type
|
concrete_types << concrete_type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if c.cur_fn.cur_concrete_types.len == 0 && has_generic {
|
if !isnil(c.cur_fn) && c.cur_fn.cur_concrete_types.len == 0 && has_generic {
|
||||||
c.error('generic fn using generic types cannot be called outside of generic fn',
|
c.error('generic fn using generic types cannot be called outside of generic fn',
|
||||||
call_expr.pos)
|
call_expr.pos)
|
||||||
}
|
}
|
||||||
@ -2183,9 +2183,11 @@ pub fn (mut c Checker) fn_call(mut call_expr ast.CallExpr) ast.Type {
|
|||||||
// it was set to anon for checker errors, clear for gen
|
// it was set to anon for checker errors, clear for gen
|
||||||
call_expr.name = ''
|
call_expr.name = ''
|
||||||
c.expr(call_expr.left)
|
c.expr(call_expr.left)
|
||||||
anon_fn_sym := c.table.get_type_symbol(call_expr.left.typ)
|
if call_expr.left.typ != ast.Type(0) {
|
||||||
func = (anon_fn_sym.info as ast.FnType).func
|
anon_fn_sym := c.table.get_type_symbol(call_expr.left.typ)
|
||||||
found = true
|
func = (anon_fn_sym.info as ast.FnType).func
|
||||||
|
found = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// try prefix with current module as it would have never gotten prefixed
|
// try prefix with current module as it would have never gotten prefixed
|
||||||
if !found && !fn_name.contains('.') && call_expr.mod != 'builtin' {
|
if !found && !fn_name.contains('.') && call_expr.mod != 'builtin' {
|
||||||
@ -2277,7 +2279,7 @@ pub fn (mut c Checker) fn_call(mut call_expr ast.CallExpr) ast.Type {
|
|||||||
&& func.mod != c.mod {
|
&& func.mod != c.mod {
|
||||||
c.error('function `$func.name` is private', call_expr.pos)
|
c.error('function `$func.name` is private', call_expr.pos)
|
||||||
}
|
}
|
||||||
if c.cur_fn != 0 && !c.cur_fn.is_deprecated && func.is_deprecated {
|
if !isnil(c.cur_fn) && !c.cur_fn.is_deprecated && func.is_deprecated {
|
||||||
c.deprecate_fnmethod('function', func.name, func, call_expr)
|
c.deprecate_fnmethod('function', func.name, func, call_expr)
|
||||||
}
|
}
|
||||||
if func.is_unsafe && !c.inside_unsafe
|
if func.is_unsafe && !c.inside_unsafe
|
||||||
|
Loading…
Reference in New Issue
Block a user