Skip to content

Commit 103db3a

Browse files
eksperimentaljosevalim
authored andcommitted
Simplify specs in Range by introducing t:limit/0 (#10844)
1 parent 6f95bf2 commit 103db3a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/elixir/lib/range.ex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,9 @@ defmodule Range do
9696
@enforce_keys [:first, :last, :step]
9797
defstruct first: nil, last: nil, step: nil
9898

99-
@type first :: integer
100-
@type last :: integer
99+
@type limit :: integer
101100
@type step :: pos_integer | neg_integer
102-
@type t :: %__MODULE__{first: first, last: last, step: step}
101+
@type t :: %__MODULE__{first: limit, last: limit, step: step}
103102
@type t(first, last) :: %__MODULE__{first: first, last: last, step: step}
104103

105104
@doc """
@@ -119,7 +118,8 @@ defmodule Range do
119118
-100..100
120119
121120
"""
122-
@spec new(first, last) :: t
121+
122+
@spec new(limit, limit) :: t
123123
def new(first, last) when is_integer(first) and is_integer(last) do
124124
# TODO: Deprecate inferring a range with step of -1 on Elixir v1.17
125125
step = if first <= last, do: 1, else: -1
@@ -142,7 +142,7 @@ defmodule Range do
142142
143143
"""
144144
@doc since: "1.12.0"
145-
@spec new(first, last, step) :: t
145+
@spec new(limit, limit, step) :: t
146146
def new(first, last, step)
147147
when is_integer(first) and is_integer(last) and is_integer(step) and step != 0 do
148148
%Range{first: first, last: last, step: step}

0 commit comments

Comments
 (0)