[Repo Assist] Add regression test for unnecessary parens in chained method call (issue #1362)#1483
Draft
github-actions[bot] wants to merge 2 commits intomainfrom
Conversation
…thod call Add a checkNotApplicable test verifying that parentheses around a float literal argument in a chained method call are NOT suggested for removal. bg.lighten(0.2).hexa () -- parens around 0.2 are necessary Without the fix (from dotnet/fsharp#18350), removing the parens produces invalid code: bg.lighten 0.2.hexa () The test uses Diagnostics.acceptAll so it remains valid whether or not FSAC0004 is raised -- it simply asserts the code fix is not offered. Closes #1362 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This is an automated PR from Repo Assist.
Closes #1362
Summary
Adds a
checkNotApplicableregression test for the bug reported in #1362, where theUnnecessaryParenthesesAnalyzerincorrectly suggests removing parentheses that are necessary to disambiguate a chained method call with a float literal argument.Bug scenario:
Removing the parentheses produces invalid F# code:
Root Cause (from upstream analysis)
The bug is in
FSharp.Compiler.Service— the "dot-safe numeric literal" case was evaluated before the "fluent call requires parens" case inSynExpr.fs. Fixed upstream at dotnet/fsharp#18350.Test Design
The test uses
checkNotApplicablewithDiagnostics.acceptAllso it:Test Status
Build: ✅
dotnet buildsucceeded with 0 warnings and 0 errors.Tests were not run in full as this test requires an LSP server environment — it is a live integration test. The build confirms the test compiles correctly.