Skip to content

Escape temp file cpp markers in a consistent way on windows - #5148

Merged
fendor merged 1 commit into
haskell:masterfrom
simonhorlick:fix-cpp-path-escaping
Oct 21, 2026
Merged

fendor merged 1 commit into
haskell:masterfrom
simonhorlick:fix-cpp-path-escaping

Conversation

@simonhorlick

Copy link
Copy Markdown
Collaborator

For cpp modules open in an editor we rewrite the cpp file markers with the actual file path before parsing. The previous implementation used forward slashes to delimit path segments, which differs from how the non-open cpp module outputs paths. This causes an inconsistency in the SrcSpan where some spans contain forward slash delimited paths and others with backslash delimited paths.

Running the path through the existing escape function produces the correct output.

Note that this PR is essentially the same thing as #5010 but doesn't attempt to escape unicode characters. Also see the discussion in #4889.

This is also needed for #5147 which hits the same issue because of span equality failing only on windows.

Tested on a windows 10 machine.



@simonhorlick
simonhorlick requested a review from wz1000 as a code owner October 17, 2026 23:24

@fendor fendor left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good catch!

For cpp modules open in an editor we rewrite the cpp file markers with the
actual file path before parsing. The previous implementation used forward
slashes to delimit path segments, which differs from how the non-open cpp
module outputs paths. This causes an inconsistency in the SrcSpan where some
spans contain forward slash delimited paths and others with backslash delimited
paths.

Running the path through the existing escape function produces the correct
output.
@simonhorlick
simonhorlick force-pushed the fix-cpp-path-escaping branch from 5d6b087 to ca9a3d6 Compare October 21, 2026 14:28
@fendor
fendor enabled auto-merge (squash) October 21, 2026 16:47
@fendor
fendor merged commit b9247ef into haskell:master Oct 21, 2026
62 of 76 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants