From b5f77b52ad53036724d394b807589128e615cb1b Mon Sep 17 00:00:00 2001 From: Repo Assist Date: Thu, 26 Feb 2026 18:16:14 +0000 Subject: [PATCH 1/2] Add regression test for issue #1362: unnecessary parens in chained method 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> --- .../CodeFixTests/Tests.fs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/FsAutoComplete.Tests.Lsp/CodeFixTests/Tests.fs b/test/FsAutoComplete.Tests.Lsp/CodeFixTests/Tests.fs index fee7850ec..07357f3ec 100644 --- a/test/FsAutoComplete.Tests.Lsp/CodeFixTests/Tests.fs +++ b/test/FsAutoComplete.Tests.Lsp/CodeFixTests/Tests.fs @@ -3651,6 +3651,24 @@ let private removeUnnecessaryParenthesesTests state = (Diagnostics.expectCode "FSAC0004") selector + // Regression test for https://github.com/ionide/FsAutoComplete/issues/1362 + // Parens around a float literal in a chained method call are necessary: + // bg.lighten(0.2).hexa () + // Removing them would produce invalid code: + // bg.lighten 0.2.hexa () + testCaseAsync "Keep parens around float literal argument in chained method call (issue #1362)" + <| CodeFix.checkNotApplicable + server + """ + type C(v: float) = + member _.lighten(x: float) = C(v + x) + member _.hexa() = v.ToString() + let bg = C(0.5) + bg.lighten((0.2)$0).hexa () + """ + Diagnostics.acceptAll + selector + ]) let tests textFactory state = From 5d2b3600c80eefe6c8e82b632f1222074bfa96f3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 26 Feb 2026 18:18:05 +0000 Subject: [PATCH 2/2] ci: trigger CI checks