diff --git a/doc/docs.md b/doc/docs.md index 6a0372da66..dfd119abb0 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -2438,7 +2438,7 @@ V now supports static type methods like `User.new()`. These are defined on a str `fn [Type name].[function name]` and allow to organize all functions related to a struct: ```v oksyntax -struct User { } +struct User {} fn User.new() User { return User{} diff --git a/vlib/v/parser/fn.v b/vlib/v/parser/fn.v index 76bff1a659..b71c26d699 100644 --- a/vlib/v/parser/fn.v +++ b/vlib/v/parser/fn.v @@ -536,7 +536,7 @@ run them via `v file.v` instead', is_keep_alive: is_keep_alive is_method: false is_static_type_method: is_static_type_method - receiver_type: rec.typ // used only if is static type method + receiver_type: if is_static_type_method { rec.typ } else { 0 } // used only if is static type method is_file_translated: p.is_translated // attrs: p.attrs