Skip to content

Spect can't handle negative Decimals #19

@23Skidoo

Description

@23Skidoo

Using the decimal-2.0.0 package:

iex(20)> Spect.to_spec(Decimal.new("1.23"), Decimal)       
{:ok, #Decimal<1.23>}

iex(21)> Spect.to_spec(Decimal.new("-1.23"), Decimal)
{:error,
 %Spect.ConvertError{
   message: "expected: union of [{:integer, 0, 1}, {:op, 74, :-, {:integer, 74, 1}}], found: -1"
 }}

My guess is that it's due to sign() in decimal-2.0.0 being defined as

@type sign :: 1 | -1

which seems to be an invalid typespec.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions