Repository navigation
Store ~p warning file relative to cwd - #6889
Merged
SteffenDE merged 2 commits intoNov 2, 2026
Merged
Conversation
~p warnings are emitted from @after_verify using the file stored at compile time. With an absolute path, a copy of the project reusing the build (git worktree, copy-on-write clone, compiled with check_cwd: false) reported warnings in the original checkout's files.
SteffenDE
added a commit
to SteffenDE/elixir
that referenced
this pull request
Nov 2, 2026
Warnings emitted from @after_verify callbacks run in the parallel checker, where :elixir_compiler_file is not set. Their source field is therefore whatever :file the callback passed to IO.warn/2. The checker already made :file absolute when collecting the diagnostic but left :source untouched. Mix attaches warnings to their source files by matching :source against absolute paths. A relative :source matched nothing, so such a warning was printed once and never persisted in the manifest: later compilations did not print it again with --all-warnings, and a no-op compilation passed --warnings-as-errors despite it. Phoenix wants to store these paths relative to the project so that a build reused from another directory, such as a git worktree, reports the right files (phoenixframework/phoenix#6889).
Mix persists compiler warnings by their absolute source path. Elixir makes the file of a warning emitted from @after_verify absolute again when collecting it, but not its source. A warning with a relative file was therefore printed once and never stored in the manifest: later compilations did not print it again with --all-warnings, and a no-op compilation passed --warnings-as-errors. Keep storing the file relative to the project, so that copies of the project reusing the build report their own files, and expand it against the current directory when the warning is emitted.
Member
|
Thank you! 🙌🏻 |
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.
~proute warnings (no route path for ... matches ...) are emitted from@after_verify, using thewarn_locationfile captured at compile time. When a copy of the project reuses_build(git worktree or copy-on-write clone, compiled withcheck_cwd: false), they point at the original checkout's absolute paths, so editors and coding agents edit the wrong files.Fix: store
Path.relative_to_cwd(file)inwarn_location. Elixir resolves relative diagnostic paths against the current directory when it prints them.Tests: full suite passes (1113).
This is one of the remaining relocation issues from #6855. Others: phoenixframework/phoenix_template#17 (
__mix_recompile__?root) and phoenixframework/phoenix_live_view#4489 (component call file).