-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Description
Elixir and Erlang/OTP versions
Erlang/OTP 26 [erts-14.1.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]
Elixir 1.16.0-rc.1 (81a12b7) (compiled with Erlang/OTP 26)
Operating system
macOS
Current behavior
Repro:
- Create an empty mix project
- Add
IO.warn("foo")inmix.exs - in iex
Mix.start()
Code.with_diagnostics(fn -> Code.compile_file("mix.exs") end)
%{
message: "foo",
position: 0,
file: nil,
stacktrace: [
{:elixir_compiler_0, :__FILE__, 1, [file: ~c"mix.exs", line: 57]},
{:elixir_compiler, :dispatch, 4,
[file: ~c"src/elixir_compiler.erl", line: 67]},
{:elixir_compiler, :compile, 4,
[file: ~c"src/elixir_compiler.erl", line: 52]},
{:elixir_compiler, :maybe_fast_compile, 3,
[file: ~c"src/elixir_compiler.erl", line: 39]},
{:elixir_lexical, :run, 3, [file: ~c"src/elixir_lexical.erl", line: 15]},
{:elixir_compiler, :quoted, 3,
[file: ~c"src/elixir_compiler.erl", line: 17]}
],
span: nil,
severity: :warning
}
Mix.start()
Kernel.ParallelCompiler.compile(["mix.exs"], return_diagnostics: true)
compile_warnings: [
%{
message: "foo",
position: 0,
file: nil,
stacktrace: [
{:elixir_compiler_1, :__MODULE__, 1, [file: ~c"mix.exs", line: 57]},
{:elixir_compiler, :dispatch, 4,
[file: ~c"src/elixir_compiler.erl", line: 67]},
{:elixir_compiler, :compile, 4,
[file: ~c"src/elixir_compiler.erl", line: 52]},
{:elixir_module, :eval_form, 7,
[file: ~c"src/elixir_module.erl", line: 426]},
{:elixir_module, :compile, 7,
[file: ~c"src/elixir_module.erl", line: 128]},
{:elixir_compiler_0, :__FILE__, 1, [file: ~c"mix.exs", line: 1]}
],
span: nil,
severity: :warning
}
]
Similarly, if I put IO.warn in lib/sample.ex and do
Mix.start()
Code.compile_file("mix.exs")
Mix.Task.run("compile", ["--return-errors", "--force"])
the warning will be printed with file and position
warning: foo
lib/sample.ex:2: (file)
(elixir 1.16.0-rc.1) src/elixir_compiler.erl:67: :elixir_compiler.dispatch/4
(elixir 1.16.0-rc.1) src/elixir_compiler.erl:52: :elixir_compiler.compile/4
(elixir 1.16.0-rc.1) src/elixir_compiler.erl:39: :elixir_compiler.maybe_fast_compile/3
(elixir 1.16.0-rc.1) src/elixir_lexical.erl:15: :elixir_lexical.run/3
(elixir 1.16.0-rc.1) src/elixir_compiler.erl:17: :elixir_compiler.quoted/3
but returned diagnostic is not filled
%Mix.Task.Compiler.Diagnostic{
file: nil,
severity: :warning,
message: "foo",
position: 0,
compiler_name: "Elixir",
span: nil,
details: nil,
stacktrace: [
{:elixir_compiler_0, :__FILE__, 1, [file: ~c"lib/sample.ex", line: 2]},
{:elixir_compiler, :dispatch, 4,
[file: ~c"src/elixir_compiler.erl", line: 67]},
{:elixir_compiler, :compile, 4,
[file: ~c"src/elixir_compiler.erl", line: 52]},
{:elixir_compiler, :maybe_fast_compile, 3,
[file: ~c"src/elixir_compiler.erl", line: 39]},
{:elixir_lexical, :run, 3, [file: ~c"src/elixir_lexical.erl", line: 15]},
{:elixir_compiler, :quoted, 3,
[file: ~c"src/elixir_compiler.erl", line: 17]}
]
}
Expected behavior
position and file properties populated
Metadata
Metadata
Assignees
Labels
No labels