vfmt: fix extra whitspace in fn type decl with type-only args (#6888)
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 ||
|
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)
|
(fn_info.is_variadic && i == fn_info.params.len - 2)
|
||||||
if should_add_type {
|
if should_add_type {
|
||||||
|
ns := if arg.name == '' { '' } else { ' ' }
|
||||||
if fn_info.is_variadic && is_last_arg {
|
if fn_info.is_variadic && is_last_arg {
|
||||||
f.write(' ...' + s)
|
f.write(ns + '...' + s)
|
||||||
} else {
|
} else {
|
||||||
f.write(' ' + s)
|
f.write(ns + s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !is_last_arg {
|
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 VarArgs = fn (s ...string) int
|
||||||
|
|
||||||
type NOVarArgs = fn (i int, s ...string) f64
|
type NOVarArgs = fn (i int, s ...string) f64
|
||||||
|
|
||||||
|
type NoNameArgs = fn (int, string, ...string)
|
||||||
|
|
|
@ -33,3 +33,5 @@ type VarArgs = fn
|
||||||
(s ...string) int
|
(s ...string) int
|
||||||
|
|
||||||
type NOVarArgs = fn(i int, s ...string) f64
|
type NOVarArgs = fn(i int, s ...string) f64
|
||||||
|
|
||||||
|
type NoNameArgs = fn( int, string , ...string)
|
||||||
|
|
Loading…
Reference in New Issue