mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
v/fmt: fix formatting of type Foo = fn (a int)?
(#6047)
This commit is contained in:
parent
f605022481
commit
c547e8b191
@ -562,7 +562,9 @@ pub fn (mut f Fmt) type_decl(node ast.TypeDecl) {
|
||||
f.write(')')
|
||||
if fn_info.return_type.idx() != table.void_type_idx {
|
||||
ret_str := f.no_cur_mod(f.table.type_to_str(fn_info.return_type))
|
||||
f.write(' ' + ret_str)
|
||||
f.write(' $ret_str')
|
||||
} else if fn_info.return_type.has_flag(.optional) {
|
||||
f.write(' ?')
|
||||
}
|
||||
}
|
||||
ast.SumTypeDecl {
|
||||
|
3
vlib/v/fmt/tests/fntype_return_optional_expected.vv
Normal file
3
vlib/v/fmt/tests/fntype_return_optional_expected.vv
Normal file
@ -0,0 +1,3 @@
|
||||
type Foo = fn (a int) ?
|
||||
|
||||
type Foo2 = fn (num int) ?int
|
3
vlib/v/fmt/tests/fntype_return_optional_input.vv
Normal file
3
vlib/v/fmt/tests/fntype_return_optional_input.vv
Normal file
@ -0,0 +1,3 @@
|
||||
type Foo = fn (a int)?
|
||||
|
||||
type Foo2 = fn (num int)?int
|
Loading…
Reference in New Issue
Block a user