Skip to content

Commit b8cec30

Browse files
authored
Ensure :native is a valid parameter type (#13781)
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
1 parent cf49f8b commit b8cec30

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/elixir/lib/system.ex

+3-3
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ defmodule System do
12391239
This time is monotonically increasing and starts in an unspecified
12401240
point in time.
12411241
"""
1242-
@spec monotonic_time(time_unit) :: integer
1242+
@spec monotonic_time(time_unit | :native) :: integer
12431243
def monotonic_time(unit) do
12441244
:erlang.monotonic_time(normalize_time_unit(unit))
12451245
end
@@ -1265,7 +1265,7 @@ defmodule System do
12651265
case of time warps although the VM works towards aligning
12661266
them. This time is not monotonic.
12671267
"""
1268-
@spec system_time(time_unit) :: integer
1268+
@spec system_time(time_unit | :native) :: integer
12691269
def system_time(unit) do
12701270
:erlang.system_time(normalize_time_unit(unit))
12711271
end
@@ -1316,7 +1316,7 @@ defmodule System do
13161316
`monotonic_time/1`), gives the Erlang system time that corresponds
13171317
to that monotonic time.
13181318
"""
1319-
@spec time_offset(time_unit) :: integer
1319+
@spec time_offset(time_unit | :native) :: integer
13201320
def time_offset(unit) do
13211321
:erlang.time_offset(normalize_time_unit(unit))
13221322
end

0 commit comments

Comments
 (0)