Skip to content

FCS: add FSharpCheckFileResults.FileSignature - #20478

Open
auduchinok wants to merge 1 commit into
dotnet:mainfrom
auduchinok:fcs-fileSig
Open

FCS: add FSharpCheckFileResults.FileSignature#20478
auduchinok wants to merge 1 commit into
dotnet:mainfrom
auduchinok:fcs-fileSig

Conversation

@auduchinok

Copy link
Copy Markdown
Member

Fixes #3259. Adds access to the file own signature, including memers hidden fsi file.

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

❗ Release notes required

You can open this PR in browser to add release notes: open in github.dev


✅ Found changes and release notes in following paths:

Warning

No PR link found in some release notes, please consider adding it.

Change path Release notes path Description
`src/Compiler` docs/release-notes/.FSharp.Compiler.Service/11.0.100.md No current pull request URL (#20478) found, please consider adding it

@github-actions github-actions Bot added the AI-Tooling-Check-Scanned-Clean Tooling check: diff analyzed, no interesting infrastructure files label Sep 7, 2026
tcDiagnostics,
keepAssemblyContents,
Option.get latestCcuSigForFile,
Option.get latestOwnSigForFile,

@T-Gro T-Gro Sep 9, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 🕵️ 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)

@T-Gro T-Gro Sep 9, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 🕵️ 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.

@T-Gro T-Gro added the AI-reviewed PR reviewed by AI review council label Sep 9, 2026
@T-Gro
T-Gro self-requested a review September 9, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-reviewed PR reviewed by AI review council AI-Tooling-Check-Scanned-Clean Tooling check: diff analyzed, no interesting infrastructure files

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

Some info is missing in PartialAssemblySignature when signature file exists

2 participants