Skip to content

Conversation

@Premwoik
Copy link
Collaborator

@Premwoik Premwoik commented May 20, 2022

This PR addresses #74 and adds the possibility to have multiple specs per function clause. Previously it was possible to have only one spec per function clause.

This one refers to the #55 that introduced this feature.

Valid specs location

@spec convert(integer()) :: float()
@spec convert(atom()) :: binary()
def convert(int) when is_integer(int), do: int / 1

def convert(atom) when is_atom(atom), do: to_string(atom
@spec convert(integer()) :: float()
def convert(int) when is_integer(int), do: int / 1
@spec convert(atom()) :: binary()
def convert(atom) when is_atom(atom), do: to_string(atom)

Invalid specs location

@spec last_two(atom()) :: atom()
def last_three(:ok) do
  :ok
end
@spec last_two(atom()) :: atom()
@spec last_three(atom()) :: atom()
def last_three(:ok) do
  :ok
end

@Premwoik Premwoik linked an issue May 20, 2022 that may be closed by this pull request
@Premwoik Premwoik marked this pull request as ready for review May 20, 2022 23:07
@Premwoik Premwoik requested a review from erszcz May 20, 2022 23:08
Copy link
Contributor

@erszcz erszcz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome 👍

@Premwoik Premwoik merged commit 63ec628 into main May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple specs are allowed per function, but Gradient says they can't.

3 participants