Skip to content

Record the parameter and type parameter counts of a navigable item - #20531

Open
xperiandri wants to merge 2 commits into
dotnet:mainfrom
xperiandri:navigable-item-parameter-counts
Open

xperiandri wants to merge 2 commits into
dotnet:mainfrom
xperiandri:navigable-item-parameter-counts

Conversation

@xperiandri

Copy link
Copy Markdown
Contributor

Description

Navigate To orders matches of the same kind by a secondary sort. For C# and VB that key holds each declaration's parameter and type parameter counts, taken from Roslyn's declaration index, after the folder distance to the file being edited. dotnet/roslyn#85280 computes the same key for F# results, and needs F# to supply the two counts.

NavigateTo.GetNavigableItems is where F# builds its declaration list from the parse tree, so NavigableItem now carries:

  • ParameterCount: every curried and tupled argument of the method the declaration compiles to. An instance member's self argument is not counted, and neither is a solitary unit argument: let f () = … and val f: unit -> int count 0, let f () x = … counts 2. Bindings take it from the arity the parser inferred. For signatures, the parser leaves a solitary unit argument in the arity, so it is recognised from the type.
  • TypeParameterCount: the explicitly declared type parameters of a type, binding or signature.

This changes the public surface: NavigableItem is a record, so code that constructs one must supply the two fields.

Checklist

  • Test cases added: NavigateToTests covers values, curried, tupled and unit functions, generic functions, types, instance and static members and properties, in implementation and signature files.
  • Performance benchmarks added in case of performance changes
  • Release notes entry updated

🤖 Generated with Claude Code

Navigate To orders matches that are otherwise equal by these counts for C#
and VB. NavigableItem now carries them: every curried and tupled argument of
the method a declaration compiles to, without the instance and without a
solitary unit argument, and its explicitly declared type parameters.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 13, 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:

Change path Release notes path Description
`src/Compiler` docs/release-notes/.FSharp.Compiler.Service/11.0.100.md

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Tooling Safety Check — Affects-Design-Time
Affects-Design-Time: Changes IDE Navigate To execution path.

Generated by PR Tooling Safety Check · gpt56 690.7K ·

@github-actions github-actions Bot added the ⚠️ Affects-Design-Time Tooling check: PR touches type providers or dependency manager label Sep 13, 2026

@T-Gro T-Gro left a comment

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.

🤖 🕵️ AI review — verify independently.

| SynType.LongIdent(SynLongIdent([ id ], _, _)) -> id.idText = "unit"
| SynType.Paren(innerType, _)
| SynType.WithGlobalConstraints(innerType, _, _) -> isUnitType innerType
| _ -> false

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.

🤖 🕵️ Named unit parameter counted as 1 in the signature but 0 in the implementation — different Navigate To sort keys for the same zero-argument method.

// NamedUnit.fsi
module NamedUnit
val Search : u: unit -> int

// NamedUnit.fs
module NamedUnit
let Search () = 1

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

Labels

⚠️ Affects-Design-Time Tooling check: PR touches type providers or dependency manager AI-reviewed PR reviewed by AI review council

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

2 participants