Skip to content

Commit e5d5b43

Browse files
committed
Handle warnings from unquote functions
1 parent 2b5c2a1 commit e5d5b43

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

Diff for: lib/elixir/lib/module/parallel_checker.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ defmodule Module.ParallelChecker do
334334

335335
defp position_to_tuple(position) do
336336
case position[:column] do
337-
nil -> position[:line]
337+
nil -> position[:line] || 0
338338
col -> {position[:line], col}
339339
end
340340
end

Diff for: lib/elixir/test/elixir/kernel/diagnostics_test.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ defmodule Kernel.DiagnosticsTest do
153153
"""
154154
end
155155

156-
test "trim inbetween lines if too many" do
156+
test "trim in between lines if too many" do
157157
output =
158158
capture_raise(
159159
"""

Diff for: lib/elixir/test/elixir/module/types/integration_test.exs

+23
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,29 @@ defmodule Module.Types.IntegrationTest do
695695

696696
assert_warnings(files, warnings)
697697
end
698+
699+
test "reports unquote functions" do
700+
files = %{
701+
"a.ex" => """
702+
defmodule A do
703+
@deprecated "oops"
704+
def a, do: :ok
705+
end
706+
""",
707+
"b.ex" => """
708+
defmodule B do
709+
def b, do: unquote(&A.a/0)
710+
end
711+
"""
712+
}
713+
714+
warnings = [
715+
"A.a/0 is deprecated. oops",
716+
"b.ex: B.b/0"
717+
]
718+
719+
assert_warnings(files, warnings)
720+
end
698721
end
699722

700723
defp assert_warnings(files, expected) when is_binary(expected) do

0 commit comments

Comments
 (0)