checker: tweak the import private function message a little

pull/7187/head
Delyan Angelov 2020-12-07 19:21:18 +02:00
parent 78a6795319
commit d38bca5958
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
2 changed files with 3 additions and 2 deletions

View File

@ -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)

View File

@ -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())