elixirmoney / money

Elixir library for working with Money safer, easier, and fun... Is an interpretation of the Fowler's Money pattern in fun.prog.
https://hex.pm/packages/money/
MIT License
827 stars 141 forks source link

Warning when compiling with Elixir 1.11.0-rc.0 #150

Closed wingyplus closed 4 years ago

wingyplus commented 4 years ago

I found warnings when try to compile with Elixir 1.11.0-rc.0:

==> money
Compiling 11 files (.ex)
warning: redefining @doc attribute previously set at line 265.
Please remove the duplicate docs. If instead you want to override a previously defined @doc, attach the @doc attribute to a function head:
    @doc """
    new docs
    """
    def get(...)
  lib/money/currency.ex:278: Money.Currency.get/1
warning: incompatible types:
    %Money{} !~ atom()
in expression:
    # lib/money/ecto/map_type.ex:36
    money.amount()
where "money" was given the type %Money{} in:
    # lib/money/ecto/map_type.ex:35
    %Money{} = money
where "money" was given the type atom() (due to calling var.fun()) in:
    # lib/money/ecto/map_type.ex:36
    money.amount()
HINT: "var.field" (without parentheses) implies "var" is a map() while "var.fun()" (with parentheses) implies "var" is an atom()
Conflict found at
  lib/money/ecto/map_type.ex:36: Money.Ecto.Map.Type.dump/1
Generated money app
wingyplus commented 4 years ago

For redefining @doc warning, I think we need to declare no body clause function for get/1 and rephase in documentation.

Nitrino commented 4 years ago

@wingyplus Yep @doc should be defined for get/1 no body clause function. Will you send a pull request?

wingyplus commented 4 years ago

Sure i will

wingyplus commented 4 years ago

@Nitrino The PR was open. I just copy the example from the second match of get/1 because it doesn't raise ArgumentError as it said in the doc.