Skip to content

Commit f33f180

Browse files
authored
Fix translating erl compiler errors to diagnostics on OTP 24 (#10719)
The compiler previously emitted just `line` and now emits `{line, column}`. The diagnostic struct accepts as position either: nil line {start_line, start_col, end_line, end_col} so we could have used the `column` to create the 4-tuple but we don't have enough information to do that correctly, we don't know where the line ends.
1 parent fc5b37f commit f33f180

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/mix/lib/mix/compilers/erlang.ex

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,18 @@ defmodule Mix.Compilers.Erlang do
271271
defp to_diagnostics(warnings_or_errors, severity) do
272272
for {file, issues} <- warnings_or_errors,
273273
{line, module, data} <- issues do
274-
position = if is_integer(line) and line >= 1, do: line
274+
position =
275+
case line do
276+
# TODO: remove when we require OTP 24
277+
line when is_integer(line) and line >= 1 ->
278+
line
279+
280+
{line, _column} when is_integer(line) and line >= 1 ->
281+
line
282+
283+
_ ->
284+
nil
285+
end
275286

276287
%Mix.Task.Compiler.Diagnostic{
277288
file: Path.absname(file),

0 commit comments

Comments
 (0)