From d38bca5958b899db33c7ce49893387e274b593e5 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Mon, 7 Dec 2020 19:21:18 +0200 Subject: [PATCH] checker: tweak the import private function message a little --- vlib/v/checker/checker.v | 3 ++- vlib/v/checker/tests/import_symbol_fn_private_err.out | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index a4919c7824..25cabe6bfe 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -1463,7 +1463,8 @@ pub fn (mut c Checker) call_fn(mut call_expr ast.CallExpr) table.Type { } } if !f.is_pub && f.language == .v && f.name.len > 0 && f.mod.len > 0 && f.mod != c.mod { - c.error('function `$f.name` is private. curmod=$c.mod fmod=$f.mod', call_expr.pos) + c.error('function `$f.name` is private, so you can not import it in module `$c.mod`', + call_expr.pos) } if f.is_deprecated { c.warn('function `$f.name` has been deprecated', call_expr.pos) diff --git a/vlib/v/checker/tests/import_symbol_fn_private_err.out b/vlib/v/checker/tests/import_symbol_fn_private_err.out index 1ddc4f460c..c12f27ee2c 100644 --- a/vlib/v/checker/tests/import_symbol_fn_private_err.out +++ b/vlib/v/checker/tests/import_symbol_fn_private_err.out @@ -3,7 +3,7 @@ vlib/v/checker/tests/import_symbol_fn_private_err.vv:1:20: error: module `time` | ~~~~~ 2 | fn main() { 3 | since(now()) -vlib/v/checker/tests/import_symbol_fn_private_err.vv:3:3: error: function `time.since` is private. curmod=main fmod=time +vlib/v/checker/tests/import_symbol_fn_private_err.vv:3:3: error: function `time.since` is private, so you can not import it in module `main` 1 | import time { now, since } 2 | fn main() { 3 | since(now())