Skip to content

Commit

Permalink
Ensure :native is a valid parameter type (#13781)
Browse files Browse the repository at this point in the history
Several of the functions in System that deal with time had a typespec
that only allowed the time_unit type even though they accepted the
:native time unit. This confuses dialyzer if :native is passed to
these functions
  • Loading branch information
scohen authored and sabiwara committed Aug 17, 2024
1 parent 10f8659 commit b734da3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/elixir/lib/system.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ defmodule System do
This time is monotonically increasing and starts in an unspecified
point in time.
"""
@spec monotonic_time(time_unit) :: integer
@spec monotonic_time(time_unit | :native) :: integer
def monotonic_time(unit) do
:erlang.monotonic_time(normalize_time_unit(unit))
end
Expand All @@ -1265,7 +1265,7 @@ defmodule System do
case of time warps although the VM works towards aligning
them. This time is not monotonic.
"""
@spec system_time(time_unit) :: integer
@spec system_time(time_unit | :native) :: integer
def system_time(unit) do
:erlang.system_time(normalize_time_unit(unit))
end
Expand Down Expand Up @@ -1316,7 +1316,7 @@ defmodule System do
`monotonic_time/1`), gives the Erlang system time that corresponds
to that monotonic time.
"""
@spec time_offset(time_unit) :: integer
@spec time_offset(time_unit | :native) :: integer
def time_offset(unit) do
:erlang.time_offset(normalize_time_unit(unit))
end
Expand Down

0 comments on commit b734da3

Please sign in to comment.