diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v index 448de96b5f..e8aeeebadf 100644 --- a/vlib/v/fmt/fmt.v +++ b/vlib/v/fmt/fmt.v @@ -150,6 +150,9 @@ fn (f mut Fmt) stmt(node ast.Stmt) { f.writeln('}') } ast.EnumDecl { + if it.is_pub { + f.write('pub ') + } f.writeln('enum $it.name {') for val in it.vals { f.writeln('\t' + val) diff --git a/vlib/v/fmt/tests/simple_expected.vv b/vlib/v/fmt/tests/simple_expected.vv index 61424079b5..c7ad7c5d08 100644 --- a/vlib/v/fmt/tests/simple_expected.vv +++ b/vlib/v/fmt/tests/simple_expected.vv @@ -22,6 +22,16 @@ pub const ( i_am_pub_const = true ) +pub enum PubEnum { + foo + bar +} + +enum PrivateEnum { + foo + bar +} + struct User { name string age int diff --git a/vlib/v/fmt/tests/simple_input.vv b/vlib/v/fmt/tests/simple_input.vv index 6e383e4637..a5c00a7b1e 100644 --- a/vlib/v/fmt/tests/simple_input.vv +++ b/vlib/v/fmt/tests/simple_input.vv @@ -23,6 +23,14 @@ pub const ( i_am_pub_const=true ) +pub enum PubEnum{ + foo bar +} + +enum PrivateEnum{ + foo bar +} + struct User { name string age int