Repository navigation
Transparent Compiler/Completion: suggest symbols from files the checked file doesn't depend on - #20999
Draft
DedSec256 wants to merge 1 commit into
Draft
Transparent Compiler/Completion: suggest symbols from files the checked file doesn't depend on#20999DedSec256 wants to merge 1 commit into
DedSec256 wants to merge 1 commit into
Conversation
Contributor
✅ Release notes checked
|
DedSec256
force-pushed
the
ber.a/fixCompletionTransparentCompiler
branch
from
November 19, 2026 01:26
b8943a4 to
0049c28
Compare
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 #21000
Problem
Completion on the Transparent Compiler's check results doesn't offer symbols from previous files the checked file doesn't depend on. The Background Compiler offers them.
It's made more confusing by the fact that every file before the checked one is already type checked (#20850). Even so, what gets into the file's
NameResolutionEnvstill follows the dependency graph: the file is checked against the state of its dependencies only.Relation to #20889
#20889 by @nojaf adds the
checkDependenciesOnlyflag toParseAndCheckFileInProjectand fixes the cost of analysis: withcheckDependenciesOnly = true, only the dependencies are checked. WithcheckDependenciesOnly = false, abovementioned PR checks every file before the checked one, but the state the file is checked against is still built from its dependencies only.This PR fixes the other side: it makes the file's node depend on all the previous nodes, so the symbols of files the checked file doesn't depend on get into its name resolution environment. Combined with #20889,
checkDependenciesOnly = falsecan then be used to get full results before completion.This PR doesn't add the flag, so for now every check of a file is a full one. Once it's combined with #20889, the graph isn't extended for
checkDependenciesOnly = true. That place is marked with aTODO.Changes
TcIntermediatekey tells the full result of a file from the dependencies-only one. A new version weakens the other versions of the same file only.Open questions
Caching of
ParseAndCheckFileInProjectresultsWhen the flag is combined with this PR, it has to go into the version of the
ParseAndCheckFileInProjectkey too, or full and dependencies-only results would be mixed under one version. Then, because of how the LRU cache works, a following request for the same file withcheckDependenciesOnly = true, with no real changes, stores its result under another version of the same key and weakens the full one.Two strategies:
TcIntermediatealready does this.Tests
Unreferenced symbol from a previous fileinCompletionTests.Namespaces.fs: completion offers a module from a previous file the checked file doesn't reference, with both compilers.