Build a project's TcGlobals with its own path map when the framework imports are cached - #20476
Open
xperiandri wants to merge 3 commits into
Open
Build a project's TcGlobals with its own path map when the framework imports are cached#20476xperiandri wants to merge 3 commits into
xperiandri wants to merge 3 commits into
Conversation
Contributor
❗ Release notes requiredYou can open this PR in browser to add release notes: open in github.dev
|
xperiandri
added a commit
to xperiandri/fsharp
that referenced
this pull request
Sep 7, 2026
…imports are cached FrameworkImportsCache keys the framework imports, and the TcGlobals built with them, by the framework set alone. A project reusing the entry got a fresh TcGlobals only when langVersion or realsig differed, and even then took pathMap from the cached instance. Since TypedTreePickle applies that map to every range it writes, the in-memory reference data of each project carried the --pathmap of whichever project filled the cache first, and a project without a map handed its consumers file names nothing on disk matches. pathMap now takes part in the decision like langVersion and realsig, and the new TcGlobals takes it from the project's own TcConfig, in the incremental builder and the transparent compiler alike. Fixes dotnet#20474 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ing project Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
xperiandri
force-pushed
the
fix/framework-cache-pathmap
branch
from
September 7, 2026 12:52
54a06cf to
0c4b74a
Compare
T-Gro
approved these changes
Sep 7, 2026
T-Gro
left a comment
Member
There was a problem hiding this comment.
🤖🕵️ Approved; CI is still running.
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.
Description
FrameworkImportsCachecaches the frameworkTcImportstogether with theTcGlobalsbuilt for the first project of a framework set. Its key — framework assemblies, primary assembly, target framework directories, compiler binaries directory, import-reuse key — does not include the path map, and a project reusing the entry got a newTcGlobalsonly whenlangVersionorrealsigdiffered, copyingpathMapfrom the cached instance even then.TypedTreePickle.p_rangeappliestcGlobals.pathMapto every range it writes andEncodeSignatureDataapplies it tocompileTimeWorkingDir, so the in-memory reference data every project exposes to its consumers was mapped with the--pathmapof whichever project filled the cache first: a project without a map lent mapped, relative file names to its consumers, and a project with a map lost it when a sibling came first.Seen in Visual Studio on a solution with
<PathMap>$(MSBuildThisFileDirectory)=.\</PathMap>inDirectory.Build.props: symbols imported from a sibling project carried.\backend\Use cases\Circulars\GraphQL\.\backend\Use cases\Circulars\GraphQL\Types\Circular.fs, and Go To Definition opened the generated signature. #20470 keeps the IDE from passing--pathmapat all; this change makes the cache correct for any host that checks mapped and unmapped projects with oneFSharpChecker.Fix:
pathMaptakes part in the decision likelangVersionandrealsig, and the newTcGlobalstakes it from the project's ownTcConfig— inIncrementalBuild.fsand inTransparentCompiler.fs. The cached framework imports themselves do not depend on the map, so the key is unchanged.Tests:
FSharpChecker/PathMap.fschecks, with one checker for both compilers, a project carrying--pathmap:<root>=.\first and then an application referencing a library without a map; the library function seen from the application must keep the library's absolute file name. Fails without the fix.Fixes #20474
Checklist
Test cases added
Performance benchmarks added in case of performance changes
Release notes entry updated:
🤖 Generated with Claude Code