1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

compiler: error on unused imports

This commit is contained in:
joe-conigliaro
2019-09-23 20:42:20 +10:00
committed by Alexander Medvednikov
parent 71484e89d6
commit 23c84516e2
29 changed files with 112 additions and 55 deletions

View File

@@ -730,6 +730,7 @@ fn (p mut Parser) fn_args(f mut Fn) {
if types_only {
for p.tok != .rpar {
typ := p.get_type()
p.check_and_register_used_imported_type(typ)
v := Var {
typ: typ
is_arg: true
@@ -761,6 +762,7 @@ fn (p mut Parser) fn_args(f mut Fn) {
p.next()
}
mut typ := p.get_type()
p.check_and_register_used_imported_type(typ)
if is_mut && is_primitive_type(typ) {
p.error('mutable arguments are only allowed for arrays, maps, and structs.' +
'\nreturn values instead: `foo(n mut int)` => `foo(n int) int`')