Typespecs are following the same rules as all other code because the
formatter only sees AST and can't discern typespecs from executed code.

We can't add parenthesis to nullary local function calls because they have
the same AST representation as variables so adding parenthesis would break
code.

On Mon, Feb 5, 2018 at 2:24 PM, Vincent Siliakus <[email protected]> wrote:

> Hi,
>
> Maybe there's a good reason for the current behaviour, so I'm posting it
> here instead of opening an issue on Github.
>
> Consider the following typespecs:
>
> @type strkey_kv :: [{String.t, term}]
>
> @type kv :: strkey_kv | map | Keyword.t
>
> When these typespecs get processed by Elixir's new format option, the
> result is:
>
> @type strkey_kv :: [{String.t(), term}]
>
> @type kv :: strkey_kv | map | Keyword.t()
>
> Note the added braces to String.t and Keyword.t. Now I don't have a strong
> opinion on writing types with or without using braces, but I don't think
> adding braces only to external types is good.
>
> Can this be considered a bug or is there a reason for the current
> behaviour?
>
> Best,
> Vincent
>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/elixir-lang-core/a53d03cb-dd9e-4945-a5d1-
> c2f23f540c7e%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/a53d03cb-dd9e-4945-a5d1-c2f23f540c7e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Eric Meadows-Jönsson

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAM_eapiTy%2BV7-Uvc%3DMc8uDRYg_rOZw3J2xYQSYw3YtHdSsY0mw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to