diff --git a/spec/compiler/formatter/formatter_spec.cr b/spec/compiler/formatter/formatter_spec.cr index 3d3f77930cc8..7f49eb71f58e 100644 --- a/spec/compiler/formatter/formatter_spec.cr +++ b/spec/compiler/formatter/formatter_spec.cr @@ -733,7 +733,18 @@ describe Crystal::Formatter do assert_format "alias Foo::Bar = Baz", "alias Foo::Bar = Baz" assert_format "alias A = (B)" assert_format "alias A = (B) -> C" - + assert_format "alias Foo=Bar", "alias Foo = Bar" + assert_format "alias Foo= Bar", "alias Foo = Bar" + assert_format "alias Foo =Bar", "alias Foo = Bar" + assert_format "alias Foo::Bar=Baz", "alias Foo::Bar = Baz" + assert_format "alias Foo::Bar= Baz", "alias Foo::Bar = Baz" + assert_format "alias Foo::Bar =Baz", "alias Foo::Bar = Baz" + assert_format <<-BEFORE, <<-AFTER + alias Foo= + Bar + BEFORE + alias Foo = Bar + AFTER assert_format "lib Foo\nend" assert_format "lib Foo\ntype Foo = Bar\nend", "lib Foo\n type Foo = Bar\nend" assert_format "lib Foo\nfun foo\nend", "lib Foo\n fun foo\nend" diff --git a/src/compiler/crystal/tools/formatter.cr b/src/compiler/crystal/tools/formatter.cr index cb2b0fd0cf69..7c28823a3798 100644 --- a/src/compiler/crystal/tools/formatter.cr +++ b/src/compiler/crystal/tools/formatter.cr @@ -4072,10 +4072,10 @@ module Crystal accept name else write name + next_token end - next_token_skip_space_or_newline - + skip_space write_token " ", :OP_EQ, " " skip_space_or_newline