Skip to content

[Repo Assist] Add regression tests for cross-assembly tooltip resolution (issue #1085)#1090

Merged
dsyme merged 5 commits intomainfrom
repo-assist/fix-issue-1085-cross-assembly-tooltip-tests-3f27d1532f990004
Mar 13, 2026
Merged

[Repo Assist] Add regression tests for cross-assembly tooltip resolution (issue #1085)#1090
dsyme merged 5 commits intomainfrom
repo-assist/fix-issue-1085-cross-assembly-tooltip-tests-3f27d1532f990004

Conversation

@github-actions
Copy link
Contributor

🤖 This is an automated PR from Repo Assist.

Investigation of issue #1085

This PR adds an end-to-end test infrastructure to investigate and guard against the bug reported in #1085, where hover tooltips in literate F# scripts show obj instead of the actual type name for types from external assemblies.

What I did

I created two small helper assemblies that exactly mirror the type-dependency structure from the issue:

  • CrossAssemblyA — defines type Did = private | Did of string (a single-case private DU, exactly as in the issue)
  • CrossAssemblyB — references CrossAssemblyA and defines:
    • Subject (DU with Account of Did)
    • TeamMember (record with Did: Did, Name: string, Active: bool, JoinedAt: DateTimeOffset option)

Then I added three regression tests that verify tooltip rendering:

  1. DU field type with absolute #r pathsSubject.Account of Did tooltip must contain Did, not obj
  2. Record field types with absolute #r pathsTeamMember tooltip must contain Did and DateTimeOffset
  3. Relative #r paths — same verification where the script file lives in the same directory as the referenced DLLs (the user's actual scenario)

Key finding

All three tests pass against FCS 43.10.100 (the version used in this repo). The cross-assembly tooltip resolution works correctly when #r paths resolve properly (either absolute or relative with the script in the right directory).

This strongly suggests the bug in #1085 is:

  1. Path-resolution related#r "AssemblyA.dll" without a resolvable path (FCS can't find the file) causes FCS to type-check with incomplete symbol information, leading to obj in tooltips for types it couldn't fully resolve.
  2. Possibly FCS-version specific — the user reports fsdocs-tool 21.0.0 which uses an older FCS; the bug may have been fixed upstream.

The tests now serve as regression guards: if a future FCS update or FSharp.Formatting change breaks cross-assembly tooltip resolution, these tests will fail.

Test Status

  • ✅ Build: passes (dotnet build tests/FSharp.CodeFormat.Tests/...)
  • ✅ Tests: 30 passed, 2 skipped (pre-existing skips), 0 failed (dotnet test tests/FSharp.CodeFormat.Tests/...)
  • ✅ Formatted: dotnet fantomas applied to all new/modified source files

Files changed

File Change
tests/FSharp.CodeFormat.Tests/files/CrossAssemblyA/CrossAssemblyA.fsproj New helper library A
tests/FSharp.CodeFormat.Tests/files/CrossAssemblyA/Library.fs New — Did type
tests/FSharp.CodeFormat.Tests/files/CrossAssemblyB/CrossAssemblyB.fsproj New helper library B
tests/FSharp.CodeFormat.Tests/files/CrossAssemblyB/Library.fs New — Subject and TeamMember types
tests/FSharp.CodeFormat.Tests/FSharp.CodeFormat.Tests.fsproj Add ProjectReference to the two helpers
tests/FSharp.CodeFormat.Tests/CodeFormatTests.fs Add 3 new regression tests + helpers
RELEASE_NOTES.md Note the new tests under [Unreleased]

Closes #1085 (investigation; the bug doesn't reproduce in current FCS — tests guard against recurrence).

Generated by Repo Assist for issue #1085 ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@346204513ecfa08b81566450d7d599556807389f

Adds two small helper assemblies (CrossAssemblyA, CrossAssemblyB) that
reproduce the type-dependency structure from issue 1085:
- CrossAssemblyA: single-case private DU Did
- CrossAssemblyB: Subject DU and TeamMember record whose fields reference Did

Three new tests in CodeFormatTests.fs:
1. DU case field shows the actual type name (Did) not obj with absolute hash-r paths
2. Record fields from another assembly show correct names with absolute hash-r paths
3. Same verification works with relative hash-r paths when the script is in the
   same directory as the referenced assemblies

All three tests pass against FCS 43.10.100, confirming the current code-path
handles cross-assembly tooltip resolution correctly. The tests serve as
regression guards to detect regressions if future FCS or FSharp.Formatting
changes re-introduce the issue.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…strings

On Windows, absolute paths like D:\a\FSharp.Formatting\... contain sequences
such as \F and \a that are invalid or misinterpreted F# string escape sequences
when the path is embedded directly in an F# source string literal passed to
CodeFormatter.ParseAndCheckSource.

Fix: use .Replace('\\', '/') to convert to forward slashes before embedding.
.NET and FCS accept forward slashes in file paths on all platforms.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor Author

Commit pushed: 5bb0c1e

Generated by Repo Assist

@dsyme dsyme marked this pull request as ready for review March 13, 2026 23:45
@dsyme dsyme merged commit ca49b9e into main Mar 13, 2026
2 checks passed
@dsyme dsyme deleted the repo-assist/fix-issue-1085-cross-assembly-tooltip-tests-3f27d1532f990004 branch March 13, 2026 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hover tooltips in literate scripts show obj for types from external assemblies

1 participant