mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: minor wording fix in an error
This commit is contained in:
parent
7e067c5fb6
commit
877e6ddc9f
@ -385,12 +385,12 @@ fn (mut p Parser) fn_decl() ast.FnDecl {
|
||||
}
|
||||
}
|
||||
// Args
|
||||
args2, are_args_type_only, mut is_variadic := p.fn_args()
|
||||
args2, are_params_type_only, mut is_variadic := p.fn_args()
|
||||
if is_c2v_variadic {
|
||||
is_variadic = true
|
||||
}
|
||||
params << args2
|
||||
if !are_args_type_only {
|
||||
if !are_params_type_only {
|
||||
for k, param in params {
|
||||
if p.scope.known_var(param.name) {
|
||||
p.error_with_pos('redefinition of parameter `${param.name}`', param.pos)
|
||||
@ -567,8 +567,8 @@ run them via `v file.v` instead',
|
||||
p.inside_unsafe_fn = false
|
||||
p.inside_fn = false
|
||||
}
|
||||
if !no_body && are_args_type_only {
|
||||
p.error_with_pos('functions with type only args can not have bodies', body_start_pos)
|
||||
if !no_body && are_params_type_only {
|
||||
p.error_with_pos('functions with type only params can not have bodies', body_start_pos)
|
||||
return ast.FnDecl{
|
||||
scope: 0
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
vlib/v/parser/tests/fn_body_start_pos.vv:1:14: error: functions with type only args can not have bodies
|
||||
vlib/v/parser/tests/fn_body_start_pos.vv:1:14: error: functions with type only params can not have bodies
|
||||
1 | fn func(int) {}
|
||||
| ^
|
||||
| ^
|
||||
|
@ -1,4 +1,4 @@
|
||||
vlib/v/parser/tests/fn_type_only_args_no_body.vv:1:14: error: functions with type only args can not have bodies
|
||||
vlib/v/parser/tests/fn_type_only_args_no_body.vv:1:14: error: functions with type only params can not have bodies
|
||||
1 | fn test(int) {
|
||||
| ^
|
||||
2 | }
|
||||
|
@ -1,4 +1,4 @@
|
||||
vlib/v/parser/tests/fn_type_only_args_unknown_name.vv:1:16: error: functions with type only args can not have bodies
|
||||
vlib/v/parser/tests/fn_type_only_args_unknown_name.vv:1:16: error: functions with type only params can not have bodies
|
||||
1 | fn test(param) {
|
||||
| ^
|
||||
2 | }
|
||||
|
@ -891,6 +891,8 @@ fn (mut s Scanner) text_scan() token.Token {
|
||||
at_error_msg += '\nAvailable compile time variables:\n${token.valid_at_tokens}'
|
||||
}
|
||||
s.error(at_error_msg)
|
||||
} else {
|
||||
// s.note('@keyword is being deprecated and then removed from V. Use `keyword_` or a different name (e.g. `typ` instead of `type`)')
|
||||
}
|
||||
return s.new_token(.name, name, name.len)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user