Skip to content

Fix completion inconsistently filtering obsolete fields and events (#13512)#19506

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-9141961-29048891-8f02666a-f3c0-4c69-bf82-fde45e879f9c
Draft

Fix completion inconsistently filtering obsolete fields and events (#13512)#19506
Copilot wants to merge 2 commits intomainfrom
copilot/fix-9141961-29048891-8f02666a-f3c0-4c69-bf82-fde45e879f9c

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 26, 2026

Fix an inconsistency where FCS code completion shows some obsolete members (IL fields and events) but hides others (methods and properties). All obsolete members are now consistently hidden from completion by default, respecting the SuggestObsoleteSymbols option.

Root Cause

ResolveCompletionsInType in NameResolution.fs filtered obsolete methods (via MethInfoIsUnseen) and properties (via PropInfoIsUnseen) but had no equivalent filtering for IL fields or events. This caused obsolete fields and events from C# assemblies to appear in completion while obsolete methods and properties were hidden.

Changes Made

  • AttributeChecking.fs / .fsi: Added ILFieldInfoIsUnseen and EventInfoIsUnseen functions, following the same pattern as existing PropInfoIsUnseen and MethInfoIsUnseen. Both handle IL, F#, and type provider cases.
  • NameResolution.fs: Applied the new filtering functions in ResolveCompletionsInType for events and IL fields. Also updated ItemIsUnseen to handle Item.ILField and Item.Event for defense-in-depth on other completion paths.
  • CSharpClass.cs: Added ObsoleteMembersClass with obsolete and non-obsolete static fields, methods, properties, and events for C# interop testing.
  • Checker.fs: Added getCompletionInfoWithCompilerAndCompletionOptions helper to support completion tests with external assembly references.
  • CompletionTests.fs: Added 8 new tests:
    • 2 F# event tests (instance + static with [<Obsolete; CLIEvent>])
    • 5 C# interop tests verifying all 4 member types from the original issue are consistently hidden
    • 1 test verifying non-obsolete members remain visible regardless of the option
  • Release notes: Added entry in 11.0.100.md.

Testing

  • All 37 obsolete completion tests pass (29 existing + 8 new)
  • All 71+ total completion tests pass with no regressions
  • Code review and CodeQL clean

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@T-Gro
Copy link
Copy Markdown
Member

T-Gro commented Mar 27, 2026

@copilot : Try again

@T-Gro
Copy link
Copy Markdown
Member

T-Gro commented Mar 27, 2026

@copilot : Try again.

@abonie
Copy link
Copy Markdown
Member

abonie commented Mar 31, 2026

@copilot Try again

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 31, 2026

@copilot Try again

Reimplemented from scratch on latest main in commits a371209 and 6f6cf86.

Root cause: ResolveCompletionsInType in NameResolution.fs filtered obsolete methods (via MethInfoIsUnseen) and properties (via PropInfoIsUnseen) but had no filtering for IL fields or events.

Fix: Added ILFieldInfoIsUnseen and EventInfoIsUnseen functions in AttributeChecking.fs, then applied them in both ResolveCompletionsInType and ItemIsUnseen. All 37 obsolete completion tests pass, including 6 new C# interop tests that verify all four member types (field, method, property, event) from the original issue are consistently hidden.

Copilot AI changed the title [WIP] Copilot Request Fix completion inconsistently filtering obsolete fields and events (#13512) Mar 31, 2026
Copilot AI requested a review from abonie March 31, 2026 14:48
@T-Gro T-Gro force-pushed the copilot/fix-9141961-29048891-8f02666a-f3c0-4c69-bf82-fde45e879f9c branch from 6f6cf86 to d7f1fd8 Compare April 9, 2026 12:27
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

❗ Release notes required


✅ 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

@T-Gro T-Gro force-pushed the copilot/fix-9141961-29048891-8f02666a-f3c0-4c69-bf82-fde45e879f9c branch from d7f1fd8 to 96ad019 Compare April 9, 2026 13:18
Copilot AI and others added 2 commits April 10, 2026 12:27
Add ILFieldInfoIsUnseen and EventInfoIsUnseen functions to filter obsolete
IL fields and events from completion, matching existing behavior for methods
and properties. Also update ItemIsUnseen to handle ILField and Event items.

Fixes #13693

Agent-Logs-Url: https://github.com/dotnet/fsharp/sessions/1d21d452-3f55-4d56-898c-0b50980050b5

Co-authored-by: abonie <20281641+abonie@users.noreply.github.com>
Fix issue number to #13512. Add ObsoleteMembersClass to CSharp_Analysis
with obsolete and non-obsolete members. Add 6 C# interop completion tests
verifying all obsolete member types are consistently hidden.

Agent-Logs-Url: https://github.com/dotnet/fsharp/sessions/1d21d452-3f55-4d56-898c-0b50980050b5

Co-authored-by: abonie <20281641+abonie@users.noreply.github.com>
@T-Gro T-Gro force-pushed the copilot/fix-9141961-29048891-8f02666a-f3c0-4c69-bf82-fde45e879f9c branch from 96ad019 to 8521961 Compare April 10, 2026 10:28
Copy link
Copy Markdown
Member

@auduchinok auduchinok left a comment

Choose a reason for hiding this comment

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

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

4 participants