mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: check using const var as function (#13006)
This commit is contained in:
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
6
vlib/v/checker/tests/unknown_function.out
Normal file
6
vlib/v/checker/tests/unknown_function.out
Normal file
@ -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 | }
|
5
vlib/v/checker/tests/unknown_function.vv
Normal file
5
vlib/v/checker/tests/unknown_function.vv
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import math
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
println(math.max_i64())
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user