We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b01273e commit 66b75c2Copy full SHA for 66b75c2
3 files changed
vlib/v/markused/walker.v
@@ -454,7 +454,9 @@ fn (mut w Walker) expr(node_ ast.Expr) {
454
}
455
ast.CallExpr {
456
w.call_expr(mut node)
457
- if node.name == 'json.decode' {
+ if node.is_fn_a_const {
458
+ w.mark_const_as_used(node.name)
459
+ } else if node.name == 'json.decode' {
460
w.mark_by_type((node.args[0].expr as ast.TypeNode).typ)
461
} else if node.name == 'json.encode' && node.args[0].typ != 0 {
462
sym := w.table.final_sym(node.args[0].typ)
vlib/v/tests/consts/const_markused_test.v
@@ -0,0 +1,6 @@
1
+import my_utils
2
+
3
+fn test_main() {
4
+ v := f64(1.0 / 8)
5
+ assert my_utils.my_round(v, 2) == '0.13'
6
+}
vlib/v/tests/consts/my_utils/my_utils.v
@@ -0,0 +1,5 @@
+module my_utils
+import strconv
+pub const my_round = strconv.f64_to_str_lnd1
0 commit comments