Skip to content

Commit f659598

Browse files
committed
Remove compile-time warnings
1 parent 1f07dff commit f659598

File tree

3 files changed

+4
-18
lines changed

3 files changed

+4
-18
lines changed

lib/elixir/lib/exception.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1694,7 +1694,8 @@ defmodule UndefinedFunctionError do
16941694
16951695
For example:
16961696
1697-
iex> String.non_existing_fun("hello")
1697+
# Let's use apply/3 as otherwise Elixir emits a compile-time warning
1698+
iex> apply(String, :non_existing_fun, ["hello"])
16981699
** (UndefinedFunctionError) function String.non_existing_fun/1 is undefined or private
16991700
17001701
The following fields of this exception are public and can be accessed freely:

lib/elixir/test/elixir/exception_test.exs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,14 @@ defmodule ExceptionTest do
1414
doctest Exception
1515

1616
doctest RuntimeError
17-
doctest ArgumentError
18-
doctest ArithmeticError
1917
doctest SystemLimitError
2018
doctest MismatchedDelimiterError
2119
doctest SyntaxError
2220
doctest TokenMissingError
23-
doctest BadFunctionError
24-
doctest BadMapError
2521
doctest BadBooleanError
26-
doctest MatchError
27-
doctest CaseClauseError
28-
doctest WithClauseError
29-
doctest CondClauseError
30-
doctest TryClauseError
3122
doctest UndefinedFunctionError
3223
doctest FunctionClauseError
3324
doctest Protocol.UndefinedError
34-
doctest KeyError
3525
doctest UnicodeConversionError
3626
doctest Enum.OutOfBoundsError
3727
doctest Enum.EmptyError

lib/elixir/test/elixir/kernel/raise_test.exs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -409,12 +409,9 @@ defmodule Kernel.RaiseTest do
409409
end
410410

411411
test "badfun error" do
412-
# Avoid "invalid function call" warning
413-
x = fn -> :example end
414-
415412
result =
416413
try do
417-
x.().(2)
414+
Process.get(:unused, :example).(2)
418415
rescue
419416
x in [BadFunctionError] -> Exception.message(x)
420417
end
@@ -537,12 +534,10 @@ defmodule Kernel.RaiseTest do
537534
end
538535

539536
test "try clause error" do
540-
f = fn -> :example end
541-
542537
result =
543538
try do
544539
try do
545-
f.()
540+
Process.get(:unused, :example)
546541
rescue
547542
_exception ->
548543
:ok

0 commit comments

Comments
 (0)