Skip to content

Commit feffe2c

Browse files
committed
Fix typespec of Month.range/2 and range/3
1 parent 34302ea commit feffe2c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/month.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,8 @@ defmodule Shared.Month do
471471
iex> Month.range(@third_month_of_2018, @third_month_of_2019)
472472
%Shared.Month.Range{direction: :forward, size: 13, start: ~m[2018-03]}
473473
"""
474-
@spec range(t(), t()) :: Month.Range.t()
475-
defdelegate range(start, stop), to: Shared.Month.Range, as: :new
474+
@spec range(t(), t() | pos_integer()) :: Month.Range.t()
475+
defdelegate range(start, stop_or_size), to: Shared.Month.Range, as: :new
476476

477477
@doc """
478478
Creates a range of months from start to stop in the given direction.
@@ -482,8 +482,8 @@ defmodule Shared.Month do
482482
iex> Month.range(@third_month_of_2019, @third_month_of_2018, :backward)
483483
%Shared.Month.Range{direction: :backward, size: 13, start: ~m[2019-03]}
484484
"""
485-
@spec range(t(), t(), Shared.Month.Range.direction()) :: Shared.Month.Range.t()
486-
defdelegate range(start, stop, direction), to: Shared.Month.Range, as: :new
485+
@spec range(t(), t() | pos_integer(), Shared.Month.Range.direction()) :: Shared.Month.Range.t()
486+
defdelegate range(start, stop_or_size, direction), to: Shared.Month.Range, as: :new
487487

488488
@doc ~S"""
489489
## Examples

lib/month/range.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ defmodule Shared.Month.Range do
6262

6363
def new(%Month{} = start, size), do: new(start, size, :forward)
6464

65-
@spec new(Month.t(), pos_integer(), direction()) :: t()
65+
@spec new(Month.t(), Month.t() | pos_integer(), direction()) :: t()
6666
def new(_, _, direction) when direction not in [:forward, :backward],
6767
do: raise(ArgumentError, "Invalid direction: #{inspect(direction)}")
6868

0 commit comments

Comments
 (0)