From 737e12d953304c91f9fa07ce9793e47436eff21f Mon Sep 17 00:00:00 2001 From: Brian Rourke Boll Date: Wed, 8 Nov 2023 15:48:32 -0500 Subject: [PATCH] Don't touch library-only stuff --- src/Compiler/Service/ServiceAnalysis.fs | 8 ++++++++ .../CodeFixes/RemoveUnnecessaryParenthesesTests.fs | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/Compiler/Service/ServiceAnalysis.fs b/src/Compiler/Service/ServiceAnalysis.fs index f168884644c..3bc2eeb973e 100644 --- a/src/Compiler/Service/ServiceAnalysis.fs +++ b/src/Compiler/Service/ServiceAnalysis.fs @@ -1103,6 +1103,14 @@ module UnnecessaryParentheses = // let inline f x = (^a : (static member Parse : string -> ^a) x) | SynExpr.Paren(expr = SynExpr.TraitCall _), _ -> ValueNone + // Don't touch library-only stuff: + // + // (# "ldlen.multi 2 0" array : int #) + | SynExpr.Paren(expr = SynExpr.LibraryOnlyILAssembly _), _ + | SynExpr.Paren(expr = SynExpr.LibraryOnlyStaticOptimization _), _ + | SynExpr.Paren(expr = SynExpr.LibraryOnlyUnionCaseFieldGet _), _ + | SynExpr.Paren(expr = SynExpr.LibraryOnlyUnionCaseFieldSet _), _ -> ValueNone + // Parens are required around the body expresion of a binding // if the parenthesized expression would be invalid without its parentheses, e.g., // diff --git a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveUnnecessaryParenthesesTests.fs b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveUnnecessaryParenthesesTests.fs index 551cfef9f68..a5bd9d67d45 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveUnnecessaryParenthesesTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveUnnecessaryParenthesesTests.fs @@ -668,6 +668,9 @@ let _ = """ $"{3 + LanguagePrimitives.GenericZero :N0}" """ + + // LibraryOnlyILAssembly + """(# "ldlen.multi 2 0" array : int #)""", """(# "ldlen.multi 2 0" array : int #)""" } []