Repository navigation
Conversation
The compiler wrote unmapped source paths into the assembly in three places. Thus a deterministic build with a path map gave a different assembly in each directory. - The DebugRange of quotations and reflected definitions (dotnet#21020). - The file name of MatchFailureException for an incomplete match (dotnet#21021). - __SOURCE_DIRECTORY__ after a #line directive. Hash directive arguments continue to use the unmapped path, because the compiler uses them to find files on disk.
This branch has not been deployed
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.
Fixes #21020
Fixes #21021
Description
The compiler wrote unmapped source paths into the assembly in three places. Thus a
--deterministic+build with--pathmapgave a different assembly in each directory that it was compiled from.DebugRangeof quotations and[<ReflectedDefinition>]members (Determinism: --pathmap is not applied to the source file in a quotation's DebugRange #21020).MatchFailureExceptionfor an incomplete match (Determinism: --pathmap is not applied to the file name in MatchFailureException #21021).__SOURCE_DIRECTORY__after a#linedirective. This case is not in the issues.applyLineDirectivesToSourceIdentifiercalculated the value again withPathMap.empty.The fix uses
PathMap.applyonly, withoutGetFullPathShim. Thus the output does not change when no path map is set.Hash directive arguments (for example
#r __SOURCE_DIRECTORY__ + "/x.dll") continue to use the unmapped path, because the compiler uses them to find files on disk.Tests
A new theory in
CompilerOptions/fsc/determinism/determinism.fshas one case for each location. Each case compiles the same source in two directories with--pathmap. Then it makes sure that:All four cases fail without the compiler change and pass with it.
Checklist
🤖 Generated with Claude Code