mirror of
https://github.com/vlang/v.git
synced 2025-09-19 12:27:02 -04:00
checker: fix compiler panic, when calling an unknown function in C.printf(c'%f\n', sin(2))
(fix #22343) (#22348)
This commit is contained in:
parent
161d29a922
commit
80e09e2f91
@ -1285,7 +1285,7 @@ fn (mut c Checker) fn_call(mut node ast.CallExpr, mut continue_check &bool) ast.
|
||||
c.expected_type = expected_type
|
||||
}
|
||||
typ := if already_checked && mut call_arg.expr is ast.CallExpr {
|
||||
call_arg.expr.return_type
|
||||
node.args[i].typ
|
||||
} else {
|
||||
c.expr(mut call_arg.expr)
|
||||
}
|
||||
|
6
vlib/v/checker/tests/unknown_fn_call_err.out
Normal file
6
vlib/v/checker/tests/unknown_fn_call_err.out
Normal file
@ -0,0 +1,6 @@
|
||||
vlib/v/checker/tests/unknown_fn_call_err.vv:4:20: error: unknown function: sin
|
||||
2 |
|
||||
3 | fn main() {
|
||||
4 | C.printf(c'%f\n', sin(2))
|
||||
| ~~~~~~
|
||||
5 | }
|
5
vlib/v/checker/tests/unknown_fn_call_err.vv
Normal file
5
vlib/v/checker/tests/unknown_fn_call_err.vv
Normal file
@ -0,0 +1,5 @@
|
||||
module main
|
||||
|
||||
fn main() {
|
||||
C.printf(c'%f\n', sin(2))
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user