Skip to content

[Repo Assist] ApiDocs: more tolerant cross-references for unqualified cref attributes#1042

Merged
dsyme merged 2 commits intomainfrom
repo-assist/fix-issue-605-tolerant-crefs-e71f9bb8de54b98f
Feb 27, 2026
Merged

[Repo Assist] ApiDocs: more tolerant cross-references for unqualified cref attributes#1042
dsyme merged 2 commits intomainfrom
repo-assist/fix-issue-605-tolerant-crefs-e71f9bb8de54b98f

Conversation

@github-actions
Copy link
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant. It implements the changes requested via /repo-assist implement this please on #605.

Summary

Implements more tolerant resolution of (see cref="...") attributes in API doc comments, addressing the scenarios described in #605.

Problem

The F# compiler often can't resolve cross-references to types/members in XML doc comments without the full namespace, so it emits unqualified crefs like:

  • (see cref="MyType" /) (no T: prefix)
  • (see cref="MyType.MyMember" /) (no prefix, member reference)
  • (see cref="GenericClass21.Property" /)` (no namespace)

Previously, these all fell through to an "Unresolved reference" warning with no link generated (or an incorrect external .NET link).

Root Cause

Two issues in CrossReferenceResolver.fs:

  1. SymbolReader.fs line 652: Crefs without : are prepended with "T:", so "Class2.Other" becomes "T:Class2.Other". The type lookup then fails since no type is named "Class2.Other", and the external fallback produces a bogus .NET docs link.

  2. resolveCrossReferenceForTypeByXmlSig: When both xmlDocNameToSymbol and niceNameEntityLookup lookups fail for a T: sig, it immediately falls through to an external link without attempting to split a Type.Member pattern.

Fix

  • stripGenericSuffix: New helper that strips <...> and `N suffixes from type names.
  • resolveCrossReferenceForTypeByXmlSig: When the lookup fails for a T:Type.Member sig, try splitting on the last . and looking up the type part in niceNameEntityLookup (trying both raw name like "GenericClass21"and stripped name like"GenericClass2"`).
  • tryResolveUnqualifiedCref: New function for crefs with no XML prefix (reached via ResolveCref's catch-all case). Handles both plain type names and Type.Member patterns.
  • tryResolveCrossReferenceForMemberByXmlSig: When the fully-qualified type lookup fails, also try niceNameEntityLookup with the simple (last-segment) type name using raw and stripped forms.

Test Cases Added

New test types in crefLib2/Library2.fs:

  • Class9: (see cref="Class2" /) — unqualified type reference
  • Class10: (see cref="Class2.Other" /) and (see cref="Class2.Method0" /) — unqualified Type.Member
  • Class11: (see cref="GenericClass21" /)and(see cref="GenericClass21.Property" /) — generic type/member

Also uncommented the previously-disabled URL check for creflib2-class1 (Class1 uses (see cref="Class2" /)).

Test Status

All 337 tests pass (Passed: 72, Skipped: 4 for ApiDocs; full suite Passed: 337, Skipped: 6).

Passed!  - Failed: 0, Passed: 72, Skipped: 4, Total: 76

Closes #605

Generated by Repo Assist for issue #605

To install this agentic workflow, run

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

…tributes

Resolves unqualified cref patterns that the F# compiler emits without the
standard XML doc prefix (T:/M:/P:), and also partial type-qualified members
that the compiler emits with a prefix but without a namespace.

Changes to CrossReferenceResolver.fs:
- Add stripGenericSuffix helper that strips backtick/angle-bracket suffixes
- In resolveCrossReferenceForTypeByXmlSig: when both xmlDocNameToSymbol and
  niceNameEntityLookup lookups fail for a T: sig, check if typeName contains
  a dot (Type.Member pattern) and try niceNameEntityLookup with raw/stripped name
- Add tryResolveUnqualifiedCref for crefs with no XML prefix (plain type names
  and Type.Member patterns via niceNameEntityLookup)
- In tryResolveCrossReferenceForMemberByXmlSig: fall back to niceNameEntityLookup
  using both raw and stripped simple type name when full XML sig lookup fails

Test additions:
- Class9: unqualified type cref '<see cref="Class2" />'
- Class10: unqualified Type.Member crefs '<see cref="Class2.Other" />'
- Class11: generic type/member crefs '<see cref="GenericClass2`1.Property" />'
- Uncomment previously-commented URL resolution test for Class1

Closes #605

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dsyme dsyme marked this pull request as ready for review February 26, 2026 19:04
@dsyme dsyme merged commit 6812814 into main Feb 27, 2026
4 checks passed
@dsyme dsyme deleted the repo-assist/fix-issue-605-tolerant-crefs-e71f9bb8de54b98f branch February 27, 2026 11:47
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.

ApiDocs: more tolerant cross-references

2 participants