You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Transparent Compiler: completion misses symbols from previous files the checked file doesn't depend on #21000
With the Transparent Compiler, completion in a file doesn't offer symbols from previous files the file doesn't reference yet. The Background Compiler offers them, so this is a regression for anyone switching to the Transparent Compiler.
Repro
File 1:
moduleNs1.Ns2.Mleti=1
File 2, completion at the caret:
namespaceNs1.Ns2{caret}
Through FCS:
[<Theory>][<InlineData(false)>][<InlineData(true)>]let``Unreferenced symbol from a previous file`` useTransparentCompiler =letchecker= FSharpChecker.Create(useTransparentCompiler = useTransparentCompiler)letfile1="""module Ns1.Ns2.Mlet i = 1"""letfile2="""namespace Ns1.Ns2{caret}"""letcontext= Checker.getCompletionContext file2
letoptions= createProjectOptions [ file1; file2 ][]letparseResults,checkAnswer =
checker.ParseAndCheckFileInProject(options.SourceFiles[1],0, SourceText.ofString context.Source, options)|> Async.RunSynchronouslyImmediate
match checkAnswer with| FSharpCheckFileAnswer.Aborted -> failwith "Type checking was aborted"| FSharpCheckFileAnswer.Succeeded checkResults ->
checkResults.GetCodeCompletionSuggestions(context, parseResults, FSharpCodeCompletionOptions.Default)|> assertHasItemWithNames ["M"]
Expected
M is offered, as with useTransparentCompiler = false.
Actual
M is not offered.
Cause
The Transparent Compiler checks a file against only the files the dependency graph says it depends on. File 2 doesn't reference anything from file 1 yet, so it has no dependency on it. Its name resolution environment, which completion offers symbols from, then lacks M. The Background Compiler checks a file against every file before it.
Activity