FCS: add FSharpCheckFileResults.FileSignature - #20478
Conversation
❗ Release notes requiredYou can open this PR in browser to add release notes: open in github.dev
Warning No PR link found in some release notes, please consider adding it.
|
| tcDiagnostics, | ||
| keepAssemblyContents, | ||
| Option.get latestCcuSigForFile, | ||
| Option.get latestOwnSigForFile, |
There was a problem hiding this comment.
🤖 🕵️ Background FileSignature drops declarations hidden by .fsi with the legacy checker, even though its symbol uses contain those definitions. This needs the fully checked implementation signature rather than the skipped-file placeholder.
// Test.fsi
module Test
val visible: int
// Test.fs
module Test
let hidden = 41
let visible = hidden + 1
// FCS client, with project options for these files:
let checker =
FSharpChecker.Create(useTransparentCompiler = false,
keepAllBackgroundResolutions = true)
let _, result =
checker.GetBackgroundCheckResultsForFileInProject(testFs, options)
|> Async.RunSynchronously
let test = result.FileSignature.FindEntityByPath ["Test"] |> Option.get
test.MembersFunctionsAndValues |> Seq.map _.DisplayName |> Seq.toList
// ["visible"]; foreground and transparent checking return ["hidden"; "visible"].| FSharpAssemblySignature(g, thisCcu, ccuSigForFile, tcImports, None, ccuSigForFile) | ||
|
|
||
| member _.FileSignature = | ||
| FSharpAssemblySignature(g, thisCcu, ccuSigForFile, tcImports, None, ownSigForFile) |
There was a problem hiding this comment.
🤖 🕵️ Hidden nested types lose their declaring module: DeclaringEntity returns None in both checker modes although the parent is present in FileSignature. The symbol-resolution context needs the inferred contents too; the exported CCU signature cannot resolve that parent.
// Test.fsi
module Test
val visible: int
// Test.fs
module Test
let visible = 1
module Hidden =
type Secret<'T> = { Item: 'T }
// FCS client, after checking Test.fs:
let hidden =
result.FileSignature.FindEntityByPath ["Test"; "Hidden"]
|> Option.get
hidden.NestedEntities[0].DeclaringEntity
// None; without Test.fsi this is Some Test.Hidden.
Fixes #3259. Adds access to the file own signature, including memers hidden fsi file.