Skip to content

Fix colorization of type name in MyType<Qualified.Name>.StaticMember#19800

Open
T-Gro wants to merge 2 commits into
mainfrom
fix/issue-18009
Open

Fix colorization of type name in MyType<Qualified.Name>.StaticMember#19800
T-Gro wants to merge 2 commits into
mainfrom
fix/issue-18009

Conversation

@T-Gro
Copy link
Copy Markdown
Member

@T-Gro T-Gro commented May 25, 2026

Fixes #18009

Fixes syntax colorization when a qualified type name with generic parameters is used in a static member access expression.

T-Gro and others added 2 commits May 25, 2026 08:04
Accept ItemOccurrence.InvalidUse in LegitTypeOccurrence so that the
type-name span in expressions like MyType<System.Int32>.S - which name
resolution flags as InvalidUse via isWrongItemInExpr - is still classified
as a ReferenceType, matching the behavior for the unqualified form
MyType<int>.S.

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

❗ Release notes required

@T-Gro,

Caution

No release notes found for the changed paths (see table below).

Please make sure to add an entry with an informative description of the change as well as link to this pull request, issue and language suggestion if applicable. Release notes for this repository are based on Keep A Changelog format.

The following format is recommended for this repository:

* <Informative description>. ([PR #XXXXX](https://github.com/dotnet/fsharp/pull/XXXXX))

See examples in the files, listed in the table below or in th full documentation at https://fsharp.github.io/fsharp-compiler-docs/release-notes/About.html.

If you believe that release notes are not necessary for this PR, please add NO_RELEASE_NOTES label to the pull request.

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

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/11.0.100.md No release notes found or release notes format is not correct

@github-actions github-actions Bot added the AI-Tooling-Check-Bypassed Tooling check: non-fork PR, not diff-analyzed label May 25, 2026
Copy link
Copy Markdown
Member Author

@T-Gro T-Gro left a comment

Choose a reason for hiding this comment

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

Review

The core fix is correct and well-reasoned. Adding ItemOccurrence.InvalidUse to LegitTypeOccurrence is the right approach — InvalidUse is only ever emitted for Item.Types items resolved in expression position (via isWrongItemInExpr in NameResolution.fs:4233-4236), so it's always semantically a type that deserves colorization.

The tests are well-structured, covering both the positive case (generic type with qualified type arg gets colored) and the safety invariant (undeclared identifiers don't get false type classification).

Issue to fix before merge

Remove .executor-pid — this file was accidentally committed in 2e24ca91. It's a dev artifact and should not be in the repository.

# .gitignore or remove the file:
git rm .executor-pid
git commit --amend  # or a new commit

Minor observation

The FSharpCheckerResults.fs line:

| CNR(_, ItemOccurrence.InvalidUse, _, _, _, _) :: _, _ -> NameResResult.Empty

...already correctly blocks autocomplete for InvalidUse items, so this change doesn't affect completions — only semantic classification. Good separation of concerns.

@T-Gro T-Gro added the AI-reviewed PR reviewed by AI review council label May 25, 2026
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-Bypassed Tooling check: non-fork PR, not diff-analyzed

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

Colorization bug with static methods used on types with qualified generic arguments

1 participant