Repository navigation
Handle non-Diagnostic entries from Mix compilers - #1281
Merged
Merged
Conversation
Third-party Mix compilers may return plain strings or other terms in the diagnostics list instead of Mix.Task.Compiler.Diagnostic structs. This crashed the build with a FunctionClauseError in from_mix_task_compiler_diagnostic/3. Binaries are now reported as error diagnostics attached to mix.exs; other terms are inspected and reported the same way.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Third-party Mix compilers can return plain strings (or other terms) in the diagnostics list instead of
Mix.Task.Compiler.Diagnosticstructs. Mix does not enforce the struct contract, soBuild.run_mix_compile/1passed these straight intoDiagnostics.from_mix_task_compiler_diagnostic/3, which only matched the struct. The build process crashed and the user got a generic build error instead of the compiler's message.Crash report (Elixir 1.20.0):
Fix
mix.exs(position 0,compiler_name: "Mix"), matching how mixfile-level errors are attached.inspect/1and reported the same way.Tests
Added two cases to
apps/language_server/test/diagnostics_test.exs.mix test test/diagnostics_test.exs: 20 passed.