mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vfmt: fix extra whitspace in fn type decl with type-only args (#6888)
This commit is contained in:
parent
30ddb89e3c
commit
5d76e85a23
@ -534,10 +534,11 @@ pub fn (mut f Fmt) type_decl(node ast.TypeDecl) {
|
||||
should_add_type := true || is_last_arg || fn_info.params[i + 1].typ != arg.typ ||
|
||||
(fn_info.is_variadic && i == fn_info.params.len - 2)
|
||||
if should_add_type {
|
||||
ns := if arg.name == '' { '' } else { ' ' }
|
||||
if fn_info.is_variadic && is_last_arg {
|
||||
f.write(' ...' + s)
|
||||
f.write(ns + '...' + s)
|
||||
} else {
|
||||
f.write(' ' + s)
|
||||
f.write(ns + s)
|
||||
}
|
||||
}
|
||||
if !is_last_arg {
|
||||
|
@ -24,3 +24,5 @@ type TwoSameArgs = fn (i int, j int) string // And a comment
|
||||
type VarArgs = fn (s ...string) int
|
||||
|
||||
type NOVarArgs = fn (i int, s ...string) f64
|
||||
|
||||
type NoNameArgs = fn (int, string, ...string)
|
||||
|
@ -33,3 +33,5 @@ type VarArgs = fn
|
||||
(s ...string) int
|
||||
|
||||
type NOVarArgs = fn(i int, s ...string) f64
|
||||
|
||||
type NoNameArgs = fn( int, string , ...string)
|
||||
|
Loading…
Reference in New Issue
Block a user