Skip to content

Commit 877e6dd

Browse files
committed
checker: minor wording fix in an error
1 parent 7e067c5 commit 877e6dd

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

vlib/v/parser/fn.v

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,12 +385,12 @@ fn (mut p Parser) fn_decl() ast.FnDecl {
385385
}
386386
}
387387
// Args
388-
args2, are_args_type_only, mut is_variadic := p.fn_args()
388+
args2, are_params_type_only, mut is_variadic := p.fn_args()
389389
if is_c2v_variadic {
390390
is_variadic = true
391391
}
392392
params << args2
393-
if !are_args_type_only {
393+
if !are_params_type_only {
394394
for k, param in params {
395395
if p.scope.known_var(param.name) {
396396
p.error_with_pos('redefinition of parameter `${param.name}`', param.pos)
@@ -567,8 +567,8 @@ run them via `v file.v` instead',
567567
p.inside_unsafe_fn = false
568568
p.inside_fn = false
569569
}
570-
if !no_body && are_args_type_only {
571-
p.error_with_pos('functions with type only args can not have bodies', body_start_pos)
570+
if !no_body && are_params_type_only {
571+
p.error_with_pos('functions with type only params can not have bodies', body_start_pos)
572572
return ast.FnDecl{
573573
scope: 0
574574
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
vlib/v/parser/tests/fn_body_start_pos.vv:1:14: error: functions with type only args can not have bodies
1+
vlib/v/parser/tests/fn_body_start_pos.vv:1:14: error: functions with type only params can not have bodies
22
1 | fn func(int) {}
3-
| ^
3+
| ^

vlib/v/parser/tests/fn_type_only_args_no_body.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
vlib/v/parser/tests/fn_type_only_args_no_body.vv:1:14: error: functions with type only args can not have bodies
1+
vlib/v/parser/tests/fn_type_only_args_no_body.vv:1:14: error: functions with type only params can not have bodies
22
1 | fn test(int) {
33
| ^
44
2 | }

vlib/v/parser/tests/fn_type_only_args_unknown_name.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
vlib/v/parser/tests/fn_type_only_args_unknown_name.vv:1:16: error: functions with type only args can not have bodies
1+
vlib/v/parser/tests/fn_type_only_args_unknown_name.vv:1:16: error: functions with type only params can not have bodies
22
1 | fn test(param) {
33
| ^
44
2 | }

vlib/v/scanner/scanner.v

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,8 @@ fn (mut s Scanner) text_scan() token.Token {
891891
at_error_msg += '\nAvailable compile time variables:\n${token.valid_at_tokens}'
892892
}
893893
s.error(at_error_msg)
894+
} else {
895+
// s.note('@keyword is being deprecated and then removed from V. Use `keyword_` or a different name (e.g. `typ` instead of `type`)')
894896
}
895897
return s.new_token(.name, name, name.len)
896898
}

0 commit comments

Comments
 (0)