elixir-lang / elixir

Elixir is a dynamic, functional language for building scalable and maintainable applications
https://elixir-lang.org/
Apache License 2.0
24.51k stars 3.38k forks source link

Inconsistent parens behaviour on TypeSpecs when formatting. #7490

Closed seivan closed 6 years ago

seivan commented 6 years ago

Environment

Elixir 1.6.4 (compiled with OTP 20)


* Operating system: 

macOS High Sierra 10.13.3 (17D102)


### Current behavior

Formatter assigns parens to typespecs in an inconsistent manner. My guess is it makes no distinction between functions and typespec and if something looks like a function it gets parens. 
```elixir
  @spec new(Point.t, Size.t) :: t

becomes

  @spec new(Point.t(), Size.t()) :: t

Expected behavior

Either don't add parens at all to specs (my preference!) or be consistent

  @spec new(Point.t, Size.t) :: t

or

  @spec new(Point.t(), Size.t()) :: t()
josevalim commented 6 years ago

Duplicate of #7401. :) --

José Valimwww.plataformatec.com.br http://www.plataformatec.com.br/Founder and Director of R&D

seivan commented 6 years ago

This answers the question https://github.com/elixir-lang/elixir/issues/7401#issuecomment-368804268