diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v index 4d5d59ccead4a6..32925545ef3f1a 100644 --- a/vlib/v/fmt/fmt.v +++ b/vlib/v/fmt/fmt.v @@ -1721,6 +1721,7 @@ pub fn (mut f Fmt) fn_type_decl(node ast.FnTypeDecl) { if s.starts_with('&') { s = s[1..] } + s = s.trim_left('shared ') } is_last_arg := i == fn_info.params.len - 1 should_add_type := true || is_last_arg diff --git a/vlib/v/fmt/tests/receiver_state_keep.vv b/vlib/v/fmt/tests/receiver_state_keep.vv new file mode 100644 index 00000000000000..e16f9a5cbf88dc --- /dev/null +++ b/vlib/v/fmt/tests/receiver_state_keep.vv @@ -0,0 +1,5 @@ +module main + +struct State {} + +type Func = fn (shared state State) string