Skip to content

Commit 9e7ec64

Browse files
Don't touch library-only stuff for 'remove parens' diagnostics(#16244)
1 parent 502aeff commit 9e7ec64

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/Compiler/Service/ServiceAnalysis.fs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,14 @@ module UnnecessaryParentheses =
11031103
// let inline f x = (^a : (static member Parse : string -> ^a) x)
11041104
| SynExpr.Paren(expr = SynExpr.TraitCall _), _ -> ValueNone
11051105

1106+
// Don't touch library-only stuff:
1107+
//
1108+
// (# "ldlen.multi 2 0" array : int #)
1109+
| SynExpr.Paren(expr = SynExpr.LibraryOnlyILAssembly _), _
1110+
| SynExpr.Paren(expr = SynExpr.LibraryOnlyStaticOptimization _), _
1111+
| SynExpr.Paren(expr = SynExpr.LibraryOnlyUnionCaseFieldGet _), _
1112+
| SynExpr.Paren(expr = SynExpr.LibraryOnlyUnionCaseFieldSet _), _ -> ValueNone
1113+
11061114
// Parens are required around the body expresion of a binding
11071115
// if the parenthesized expression would be invalid without its parentheses, e.g.,
11081116
//

vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveUnnecessaryParenthesesTests.fs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,9 @@ let _ =
668668
"""
669669
$"{3 + LanguagePrimitives.GenericZero<int> :N0}"
670670
"""
671+
672+
// LibraryOnlyILAssembly
673+
"""(# "ldlen.multi 2 0" array : int #)""", """(# "ldlen.multi 2 0" array : int #)"""
671674
}
672675

673676
[<Theory; MemberData(nameof exprs)>]

0 commit comments

Comments
 (0)