-
Couldn't load subscription status.
- Fork 833
Fix IsByRefLikeAttribute types being incorrectly suppressed in completion lists #18784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
❗ Release notes required
Warning No PR link found in some release notes, please consider adding it.
|
…bsolete Co-authored-by: T-Gro <[email protected]>
vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs
Outdated
Show resolved
Hide resolved
- Add attrib_IsByRefLikeAttribute_opt to TcGlobals as optional attribute - Fix CheckFSharpAttributesForObsolete to use HasFSharpAttributeOpt pattern - Add proper signature in TcGlobals.fsi - Update test to expect only 'Span' for 'System.Sp' completion Co-authored-by: T-Gro <[email protected]>
|
Also add release notes to docs/release-notes/.FSharp.Compiler.Service/10.0.100.md |
Co-authored-by: T-Gro <[email protected]>
Added release notes documenting the IsByRefLikeAttribute completion fix. The entry explains that types like |
vsintegration/tests/FSharp.Editor.Tests/CompletionProviderTests.fs
Outdated
Show resolved
Hide resolved
…Core conditioning Co-authored-by: T-Gro <[email protected]>
Co-authored-by: T-Gro <[email protected]>
|
@copilot |
The original fix only handled F# types through CheckFSharpAttributesForObsolete but types like Span<T> and ReadOnlySpan<T> are .NET types that go through IL attribute checking. Updated CheckILAttributesForUnseen to also exclude types with IsByRefLikeAttribute from being considered obsolete, ensuring they appear in completion lists despite having ObsoleteAttribute. Co-authored-by: abonie <[email protected]>
Head branch was pushed to by a user without write access
... Fixed the test failure. The issue was that the original fix only handled F# types through |
Problem
Types like
Span<T>andReadOnlySpan<T>were being incorrectly suppressed from IntelliSense completion lists due to having bothObsoleteAttributeandIsByRefLikeAttribute. The completion system was treating any type withObsoleteAttributeas obsolete, regardless of other attributes.Root Cause
The issue occurred because:
Span<T>andReadOnlySpan<T>haveObsoleteAttributein .NET for specific technical reasonsIsByRefLikeAttributeto indicate they are stack-only typesCheckFSharpAttributesForObsoletewhile .NET types useCheckILAttributesForUnseenSolution
Extended both attribute checking functions to exclude types marked with
IsByRefLikeAttributefrom being considered obsolete:CheckFSharpAttributesForObsoleteinAttributeChecking.fsCheckILAttributesForUnseeninAttributeChecking.fsattrib_IsByRefLikeAttribute_opttoTcGlobalsusing the establishedtryFindSysAttribpatternBoth functions now use the same logic: if a type has
ObsoleteAttributebut also hasIsByRefLikeAttribute, it should not be considered obsolete for completion purposes.Testing
Added a unit test in
CompletionTests.fsthat verifies:System.SpshowsSpanin completion suggestionsSpan<T>is availableThis ensures that by-ref-like types remain visible and accessible to developers while maintaining the existing obsolete attribute behavior for other types.
This pull request was created as a result of the following prompt from Copilot chat.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.