Skip to content

Commit 2817a70

Browse files
authored
Remove mentions to OTP27+ versions from docs, comments and tests (#15165)
* Remove mentions of "since OTP27+" * Remove test code for OTP26-
1 parent acd76b6 commit 2817a70

10 files changed

Lines changed: 88 additions & 149 deletions

File tree

lib/elixir/lib/process.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -982,8 +982,8 @@ defmodule Process do
982982
@doc """
983983
Add a descriptive term to the current process.
984984
985-
The term does not need to be unique, and in Erlang/OTP 27+ will be shown in
986-
Observer and in crash logs.
985+
The term does not need to be unique, and will be shown in Observer and in
986+
crash logs.
987987
This label may be useful for identifying a process as one of multiple in a
988988
given role, such as `:queue_worker` or `{:live_chat, user_id}`.
989989

lib/elixir/pages/getting-started/debugging.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,6 @@ iex> :observer.start()
160160
> When running `iex` inside a project with `iex -S mix`, `observer` won't be available as a dependency. To do so, you will need to call the following functions before:
161161
>
162162
> ```elixir
163-
> iex> Mix.ensure_application!(:wx) # Not necessary on Erlang/OTP 27+
164-
> iex> Mix.ensure_application!(:runtime_tools) # Not necessary on Erlang/OTP 27+
165163
> iex> Mix.ensure_application!(:observer)
166164
> iex> :observer.start()
167165
> ```

lib/elixir/src/elixir_expand.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,7 @@ assert_no_underscore_clause_in_cond(_Other, _E) ->
11281128
%% Errors
11291129

11301130
format_error(invalid_match_on_zero_float) ->
1131-
"pattern matching on 0.0 is equivalent to matching only on +0.0 from Erlang/OTP 27+. Instead you must match on +0.0 or -0.0";
1131+
"pattern matching on 0.0 is equivalent to matching only on +0.0. Instead you must match on +0.0 or -0.0";
11321132
format_error({useless_literal, Term}) ->
11331133
io_lib:format("code block contains unused literal ~ts "
11341134
"(remove the literal or assign it to _ to avoid warnings)",

lib/elixir/test/elixir/float_test.exs

Lines changed: 72 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,6 @@ defmodule FloatTest do
99

1010
doctest Float
1111

12-
# TODO remove and replace by assert once we require Erlang/OTP 27+
13-
# We can't easily distinguish between -0.0 and +0.0 on previous version
14-
defmacrop float_assert({:===, _, [left, right]}) do
15-
quote do
16-
# note: these are pure functions so no need to use bind_quoted
17-
# we favor a useful error message instead
18-
assert unquote(left) === unquote(right)
19-
assert to_string(unquote(left)) === to_string(unquote(right))
20-
end
21-
end
22-
2312
test "parse/1" do
2413
assert Float.parse("12") === {12.0, ""}
2514
assert Float.parse("-12") === {-12.0, ""}
@@ -65,153 +54,153 @@ defmodule FloatTest do
6554
end
6655

6756
test "floor/1" do
68-
float_assert Float.floor(12.524235) === 12.0
69-
float_assert Float.floor(-12.5) === -13.0
70-
float_assert Float.floor(-12.524235) === -13.0
71-
float_assert Float.floor(7.5e3) === 7500.0
72-
float_assert Float.floor(7.5432e3) === 7543.0
73-
float_assert Float.floor(7.5e-3) === 0.0
74-
float_assert Float.floor(-12.32453e4) === -123_246.0
75-
float_assert Float.floor(-12.32453e-10) === -1.0
76-
float_assert Float.floor(0.32453e-10) === 0.0
77-
float_assert Float.floor(-0.32453e-10) === -1.0
78-
float_assert Float.floor(1.32453e-10) === 0.0
57+
assert Float.floor(12.524235) === 12.0
58+
assert Float.floor(-12.5) === -13.0
59+
assert Float.floor(-12.524235) === -13.0
60+
assert Float.floor(7.5e3) === 7500.0
61+
assert Float.floor(7.5432e3) === 7543.0
62+
assert Float.floor(7.5e-3) === 0.0
63+
assert Float.floor(-12.32453e4) === -123_246.0
64+
assert Float.floor(-12.32453e-10) === -1.0
65+
assert Float.floor(0.32453e-10) === 0.0
66+
assert Float.floor(-0.32453e-10) === -1.0
67+
assert Float.floor(1.32453e-10) === 0.0
7968
end
8069

8170
describe "floor/2" do
8271
test "with 0.0" do
8372
for precision <- 0..15 do
84-
float_assert Float.floor(0.0, precision) === 0.0
85-
float_assert Float.floor(-0.0, precision) === -0.0
73+
assert Float.floor(0.0, precision) === 0.0
74+
assert Float.floor(-0.0, precision) === -0.0
8675
end
8776
end
8877

8978
test "floor/2 with precision" do
90-
float_assert Float.floor(12.524235, 0) === 12.0
91-
float_assert Float.floor(-12.524235, 0) === -13.0
79+
assert Float.floor(12.524235, 0) === 12.0
80+
assert Float.floor(-12.524235, 0) === -13.0
9281

93-
float_assert Float.floor(12.52, 2) === 12.51
94-
float_assert Float.floor(-12.52, 2) === -12.52
82+
assert Float.floor(12.52, 2) === 12.51
83+
assert Float.floor(-12.52, 2) === -12.52
9584

96-
float_assert Float.floor(12.524235, 2) === 12.52
97-
float_assert Float.floor(-12.524235, 3) === -12.525
85+
assert Float.floor(12.524235, 2) === 12.52
86+
assert Float.floor(-12.524235, 3) === -12.525
9887

99-
float_assert Float.floor(12.32453e-20, 2) === 0.0
100-
float_assert Float.floor(-12.32453e-20, 2) === -0.01
88+
assert Float.floor(12.32453e-20, 2) === 0.0
89+
assert Float.floor(-12.32453e-20, 2) === -0.01
10190

10291
assert_raise ArgumentError, "precision 16 is out of valid range of 0..15", fn ->
10392
Float.floor(1.1, 16)
10493
end
10594
end
10695

10796
test "with subnormal floats" do
108-
float_assert Float.floor(-5.0e-324, 0) === -1.0
109-
float_assert Float.floor(-5.0e-324, 1) === -0.1
110-
float_assert Float.floor(-5.0e-324, 2) === -0.01
111-
float_assert Float.floor(-5.0e-324, 15) === -0.000000000000001
97+
assert Float.floor(-5.0e-324, 0) === -1.0
98+
assert Float.floor(-5.0e-324, 1) === -0.1
99+
assert Float.floor(-5.0e-324, 2) === -0.01
100+
assert Float.floor(-5.0e-324, 15) === -0.000000000000001
112101

113102
for precision <- 0..15 do
114-
float_assert Float.floor(5.0e-324, precision) === 0.0
103+
assert Float.floor(5.0e-324, precision) === 0.0
115104
end
116105
end
117106
end
118107

119108
test "ceil/1" do
120-
float_assert Float.ceil(12.524235) === 13.0
121-
float_assert Float.ceil(-12.5) === -12.0
122-
float_assert Float.ceil(-12.524235) === -12.0
123-
float_assert Float.ceil(7.5e3) === 7500.0
124-
float_assert Float.ceil(7.5432e3) === 7544.0
125-
float_assert Float.ceil(7.5e-3) === 1.0
126-
float_assert Float.ceil(-12.32453e4) === -123_245.0
127-
float_assert Float.ceil(-12.32453e-10) === -0.0
128-
float_assert Float.ceil(0.32453e-10) === 1.0
129-
float_assert Float.ceil(-0.32453e-10) === -0.0
130-
float_assert Float.ceil(1.32453e-10) === 1.0
131-
float_assert Float.ceil(0.0) === 0.0
109+
assert Float.ceil(12.524235) === 13.0
110+
assert Float.ceil(-12.5) === -12.0
111+
assert Float.ceil(-12.524235) === -12.0
112+
assert Float.ceil(7.5e3) === 7500.0
113+
assert Float.ceil(7.5432e3) === 7544.0
114+
assert Float.ceil(7.5e-3) === 1.0
115+
assert Float.ceil(-12.32453e4) === -123_245.0
116+
assert Float.ceil(-12.32453e-10) === -0.0
117+
assert Float.ceil(0.32453e-10) === 1.0
118+
assert Float.ceil(-0.32453e-10) === -0.0
119+
assert Float.ceil(1.32453e-10) === 1.0
120+
assert Float.ceil(0.0) === 0.0
132121
end
133122

134123
describe "ceil/2" do
135124
test "with 0.0" do
136125
for precision <- 0..15 do
137-
float_assert Float.ceil(0.0, precision) === 0.0
138-
float_assert Float.ceil(-0.0, precision) === -0.0
126+
assert Float.ceil(0.0, precision) === 0.0
127+
assert Float.ceil(-0.0, precision) === -0.0
139128
end
140129
end
141130

142131
test "with regular floats" do
143-
float_assert Float.ceil(12.524235, 0) === 13.0
144-
float_assert Float.ceil(-12.524235, 0) === -12.0
132+
assert Float.ceil(12.524235, 0) === 13.0
133+
assert Float.ceil(-12.524235, 0) === -12.0
145134

146-
float_assert Float.ceil(12.52, 2) === 12.52
147-
float_assert Float.ceil(-12.52, 2) === -12.51
135+
assert Float.ceil(12.52, 2) === 12.52
136+
assert Float.ceil(-12.52, 2) === -12.51
148137

149-
float_assert Float.ceil(12.524235, 2) === 12.53
150-
float_assert Float.ceil(-12.524235, 3) === -12.524
138+
assert Float.ceil(12.524235, 2) === 12.53
139+
assert Float.ceil(-12.524235, 3) === -12.524
151140

152-
float_assert Float.ceil(12.32453e-20, 2) === 0.01
153-
float_assert Float.ceil(-12.32453e-20, 2) === -0.0
141+
assert Float.ceil(12.32453e-20, 2) === 0.01
142+
assert Float.ceil(-12.32453e-20, 2) === -0.0
154143

155-
float_assert Float.ceil(0.0, 2) === 0.0
144+
assert Float.ceil(0.0, 2) === 0.0
156145

157146
assert_raise ArgumentError, "precision 16 is out of valid range of 0..15", fn ->
158147
Float.ceil(1.1, 16)
159148
end
160149
end
161150

162151
test "with small floats rounded up to -0.0" do
163-
float_assert Float.ceil(-0.1, 0) === -0.0
164-
float_assert Float.ceil(-0.01, 1) === -0.0
152+
assert Float.ceil(-0.1, 0) === -0.0
153+
assert Float.ceil(-0.01, 1) === -0.0
165154
end
166155

167156
test "with subnormal floats" do
168-
float_assert Float.ceil(5.0e-324, 0) === 1.0
169-
float_assert Float.ceil(5.0e-324, 1) === 0.1
170-
float_assert Float.ceil(5.0e-324, 2) === 0.01
171-
float_assert Float.ceil(5.0e-324, 15) === 0.000000000000001
157+
assert Float.ceil(5.0e-324, 0) === 1.0
158+
assert Float.ceil(5.0e-324, 1) === 0.1
159+
assert Float.ceil(5.0e-324, 2) === 0.01
160+
assert Float.ceil(5.0e-324, 15) === 0.000000000000001
172161

173162
for precision <- 0..15 do
174-
float_assert Float.ceil(-5.0e-324, precision) === -0.0
163+
assert Float.ceil(-5.0e-324, precision) === -0.0
175164
end
176165
end
177166
end
178167

179168
describe "round/2" do
180169
test "with 0.0" do
181170
for precision <- 0..15 do
182-
float_assert Float.round(0.0, precision) === 0.0
183-
float_assert Float.round(-0.0, precision) === -0.0
171+
assert Float.round(0.0, precision) === 0.0
172+
assert Float.round(-0.0, precision) === -0.0
184173
end
185174
end
186175

187176
test "with regular floats" do
188-
float_assert Float.round(5.5675, 3) === 5.567
189-
float_assert Float.round(-5.5674, 3) === -5.567
190-
float_assert Float.round(5.5, 3) === 5.5
191-
float_assert Float.round(5.5e-10, 10) === 5.0e-10
192-
float_assert Float.round(5.5e-10, 8) === 0.0
193-
float_assert Float.round(5.0, 0) === 5.0
177+
assert Float.round(5.5675, 3) === 5.567
178+
assert Float.round(-5.5674, 3) === -5.567
179+
assert Float.round(5.5, 3) === 5.5
180+
assert Float.round(5.5e-10, 10) === 5.0e-10
181+
assert Float.round(5.5e-10, 8) === 0.0
182+
assert Float.round(5.0, 0) === 5.0
194183

195184
assert_raise ArgumentError, "precision 16 is out of valid range of 0..15", fn ->
196185
Float.round(1.1, 16)
197186
end
198187
end
199188

200189
test "with small floats rounded to +0.0 / -0.0" do
201-
float_assert Float.round(0.01, 0) === 0.0
202-
float_assert Float.round(0.01, 1) === 0.0
190+
assert Float.round(0.01, 0) === 0.0
191+
assert Float.round(0.01, 1) === 0.0
203192

204-
float_assert Float.round(-0.01, 0) === -0.0
205-
float_assert Float.round(-0.01, 1) === -0.0
193+
assert Float.round(-0.01, 0) === -0.0
194+
assert Float.round(-0.01, 1) === -0.0
206195

207-
float_assert Float.round(-0.49999, 0) === -0.0
208-
float_assert Float.round(-0.049999, 1) === -0.0
196+
assert Float.round(-0.49999, 0) === -0.0
197+
assert Float.round(-0.049999, 1) === -0.0
209198
end
210199

211200
test "with subnormal floats" do
212201
for precision <- 0..15 do
213-
float_assert Float.round(5.0e-324, precision) === 0.0
214-
float_assert Float.round(-5.0e-324, precision) === -0.0
202+
assert Float.round(5.0e-324, precision) === 0.0
203+
assert Float.round(-5.0e-324, precision) === -0.0
215204
end
216205
end
217206
end

lib/elixir/test/elixir/kernel/expansion_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ defmodule Kernel.ExpansionTest do
531531
describe "floats" do
532532
test "cannot be 0.0 inside match" do
533533
assert capture_io(:stderr, fn -> expand(quote(do: 0.0 = 0.0)) end) =~
534-
"pattern matching on 0.0 is equivalent to matching only on +0.0 from Erlang/OTP 27+"
534+
"pattern matching on 0.0 is equivalent to matching only on +0.0"
535535

536536
assert {:=, [], [+0.0, +0.0]} = expand(quote(do: +0.0 = 0.0))
537537
assert {:=, [], [-0.0, +0.0]} = expand(quote(do: -0.0 = 0.0))

lib/elixir/test/elixir/process_test.exs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,11 @@ defmodule ProcessTest do
183183
describe "set_label/1" do
184184
@compile {:no_warn_undefined, :proc_lib}
185185

186-
test "sets a process label, compatible with OTP 27+ `:proc_lib.get_label/1`" do
186+
test "sets a process label, compatible with `:proc_lib.get_label/1`" do
187187
label = {:some_label, :rand.uniform(99999)}
188188
assert :ok = Process.set_label(label)
189189

190-
# TODO: Remove this when we require Erlang/OTP 27+
191-
if System.otp_release() >= "27" do
192-
assert :proc_lib.get_label(self()) == label
193-
end
190+
assert :proc_lib.get_label(self()) == label
194191
end
195192
end
196193

lib/ex_unit/test/ex_unit/capture_io_test.exs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,7 @@ defmodule ExUnit.CaptureIOTest do
255255
end)
256256

257257
capture_io("\"a", fn ->
258-
# TODO: Remove me when we require Erlang/OTP 27+
259-
expected_error =
260-
if System.otp_release() >= "27" do
261-
{1, :erl_scan, {:unterminated, :string, ~c"a"}}
262-
else
263-
{1, :erl_scan, {:string, 34, ~c"a"}}
264-
end
258+
expected_error = {1, :erl_scan, {:unterminated, :string, ~c"a"}}
265259

266260
assert :io.scan_erl_form(~c">") == {:error, expected_error, 1}
267261
assert :io.scan_erl_form(~c">") == {:eof, 1}

lib/ex_unit/test/ex_unit_test.exs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,11 +1259,8 @@ defmodule ExUnitTest do
12591259
end
12601260

12611261
test "sets process label for each test" do
1262-
# TODO: Remove check once we support Erlang/OTP 27+
1263-
if function_exported?(:proc_lib, :get_label, 1) do
1264-
label = apply(:proc_lib, :get_label, [self()])
1265-
assert label == {ExUnitTest, :"test sets process label for each test"}
1266-
end
1262+
label = :proc_lib.get_label(self())
1263+
assert label == {ExUnitTest, :"test sets process label for each test"}
12671264
end
12681265

12691266
defp configure_and_reload_on_exit(opts) do

0 commit comments

Comments
 (0)