Skip to content

Commit 825bfa3

Browse files
fable-repo-assist[bot]Copilot
authored andcommitted
fix: forward --pathmap: option to FCS so CallerFilePath respects <PathMap>
When MSBuild generates compiler options for an fsproj that uses <PathMap>, <DeterministicSourcePaths>, or <SourceRoot>, it emits a --pathmap:... flag. Previously, extractUsefulOptionsAndSources discarded this flag, so FCS always used an empty PathMap and CallerFilePath always returned absolute paths regardless of the user's configuration. Forward --pathmap: from the main project only (mirroring how --langversion: is handled) so that [<CallerFilePath>] respects the configured path mappings at compile time. Closes #4061 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 345bcd4 commit 825bfa3

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/Fable.Compiler/ProjectCracker.fs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,9 @@ let private extractUsefulOptionsAndSources
438438
// Only forward the nullness flag if it is coming from the main project
439439
elif line.StartsWith("--checknulls+", StringComparison.Ordinal) && isMainProj then
440440
accSources, line :: accOptions
441+
// Forward pathmap from the main project so CallerFilePath respects <PathMap>/<DeterministicSourcePaths>
442+
elif line.StartsWith("--pathmap:", StringComparison.Ordinal) && isMainProj then
443+
accSources, line :: accOptions
441444
elif
442445
line.StartsWith("--nowarn", StringComparison.Ordinal)
443446
|| line.StartsWith("--warnon", StringComparison.Ordinal)

0 commit comments

Comments
 (0)