checker: check using const var as function (#13006)
parent
6438512529
commit
7622ff3f54
|
@ -637,10 +637,12 @@ pub fn (mut c Checker) fn_call(mut node ast.CallExpr, mut continue_check &bool)
|
||||||
// global fn?
|
// global fn?
|
||||||
if !found {
|
if !found {
|
||||||
if obj := c.file.global_scope.find(fn_name) {
|
if obj := c.file.global_scope.find(fn_name) {
|
||||||
sym := c.table.sym(obj.typ)
|
if obj.typ != 0 {
|
||||||
if sym.kind == .function {
|
sym := c.table.sym(obj.typ)
|
||||||
found = true
|
if sym.kind == .function {
|
||||||
func = (sym.info as ast.FnType).func
|
found = true
|
||||||
|
func = (sym.info as ast.FnType).func
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
vlib/v/checker/tests/unknown_function.vv:4:15: error: unknown function: math.max_i64
|
||||||
|
2 |
|
||||||
|
3 | fn main() {
|
||||||
|
4 | println(math.max_i64())
|
||||||
|
| ~~~~~~~~~
|
||||||
|
5 | }
|
|
@ -0,0 +1,5 @@
|
||||||
|
import math
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
println(math.max_i64())
|
||||||
|
}
|
Loading…
Reference in New Issue