Skip to content

fix(melange): avoid line directive when passing -loc-filename#14715

Merged
anmonteiro merged 1 commit into
ocaml:mainfrom
anmonteiro:anmonteiro/melange-fix-double-source-mapping
May 25, 2026
Merged

fix(melange): avoid line directive when passing -loc-filename#14715
anmonteiro merged 1 commit into
ocaml:mainfrom
anmonteiro:anmonteiro/melange-fix-double-source-mapping

Conversation

@anmonteiro

Copy link
Copy Markdown
Collaborator

No description provided.

@anmonteiro anmonteiro added melange Melange rules and generator single-context-universal labels May 25, 2026
Signed-off-by: Antonio Nuno Monteiro <anmonteiro@gmail.com>
@anmonteiro anmonteiro force-pushed the anmonteiro/melange-fix-double-source-mapping branch from 1092226 to 289d41d Compare May 25, 2026 06:00
@anmonteiro anmonteiro merged commit a11a13f into ocaml:main May 25, 2026
30 of 31 checks passed
@anmonteiro anmonteiro deleted the anmonteiro/melange-fix-double-source-mapping branch May 25, 2026 06:19
shonfeder pushed a commit that referenced this pull request Jun 11, 2026
Signed-off-by: Antonio Nuno Monteiro <anmonteiro@gmail.com>
shonfeder added a commit that referenced this pull request Jun 11, 2026
Backport #14715 onto 3.24.0-rc.

Fixes the melange build failure on OCaml 4.14 where dune emits an `I/O
error: jscomp/runtime/.melange_src/X.mli: No such file or directory`
against every `melange-re/melange.*-414` reverse dep (see
ocaml/opam-repository#29996 — the 3.24.0~alpha2 release PR). The fix is
to skip the line directive in `setup_melange_sources_copy_rules` when a
module uses non-staged PPX, since the PPX pipeline now passes
`-loc-filename` separately and adding the directive would double-shift
diagnostics.

The fix has a small precursor chain on `main`; bringing the headline
`#14715` alone doesn't apply cleanly because subsequent PRs introduced
the test files and machinery the fix's diff targets. Included PRs
(chronological):

- #14697 — test: show single context melange loses ppx snippet previews
- #14698 — test: show single context reason+melange loses ppx snippet
previews
- #14708 — test: accept ppx loc-filename in fixtures
- #14706 — **fix**: preserve original ppx source locations (introduces
`-loc-filename`)
- #14714 — test: reproduce reason source location regression
- #14715 — **fix**: avoid line directive when passing `-loc-filename`
@Alizter Alizter added this to the 3.25.0 milestone Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

melange Melange rules and generator single-context-universal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants