checker: check using const var as function (#13006)
parent
6438512529
commit
7622ff3f54
|
@ -637,6 +637,7 @@ 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) {
|
||||||
|
if obj.typ != 0 {
|
||||||
sym := c.table.sym(obj.typ)
|
sym := c.table.sym(obj.typ)
|
||||||
if sym.kind == .function {
|
if sym.kind == .function {
|
||||||
found = true
|
found = true
|
||||||
|
@ -644,6 +645,7 @@ pub fn (mut c Checker) fn_call(mut node ast.CallExpr, mut continue_check &bool)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if !found {
|
if !found {
|
||||||
continue_check = false
|
continue_check = false
|
||||||
c.error('unknown function: $fn_name', node.pos)
|
c.error('unknown function: $fn_name', node.pos)
|
||||||
|
|
|
@ -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