diff --git a/ReSharper.FSharp/src/FSharp.Psi.Features/FSharp.Psi.Features.fsproj b/ReSharper.FSharp/src/FSharp.Psi.Features/FSharp.Psi.Features.fsproj index d62c09f1eb..e0df1de8c5 100644 --- a/ReSharper.FSharp/src/FSharp.Psi.Features/FSharp.Psi.Features.fsproj +++ b/ReSharper.FSharp/src/FSharp.Psi.Features/FSharp.Psi.Features.fsproj @@ -159,6 +159,7 @@ + diff --git a/ReSharper.FSharp/src/FSharp.Psi.Features/src/Daemon/Highlightings/CommonErrors.xml b/ReSharper.FSharp/src/FSharp.Psi.Features/src/Daemon/Highlightings/CommonErrors.xml index 70d4fd4c87..755e396788 100644 --- a/ReSharper.FSharp/src/FSharp.Psi.Features/src/Daemon/Highlightings/CommonErrors.xml +++ b/ReSharper.FSharp/src/FSharp.Psi.Features/src/Daemon/Highlightings/CommonErrors.xml @@ -87,6 +87,7 @@ AddUnderscorePrefixFix RemoveUnusedLocalBindingFix RemoveUnusedNamedAsPatFix + IgnoreUnusedBindingExpressionFix diff --git a/ReSharper.FSharp/src/FSharp.Psi.Features/src/QuickFixes/AddIgnoreFix.fs b/ReSharper.FSharp/src/FSharp.Psi.Features/src/QuickFixes/AddIgnoreFix.fs index 033761391b..8a308b8565 100644 --- a/ReSharper.FSharp/src/FSharp.Psi.Features/src/QuickFixes/AddIgnoreFix.fs +++ b/ReSharper.FSharp/src/FSharp.Psi.Features/src/QuickFixes/AddIgnoreFix.fs @@ -77,8 +77,5 @@ type AddIgnoreFix(expr: IFSharpExpression) = override x.ExecutePsiTransaction _ = use writeCookie = WriteLockCookie.Create(expr.IsPhysical()) use disableFormatter = new DisableCodeFormatter() - - let ignoreApp = expr.CreateElementFactory().CreateIgnoreApp(expr, shouldAddNewLine expr) - let replaced = ModificationUtil.ReplaceChild(expr, ignoreApp).As() - addParensIfNeeded replaced.LeftArgument |> ignore + ignoreExpression expr (shouldAddNewLine expr) diff --git a/ReSharper.FSharp/src/FSharp.Psi.Features/src/QuickFixes/IgnoreUnusedBindingExpressionFix.fs b/ReSharper.FSharp/src/FSharp.Psi.Features/src/QuickFixes/IgnoreUnusedBindingExpressionFix.fs new file mode 100644 index 0000000000..fba2a25cb2 --- /dev/null +++ b/ReSharper.FSharp/src/FSharp.Psi.Features/src/QuickFixes/IgnoreUnusedBindingExpressionFix.fs @@ -0,0 +1,55 @@ +namespace JetBrains.ReSharper.Plugins.FSharp.Psi.Features.Daemon.QuickFixes + +open JetBrains.ReSharper.Plugins.FSharp.Psi.Features.Daemon.Highlightings +open JetBrains.ReSharper.Plugins.FSharp.Psi.Impl +open JetBrains.ReSharper.Plugins.FSharp.Psi.Impl.Tree +open JetBrains.ReSharper.Plugins.FSharp.Psi.Tree +open JetBrains.ReSharper.Plugins.FSharp.Psi +open JetBrains.ReSharper.Plugins.FSharp.Psi.Features.Util +open JetBrains.ReSharper.Psi +open JetBrains.ReSharper.Psi.ExtensionsAPI.Tree +open JetBrains.ReSharper.Psi.Tree +open JetBrains.ReSharper.Resources.Shell + +type IgnoreUnusedBindingExpressionFix(warning: UnusedValueWarning) = + inherit FSharpQuickFixBase() + + let pat = warning.Pat.IgnoreParentParens() + let binding = BindingNavigator.GetByHeadPattern(pat) + let letOrUseExpr = LetOrUseExprNavigator.GetByBinding(binding) + + let rec getCorrectAnchor (expr: ITreeNode): ITreeNode = + match expr with + | :? ISequentialExpr as seqExpr when not (seqExpr.ExpressionsEnumerable.IsEmpty()) -> + let last = seqExpr.ExpressionsEnumerable.LastOrDefault() + if last :? ILetOrUseExpr then getCorrectAnchor last else last :> _ + + | :? ILetOrUseExpr as letExpr when isNotNull letExpr.InExpression -> getCorrectAnchor letExpr.InExpression + | _ -> + + let exprCopy = expr.Copy() + let seqExpr = ModificationUtil.ReplaceChild(expr, ElementType.SEQUENTIAL_EXPR.Create()) + ModificationUtil.AddChild(seqExpr, exprCopy) + + override x.Text = "Ignore expression" + + override x.IsAvailable _ = + isValid pat && not (pat :? IParametersOwnerPat) && isValid letOrUseExpr && letOrUseExpr.Bindings.Count = 1 && + isValid binding.Expression && not (binding.Expression :? IDoExpr) + + override x.ExecutePsiTransaction _ = + use writeLock = WriteLockCookie.Create(pat.IsPhysical()) + use formatter = FSharpRegistryUtil.AllowFormatterCookie.Create() + + if not (binding.Expression.Type().IsVoid()) then + ignoreInnermostExpression binding.Expression false + + let inExpr = letOrUseExpr.InExpression + let newLine = NewLine(letOrUseExpr.GetLineEnding()) + + let bindingExpr = ModificationUtil.ReplaceChild(letOrUseExpr, binding.Expression) + addNodesAfter (getCorrectAnchor bindingExpr) [ + newLine + newLine + inExpr + ] |> ignore diff --git a/ReSharper.FSharp/src/FSharp.Psi.Features/src/Util/FSharpExpressionUtil.fs b/ReSharper.FSharp/src/FSharp.Psi.Features/src/Util/FSharpExpressionUtil.fs index 1edeb90de3..a91c0d7123 100644 --- a/ReSharper.FSharp/src/FSharp.Psi.Features/src/Util/FSharpExpressionUtil.fs +++ b/ReSharper.FSharp/src/FSharp.Psi.Features/src/Util/FSharpExpressionUtil.fs @@ -108,3 +108,22 @@ let setBindingExpression (expr: IFSharpExpression) contextIndent (letBindings: # ModificationUtil.AddChildBefore(newExpr, NewLine(expr.GetLineEnding())) |> ignore ModificationUtil.AddChildBefore(newExpr, Whitespace(contextIndent + indentSize)) |> ignore shiftExpr indentSize newExpr + +let ignoreExpression (expr: IFSharpExpression) shouldAddNewLine = + let ignoreApp = expr.CreateElementFactory().CreateIgnoreApp(expr, shouldAddNewLine) + + let replaced = ModificationUtil.ReplaceChild(expr, ignoreApp).As() + addParensIfNeeded replaced.LeftArgument |> ignore + +let ignoreInnermostExpression (expr: IFSharpExpression) shouldAddNewLine = + let rec getInnermostExpression (expr: IFSharpExpression) = + match expr with + | :? ISequentialExpr as seqExpr when not (seqExpr.ExpressionsEnumerable.IsEmpty()) -> + getInnermostExpression (seqExpr.ExpressionsEnumerable.LastOrDefault()) + | :? ILetOrUseExpr as letOrUseExpr when isNotNull letOrUseExpr.InExpression -> + getInnermostExpression letOrUseExpr.InExpression + | :? IParenExpr as parenExpr when isNotNull parenExpr.InnerExpression -> + getInnermostExpression parenExpr.InnerExpression + | _ -> expr + + ignoreExpression (getInnermostExpression expr) shouldAddNewLine diff --git a/ReSharper.FSharp/src/FSharp.Psi/src/CodeFormatter/FSharpCodeFormatterInfoProvider.cs b/ReSharper.FSharp/src/FSharp.Psi/src/CodeFormatter/FSharpCodeFormatterInfoProvider.cs index 3d442e06bd..0914b0234e 100644 --- a/ReSharper.FSharp/src/FSharp.Psi/src/CodeFormatter/FSharpCodeFormatterInfoProvider.cs +++ b/ReSharper.FSharp/src/FSharp.Psi/src/CodeFormatter/FSharpCodeFormatterInfoProvider.cs @@ -214,6 +214,22 @@ private void Aligning() private void Formatting() { + Describe() + .Name("LineBreakBeforeIgnorePipe") + .Group(LineBreaksRuleGroup) + .Where( + Parent() + .HasType(ElementType.BINARY_APP_EXPR) + .Satisfies((node, context) => ((IBinaryAppExpr) node).RightArgument.GetText() == "ignore"), + Left() + .HasRole(BinaryAppExpr.LEFT_ARG_EXPR) + .Satisfies((node, context) => node.ContainsLineBreak(context.CodeFormatter)) + .In(ElementType.MATCH_EXPR, ElementType.IF_THEN_ELSE_EXPR, ElementType.TRY_WITH_EXPR, + ElementType.TRY_FINALLY_EXPR, ElementType.LAMBDA_EXPR, ElementType.ASSERT_EXPR, + ElementType.LAZY_EXPR, ElementType.MATCH_LAMBDA_EXPR)) + .Return(IntervalFormatType.NewLine) + .Build(); + Describe() .Group(SpaceRuleGroup) .Name("SpaceAfterImplicitConstructorDecl") @@ -285,7 +301,8 @@ private void DescribeSimpleAlignmentRule((string name, CompositeNodeType nodeTyp } private static bool IndentElseExpr(ITreeNode elseExpr, CodeFormattingContext context) => - elseExpr.GetPreviousMeaningfulSibling().IsFirstOnLine(context.CodeFormatter) && !(elseExpr is IElifExpr); + (elseExpr.GetPreviousMeaningfulSibling().IsFirstOnLine(context.CodeFormatter) || + !AreAligned(elseExpr, elseExpr.Parent?.FirstChild, context.CodeFormatter)) && !(elseExpr is IElifExpr); private static bool AreAligned(ITreeNode first, ITreeNode second, IWhitespaceChecker whitespaceChecker) => first.CalcLineIndent(whitespaceChecker) == second.CalcLineIndent(whitespaceChecker); diff --git a/ReSharper.FSharp/src/FSharp.Psi/src/FSharp.psi b/ReSharper.FSharp/src/FSharp.Psi/src/FSharp.psi index 58d6059e50..e44eb6e289 100644 --- a/ReSharper.FSharp/src/FSharp.Psi/src/FSharp.psi +++ b/ReSharper.FSharp/src/FSharp.Psi/src/FSharp.psi @@ -653,7 +653,7 @@ doExpr options { stubBase="UnitExpressionBase"; }: DO fSharpExpression; -assertExpr options { stubBase="FSharpExpressionBase"; }: +assertExpr options { stubBase="UnitExpressionBase"; }: ASSERT fSharpExpression; diff --git a/ReSharper.FSharp/src/FSharp.Psi/src/Impl/Tree/LetOrUseExpr.cs b/ReSharper.FSharp/src/FSharp.Psi/src/Impl/Tree/LetOrUseExpr.cs index 4a7345bb61..87da24e1f5 100644 --- a/ReSharper.FSharp/src/FSharp.Psi/src/Impl/Tree/LetOrUseExpr.cs +++ b/ReSharper.FSharp/src/FSharp.Psi/src/Impl/Tree/LetOrUseExpr.cs @@ -1,5 +1,6 @@ using JetBrains.Diagnostics; using JetBrains.ReSharper.Plugins.FSharp.Psi.Parsing; +using JetBrains.ReSharper.Psi; namespace JetBrains.ReSharper.Plugins.FSharp.Psi.Impl.Tree { @@ -18,5 +19,7 @@ public void SetIsRecursive(bool value) LetOrUseToken.NotNull().AddTokenAfter(FSharpTokenType.REC); } + + public override IType Type() => InExpression.Type(); } } diff --git a/ReSharper.FSharp/src/FSharp.Psi/src/Impl/Tree/TryFinallyExpr.cs b/ReSharper.FSharp/src/FSharp.Psi/src/Impl/Tree/TryFinallyExpr.cs new file mode 100644 index 0000000000..229ba40c79 --- /dev/null +++ b/ReSharper.FSharp/src/FSharp.Psi/src/Impl/Tree/TryFinallyExpr.cs @@ -0,0 +1,9 @@ +using JetBrains.ReSharper.Psi; + +namespace JetBrains.ReSharper.Plugins.FSharp.Psi.Impl.Tree +{ + internal partial class TryFinallyExpr + { + public override IType Type() => TryExpression.Type(); + } +} diff --git a/ReSharper.FSharp/src/FSharp.Psi/src/Impl/Tree/TryWithExpr.cs b/ReSharper.FSharp/src/FSharp.Psi/src/Impl/Tree/TryWithExpr.cs new file mode 100644 index 0000000000..9b714a1751 --- /dev/null +++ b/ReSharper.FSharp/src/FSharp.Psi/src/Impl/Tree/TryWithExpr.cs @@ -0,0 +1,9 @@ +using JetBrains.ReSharper.Psi; + +namespace JetBrains.ReSharper.Plugins.FSharp.Psi.Impl.Tree +{ + internal partial class TryWithExpr + { + public override IType Type() => TryExpression.Type(); + } +} diff --git a/ReSharper.FSharp/test/data/features/quickFixes/addUnderscorePrefix/Availability 01 - Escaped name.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/addUnderscorePrefix/Availability 01 - Escaped name.fs.gold index 56fe84f153..7eb74daffe 100644 --- a/ReSharper.FSharp/test/data/features/quickFixes/addUnderscorePrefix/Availability 01 - Escaped name.fs.gold +++ b/ReSharper.FSharp/test/data/features/quickFixes/addUnderscorePrefix/Availability 01 - Escaped name.fs.gold @@ -15,6 +15,7 @@ Replace with '_' --Replace unused values with '_' in solution Rename to '_foo' Remove unused value +Ignore expression 1: The value 'foo bar' is unused QUICKFIXES: Replace with '_' @@ -23,3 +24,4 @@ Replace with '_' --Replace unused values with '_' in project --Replace unused values with '_' in solution Remove unused value +Ignore expression diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 01 - Seq expr.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 01 - Seq expr.fs new file mode 100644 index 0000000000..fbd5f7875a --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 01 - Seq expr.fs @@ -0,0 +1,8 @@ +module Module + +let a = + let b{caret} = + 1 + 1 + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 01 - Seq expr.fs.dump.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 01 - Seq expr.fs.dump.gold new file mode 100644 index 0000000000..4014255b79 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 01 - Seq expr.fs.dump.gold @@ -0,0 +1,40 @@ +IFSharpImplFile + INamedModuleDeclaration + FSharpTokenType+ModuleTokenElement(type:MODULE, text:module) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpIdentifierToken(type:IDENTIFIER, text:Module) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + ILetModuleDecl + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ITopBinding + ITopReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IChameleonExpression + ISequentialExpr + ILiteralExpr + FSharpToken(type:INT32, text:1) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IBinaryAppExpr + ILiteralExpr + FSharpToken(type:INT32, text:1) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:SYMBOLIC_OP, text:|>) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:IDENTIFIER, text:ignore) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 01 - Seq expr.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 01 - Seq expr.fs.gold new file mode 100644 index 0000000000..8820b2e837 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 01 - Seq expr.fs.gold @@ -0,0 +1,7 @@ +module Module + +let a = + 1{caret} + 1 |> ignore + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 02 - Nested let.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 02 - Nested let.fs new file mode 100644 index 0000000000..beac81e1a0 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 02 - Nested let.fs @@ -0,0 +1,8 @@ +module Module + +let a = + let b{caret} = + let c = 1 + c + c + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 02 - Nested let.fs.dump.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 02 - Nested let.fs.dump.gold new file mode 100644 index 0000000000..26aa7e93f7 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 02 - Nested let.fs.dump.gold @@ -0,0 +1,57 @@ +IFSharpImplFile + INamedModuleDeclaration + FSharpTokenType+ModuleTokenElement(type:MODULE, text:module) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpIdentifierToken(type:IDENTIFIER, text:Module) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + ILetModuleDecl + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ITopBinding + ITopReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IChameleonExpression + ILetOrUseExpr + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILocalBinding + ILocalReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:c) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:1) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ISequentialExpr + IBinaryAppExpr + IBinaryAppExpr + IReferenceExpr + FSharpIdentifierToken(type:IDENTIFIER, text:c) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:PLUS, text:+) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:IDENTIFIER, text:c) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:SYMBOLIC_OP, text:|>) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:IDENTIFIER, text:ignore) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 02 - Nested let.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 02 - Nested let.fs.gold new file mode 100644 index 0000000000..6b16ea360f --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 02 - Nested let.fs.gold @@ -0,0 +1,7 @@ +module Module + +let a = + let {caret}c = 1 + c + c |> ignore + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 03 - If expr.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 03 - If expr.fs new file mode 100644 index 0000000000..d7eb39240b --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 03 - If expr.fs @@ -0,0 +1,10 @@ +module Module + +let a = + let b{caret} = + if true then + 1 + else + 2 + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 03 - If expr.fs.dump.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 03 - If expr.fs.dump.gold new file mode 100644 index 0000000000..fdebbda976 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 03 - If expr.fs.dump.gold @@ -0,0 +1,53 @@ +IFSharpImplFile + INamedModuleDeclaration + FSharpTokenType+ModuleTokenElement(type:MODULE, text:module) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpIdentifierToken(type:IDENTIFIER, text:Module) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + ILetModuleDecl + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ITopBinding + ITopReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IChameleonExpression + ISequentialExpr + IBinaryAppExpr + IIfThenElseExpr + FSharpTokenType+IfTokenElement(type:IF, text:if) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpTokenType+TrueTokenElement(type:TRUE, text:true) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+ThenTokenElement(type:THEN, text:then) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:1) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+ElseTokenElement(type:ELSE, text:else) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:2) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:SYMBOLIC_OP, text:|>) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:IDENTIFIER, text:ignore) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 03 - If expr.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 03 - If expr.fs.gold new file mode 100644 index 0000000000..4961ea644c --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 03 - If expr.fs.gold @@ -0,0 +1,10 @@ +module Module + +let a = + {caret}if true then + 1 + else + 2 + |> ignore + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 04 - Match expr.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 04 - Match expr.fs new file mode 100644 index 0000000000..93b765c051 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 04 - Match expr.fs @@ -0,0 +1,9 @@ +module Module + +let a = + let b{caret} = + match () with + | a -> 1 + | b -> 2 + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 04 - Match expr.fs.dump.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 04 - Match expr.fs.dump.gold new file mode 100644 index 0000000000..e6c4a9e329 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 04 - Match expr.fs.dump.gold @@ -0,0 +1,69 @@ +IFSharpImplFile + INamedModuleDeclaration + FSharpTokenType+ModuleTokenElement(type:MODULE, text:module) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpIdentifierToken(type:IDENTIFIER, text:Module) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + ILetModuleDecl + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ITopBinding + ITopReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IChameleonExpression + ISequentialExpr + IBinaryAppExpr + IMatchExpr + FSharpTokenType+MatchTokenElement(type:MATCH, text:match) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+WithTokenElement(type:WITH, text:with) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IMatchClause + FSharpTokenType+BarTokenElement(type:BAR, text:|) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILocalReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+RarrowTokenElement(type:RARROW, text:->) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:1) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IMatchClause + FSharpTokenType+BarTokenElement(type:BAR, text:|) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILocalReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:b) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+RarrowTokenElement(type:RARROW, text:->) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:2) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:SYMBOLIC_OP, text:|>) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:IDENTIFIER, text:ignore) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 04 - Match expr.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 04 - Match expr.fs.gold new file mode 100644 index 0000000000..d84a39cb44 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 04 - Match expr.fs.gold @@ -0,0 +1,9 @@ +module Module + +let a = + {caret}match () with + | a -> 1 + | b -> 2 + |> ignore + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 05 - Match expr - Deindented last clause.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 05 - Match expr - Deindented last clause.fs new file mode 100644 index 0000000000..4c6feb4b0f --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 05 - Match expr - Deindented last clause.fs @@ -0,0 +1,11 @@ +module Module + +let a = + let b{caret} = + match () with + | a -> 1 + | b -> + + 2 + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 05 - Match expr - Deindented last clause.fs.dump.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 05 - Match expr - Deindented last clause.fs.dump.gold new file mode 100644 index 0000000000..aa16b3e873 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 05 - Match expr - Deindented last clause.fs.dump.gold @@ -0,0 +1,71 @@ +IFSharpImplFile + INamedModuleDeclaration + FSharpTokenType+ModuleTokenElement(type:MODULE, text:module) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpIdentifierToken(type:IDENTIFIER, text:Module) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + ILetModuleDecl + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ITopBinding + ITopReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IChameleonExpression + ISequentialExpr + IBinaryAppExpr + IMatchExpr + FSharpTokenType+MatchTokenElement(type:MATCH, text:match) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+WithTokenElement(type:WITH, text:with) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IMatchClause + FSharpTokenType+BarTokenElement(type:BAR, text:|) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILocalReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+RarrowTokenElement(type:RARROW, text:->) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:1) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IMatchClause + FSharpTokenType+BarTokenElement(type:BAR, text:|) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILocalReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:b) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+RarrowTokenElement(type:RARROW, text:->) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:2) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:SYMBOLIC_OP, text:|>) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:IDENTIFIER, text:ignore) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 05 - Match expr - Deindented last clause.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 05 - Match expr - Deindented last clause.fs.gold new file mode 100644 index 0000000000..249ed2d379 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 05 - Match expr - Deindented last clause.fs.gold @@ -0,0 +1,11 @@ +module Module + +let a = + {caret}match () with + | a -> 1 + | b -> + + 2 + |> ignore + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 06 - If expr - Deindented else expr.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 06 - If expr - Deindented else expr.fs new file mode 100644 index 0000000000..6f0fb774bd --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 06 - If expr - Deindented else expr.fs @@ -0,0 +1,9 @@ +module Module + +let a = + let b{caret} = + if true then 1 else + + 2 + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 06 - If expr - Deindented else expr.fs.dump.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 06 - If expr - Deindented else expr.fs.dump.gold new file mode 100644 index 0000000000..dd1a2b7055 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 06 - If expr - Deindented else expr.fs.dump.gold @@ -0,0 +1,52 @@ +IFSharpImplFile + INamedModuleDeclaration + FSharpTokenType+ModuleTokenElement(type:MODULE, text:module) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpIdentifierToken(type:IDENTIFIER, text:Module) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + ILetModuleDecl + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ITopBinding + ITopReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IChameleonExpression + ISequentialExpr + IBinaryAppExpr + IIfThenElseExpr + FSharpTokenType+IfTokenElement(type:IF, text:if) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpTokenType+TrueTokenElement(type:TRUE, text:true) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+ThenTokenElement(type:THEN, text:then) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:1) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+ElseTokenElement(type:ELSE, text:else) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:2) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:SYMBOLIC_OP, text:|>) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:IDENTIFIER, text:ignore) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 06 - If expr - Deindented else expr.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 06 - If expr - Deindented else expr.fs.gold new file mode 100644 index 0000000000..bcf23c98cc --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 06 - If expr - Deindented else expr.fs.gold @@ -0,0 +1,9 @@ +module Module + +let a = + {caret}if true then 1 else + + 2 + |> ignore + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 07 - Paren expr.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 07 - Paren expr.fs new file mode 100644 index 0000000000..03265ca968 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 07 - Paren expr.fs @@ -0,0 +1,11 @@ +module Module + +let a = + let b{caret} = ( + let a = 1 + let b = 2 + + a + b + ) + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 07 - Paren expr.fs.dump.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 07 - Paren expr.fs.dump.gold new file mode 100644 index 0000000000..d8279f5ade --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 07 - Paren expr.fs.dump.gold @@ -0,0 +1,79 @@ +IFSharpImplFile + INamedModuleDeclaration + FSharpTokenType+ModuleTokenElement(type:MODULE, text:module) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpIdentifierToken(type:IDENTIFIER, text:Module) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + ILetModuleDecl + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ITopBinding + ITopReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IChameleonExpression + ISequentialExpr + IParenExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILetOrUseExpr + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILocalBinding + ILocalReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:1) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILetOrUseExpr + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILocalBinding + ILocalReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:b) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:2) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IBinaryAppExpr + IBinaryAppExpr + IReferenceExpr + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:PLUS, text:+) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:IDENTIFIER, text:b) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:SYMBOLIC_OP, text:|>) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:IDENTIFIER, text:ignore) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 07 - Paren expr.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 07 - Paren expr.fs.gold new file mode 100644 index 0000000000..42028eb2a3 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 07 - Paren expr.fs.gold @@ -0,0 +1,11 @@ +module Module + +let a = + {caret}( + let a = 1 + let b = 2 + + a + b |> ignore + ) + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 08 - Unit.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 08 - Unit.fs new file mode 100644 index 0000000000..ac2c243cf1 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 08 - Unit.fs @@ -0,0 +1,10 @@ +module Module + +let a = + let b{caret} = + let a = 1 + let b = 2 + + () + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 08 - Unit.fs.dump.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 08 - Unit.fs.dump.gold new file mode 100644 index 0000000000..363d95af8c --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 08 - Unit.fs.dump.gold @@ -0,0 +1,59 @@ +IFSharpImplFile + INamedModuleDeclaration + FSharpTokenType+ModuleTokenElement(type:MODULE, text:module) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpIdentifierToken(type:IDENTIFIER, text:Module) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + ILetModuleDecl + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ITopBinding + ITopReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IChameleonExpression + ILetOrUseExpr + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILocalBinding + ILocalReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:1) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILetOrUseExpr + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILocalBinding + ILocalReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:b) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:2) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ISequentialExpr + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 08 - Unit.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 08 - Unit.fs.gold new file mode 100644 index 0000000000..66e27b389f --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 08 - Unit.fs.gold @@ -0,0 +1,9 @@ +module Module + +let a = + let {caret}a = 1 + let b = 2 + + () + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 09 - Lazy.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 09 - Lazy.fs new file mode 100644 index 0000000000..988bacf01a --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 09 - Lazy.fs @@ -0,0 +1,8 @@ +module Module + +let a = + let {caret}a = + lazy + 1 + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 09 - Lazy.fs.dump.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 09 - Lazy.fs.dump.gold new file mode 100644 index 0000000000..95beba4473 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 09 - Lazy.fs.dump.gold @@ -0,0 +1,41 @@ +IFSharpImplFile + INamedModuleDeclaration + FSharpTokenType+ModuleTokenElement(type:MODULE, text:module) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpIdentifierToken(type:IDENTIFIER, text:Module) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + ILetModuleDecl + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ITopBinding + ITopReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IChameleonExpression + ISequentialExpr + IBinaryAppExpr + ILazyExpr + FSharpTokenType+LazyTokenElement(type:LAZY, text:lazy) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:1) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:SYMBOLIC_OP, text:|>) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:IDENTIFIER, text:ignore) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 09 - Lazy.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 09 - Lazy.fs.gold new file mode 100644 index 0000000000..4a7e103fe5 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 09 - Lazy.fs.gold @@ -0,0 +1,8 @@ +module Module + +let a = + l{caret}azy + 1 + |> ignore + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 10 - Match lambda expr.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 10 - Match lambda expr.fs new file mode 100644 index 0000000000..44ed84c4f7 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 10 - Match lambda expr.fs @@ -0,0 +1,9 @@ +module Module + +let a = + let {caret}a = + function + | b -> 1 + | c -> 2 + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 10 - Match lambda expr.fs.dump.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 10 - Match lambda expr.fs.dump.gold new file mode 100644 index 0000000000..741369139c --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 10 - Match lambda expr.fs.dump.gold @@ -0,0 +1,63 @@ +IFSharpImplFile + INamedModuleDeclaration + FSharpTokenType+ModuleTokenElement(type:MODULE, text:module) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpIdentifierToken(type:IDENTIFIER, text:Module) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + ILetModuleDecl + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ITopBinding + ITopReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IChameleonExpression + ISequentialExpr + IBinaryAppExpr + IMatchLambdaExpr + FSharpTokenType+FunctionTokenElement(type:FUNCTION, text:function) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IMatchClause + FSharpTokenType+BarTokenElement(type:BAR, text:|) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILocalReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:b) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+RarrowTokenElement(type:RARROW, text:->) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:1) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IMatchClause + FSharpTokenType+BarTokenElement(type:BAR, text:|) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILocalReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:c) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+RarrowTokenElement(type:RARROW, text:->) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:2) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:SYMBOLIC_OP, text:|>) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:IDENTIFIER, text:ignore) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 10 - Match lambda expr.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 10 - Match lambda expr.fs.gold new file mode 100644 index 0000000000..aab05acff4 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 10 - Match lambda expr.fs.gold @@ -0,0 +1,9 @@ +module Module + +let a = + {caret}function + | b -> 1 + | c -> 2 + |> ignore + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 11 - Lambda expr.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 11 - Lambda expr.fs new file mode 100644 index 0000000000..c64091fbd9 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 11 - Lambda expr.fs @@ -0,0 +1,8 @@ +module Module + +let a = + let {caret}a = + fun x -> + x + 1 + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 11 - Lambda expr.fs.dump.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 11 - Lambda expr.fs.dump.gold new file mode 100644 index 0000000000..054896e8f2 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 11 - Lambda expr.fs.dump.gold @@ -0,0 +1,55 @@ +IFSharpImplFile + INamedModuleDeclaration + FSharpTokenType+ModuleTokenElement(type:MODULE, text:module) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpIdentifierToken(type:IDENTIFIER, text:Module) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + ILetModuleDecl + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ITopBinding + ITopReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IChameleonExpression + ISequentialExpr + IBinaryAppExpr + ILambdaExpr + FSharpTokenType+FunTokenElement(type:FUN, text:fun) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILambdaParametersList + ILocalReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:x) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+RarrowTokenElement(type:RARROW, text:->) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IBinaryAppExpr + IReferenceExpr + FSharpIdentifierToken(type:IDENTIFIER, text:x) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:PLUS, text:+) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:1) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:SYMBOLIC_OP, text:|>) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:IDENTIFIER, text:ignore) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 11 - Lambda expr.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 11 - Lambda expr.fs.gold new file mode 100644 index 0000000000..e1bd8aacd9 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 11 - Lambda expr.fs.gold @@ -0,0 +1,8 @@ +module Module + +let a = + {caret}fun x -> + x + 1 + |> ignore + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 12 - Try with expr.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 12 - Try with expr.fs new file mode 100644 index 0000000000..20710057d1 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 12 - Try with expr.fs @@ -0,0 +1,9 @@ +module Module + +let a = + let {caret}a = + try 1 with + | b -> 1 + | c -> 1 + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 12 - Try with expr.fs.dump.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 12 - Try with expr.fs.dump.gold new file mode 100644 index 0000000000..ac09cf1952 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 12 - Try with expr.fs.dump.gold @@ -0,0 +1,68 @@ +IFSharpImplFile + INamedModuleDeclaration + FSharpTokenType+ModuleTokenElement(type:MODULE, text:module) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpIdentifierToken(type:IDENTIFIER, text:Module) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + ILetModuleDecl + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ITopBinding + ITopReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IChameleonExpression + ISequentialExpr + IBinaryAppExpr + ITryWithExpr + FSharpTokenType+TryTokenElement(type:TRY, text:try) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:1) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+WithTokenElement(type:WITH, text:with) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IMatchClause + FSharpTokenType+BarTokenElement(type:BAR, text:|) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILocalReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:b) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+RarrowTokenElement(type:RARROW, text:->) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:1) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IMatchClause + FSharpTokenType+BarTokenElement(type:BAR, text:|) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILocalReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:c) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+RarrowTokenElement(type:RARROW, text:->) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:1) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:SYMBOLIC_OP, text:|>) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:IDENTIFIER, text:ignore) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 12 - Try with expr.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 12 - Try with expr.fs.gold new file mode 100644 index 0000000000..06ad076cfe --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 12 - Try with expr.fs.gold @@ -0,0 +1,9 @@ +module Module + +let a = + t{caret}ry 1 with + | b -> 1 + | c -> 1 + |> ignore + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 13 - Try finally expr.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 13 - Try finally expr.fs new file mode 100644 index 0000000000..2465060c5d --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 13 - Try finally expr.fs @@ -0,0 +1,8 @@ +module Module + +let a = + let {caret}a = + try 1 + finally () + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 13 - Try finally expr.fs.dump.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 13 - Try finally expr.fs.dump.gold new file mode 100644 index 0000000000..05f51620f2 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 13 - Try finally expr.fs.dump.gold @@ -0,0 +1,47 @@ +IFSharpImplFile + INamedModuleDeclaration + FSharpTokenType+ModuleTokenElement(type:MODULE, text:module) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpIdentifierToken(type:IDENTIFIER, text:Module) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + ILetModuleDecl + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ITopBinding + ITopReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IChameleonExpression + ISequentialExpr + IBinaryAppExpr + ITryFinallyExpr + FSharpTokenType+TryTokenElement(type:TRY, text:try) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:1) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+FinallyTokenElement(type:FINALLY, text:finally) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:SYMBOLIC_OP, text:|>) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:IDENTIFIER, text:ignore) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 13 - Try finally expr.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 13 - Try finally expr.fs.gold new file mode 100644 index 0000000000..701c014e17 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 13 - Try finally expr.fs.gold @@ -0,0 +1,8 @@ +module Module + +let a = + t{caret}ry 1 + finally () + |> ignore + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 14 - Unit prefix app.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 14 - Unit prefix app.fs new file mode 100644 index 0000000000..f9224c7df7 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 14 - Unit prefix app.fs @@ -0,0 +1,7 @@ +module Module + +let a = + let {caret}b = + let f x = () + f 0 + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 14 - Unit prefix app.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 14 - Unit prefix app.fs.gold new file mode 100644 index 0000000000..ba5e52c064 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 14 - Unit prefix app.fs.gold @@ -0,0 +1,7 @@ +module Module + +let a = + let {caret}f x = () + f 0 + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 15 - Seq expr with let expr.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 15 - Seq expr with let expr.fs new file mode 100644 index 0000000000..d5ae71f217 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 15 - Seq expr with let expr.fs @@ -0,0 +1,9 @@ +module Module + +let a = + let {caret}b = + () + let a = 3 + 4 + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 15 - Seq expr with let expr.fs.dump.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 15 - Seq expr with let expr.fs.dump.gold new file mode 100644 index 0000000000..ab53050039 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 15 - Seq expr with let expr.fs.dump.gold @@ -0,0 +1,56 @@ +IFSharpImplFile + INamedModuleDeclaration + FSharpTokenType+ModuleTokenElement(type:MODULE, text:module) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpIdentifierToken(type:IDENTIFIER, text:Module) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + ILetModuleDecl + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ITopBinding + ITopReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IChameleonExpression + ISequentialExpr + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILetOrUseExpr + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILocalBinding + ILocalReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:3) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ISequentialExpr + IBinaryAppExpr + ILiteralExpr + FSharpToken(type:INT32, text:4) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:SYMBOLIC_OP, text:|>) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:IDENTIFIER, text:ignore) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 15 - Seq expr with let expr.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 15 - Seq expr with let expr.fs.gold new file mode 100644 index 0000000000..f16fea8a9b --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Multiline 15 - Seq expr with let expr.fs.gold @@ -0,0 +1,8 @@ +module Module + +let a = + {caret}() + let a = 3 + 4 |> ignore + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 01 - No parens.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 01 - No parens.fs new file mode 100644 index 0000000000..41c535cbbd --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 01 - No parens.fs @@ -0,0 +1,5 @@ +module Module + +let a = + let b{caret} = 1 + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 01 - No parens.fs.dump.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 01 - No parens.fs.dump.gold new file mode 100644 index 0000000000..abffacfebd --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 01 - No parens.fs.dump.gold @@ -0,0 +1,36 @@ +IFSharpImplFile + INamedModuleDeclaration + FSharpTokenType+ModuleTokenElement(type:MODULE, text:module) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpIdentifierToken(type:IDENTIFIER, text:Module) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + ILetModuleDecl + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ITopBinding + ITopReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IChameleonExpression + ISequentialExpr + IBinaryAppExpr + ILiteralExpr + FSharpToken(type:INT32, text:1) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:SYMBOLIC_OP, text:|>) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:IDENTIFIER, text:ignore) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 01 - No parens.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 01 - No parens.fs.gold new file mode 100644 index 0000000000..c207177a16 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 01 - No parens.fs.gold @@ -0,0 +1,6 @@ +module Module + +let a = + 1 |>{caret} ignore + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 02 - Parens.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 02 - Parens.fs new file mode 100644 index 0000000000..9ec1e90991 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 02 - Parens.fs @@ -0,0 +1,5 @@ +module Module + +let a = + let b{caret} = true && true + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 02 - Parens.fs.dump.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 02 - Parens.fs.dump.gold new file mode 100644 index 0000000000..e53b06c31d --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 02 - Parens.fs.dump.gold @@ -0,0 +1,46 @@ +IFSharpImplFile + INamedModuleDeclaration + FSharpTokenType+ModuleTokenElement(type:MODULE, text:module) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpIdentifierToken(type:IDENTIFIER, text:Module) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + ILetModuleDecl + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ITopBinding + ITopReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IChameleonExpression + ISequentialExpr + IBinaryAppExpr + IParenExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + IBinaryAppExpr + ILiteralExpr + FSharpTokenType+TrueTokenElement(type:TRUE, text:true) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:AMP_AMP, text:&&) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpTokenType+TrueTokenElement(type:TRUE, text:true) + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:SYMBOLIC_OP, text:|>) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:IDENTIFIER, text:ignore) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 02 - Parens.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 02 - Parens.fs.gold new file mode 100644 index 0000000000..31d9b42d0a --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 02 - Parens.fs.gold @@ -0,0 +1,6 @@ +module Module + +let a = + (t{caret}rue && true) |> ignore + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 03 - If expr.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 03 - If expr.fs new file mode 100644 index 0000000000..61467a7cb0 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 03 - If expr.fs @@ -0,0 +1,5 @@ +module Module + +let a = + let b{caret} = if true then 1 else 2 + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 03 - If expr.fs.dump.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 03 - If expr.fs.dump.gold new file mode 100644 index 0000000000..283b9a6b93 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 03 - If expr.fs.dump.gold @@ -0,0 +1,52 @@ +IFSharpImplFile + INamedModuleDeclaration + FSharpTokenType+ModuleTokenElement(type:MODULE, text:module) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpIdentifierToken(type:IDENTIFIER, text:Module) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + ILetModuleDecl + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ITopBinding + ITopReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IChameleonExpression + ISequentialExpr + IBinaryAppExpr + IParenExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + IIfThenElseExpr + FSharpTokenType+IfTokenElement(type:IF, text:if) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpTokenType+TrueTokenElement(type:TRUE, text:true) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+ThenTokenElement(type:THEN, text:then) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:1) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+ElseTokenElement(type:ELSE, text:else) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:2) + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:SYMBOLIC_OP, text:|>) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:IDENTIFIER, text:ignore) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 03 - If expr.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 03 - If expr.fs.gold new file mode 100644 index 0000000000..ca573645d3 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 03 - If expr.fs.gold @@ -0,0 +1,6 @@ +module Module + +let a = + ({caret}if true then 1 else 2) |> ignore + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 04 - Match expr.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 04 - Match expr.fs new file mode 100644 index 0000000000..d3eca82933 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 04 - Match expr.fs @@ -0,0 +1,5 @@ +module Module + +let a = + let b{caret} = match () with | a -> 1 | b -> 2 + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 04 - Match expr.fs.dump.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 04 - Match expr.fs.dump.gold new file mode 100644 index 0000000000..64df073f96 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 04 - Match expr.fs.dump.gold @@ -0,0 +1,69 @@ +IFSharpImplFile + INamedModuleDeclaration + FSharpTokenType+ModuleTokenElement(type:MODULE, text:module) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpIdentifierToken(type:IDENTIFIER, text:Module) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + ILetModuleDecl + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ITopBinding + ITopReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IChameleonExpression + ISequentialExpr + IBinaryAppExpr + IParenExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + IMatchExpr + FSharpTokenType+MatchTokenElement(type:MATCH, text:match) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+WithTokenElement(type:WITH, text:with) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IMatchClause + FSharpTokenType+BarTokenElement(type:BAR, text:|) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILocalReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+RarrowTokenElement(type:RARROW, text:->) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:1) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IMatchClause + FSharpTokenType+BarTokenElement(type:BAR, text:|) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILocalReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:b) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+RarrowTokenElement(type:RARROW, text:->) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:2) + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:SYMBOLIC_OP, text:|>) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:IDENTIFIER, text:ignore) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 04 - Match expr.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 04 - Match expr.fs.gold new file mode 100644 index 0000000000..894e3e3d9d --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 04 - Match expr.fs.gold @@ -0,0 +1,6 @@ +module Module + +let a = + ({caret}match () with | a -> 1 | b -> 2) |> ignore + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 05 - Unit.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 05 - Unit.fs new file mode 100644 index 0000000000..73ec70d761 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 05 - Unit.fs @@ -0,0 +1,5 @@ +module Module + +let a = + let b{caret} = () + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 05 - Unit.fs.dump.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 05 - Unit.fs.dump.gold new file mode 100644 index 0000000000..c879c75e76 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 05 - Unit.fs.dump.gold @@ -0,0 +1,30 @@ +IFSharpImplFile + INamedModuleDeclaration + FSharpTokenType+ModuleTokenElement(type:MODULE, text:module) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpIdentifierToken(type:IDENTIFIER, text:Module) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + ILetModuleDecl + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ITopBinding + ITopReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IChameleonExpression + ISequentialExpr + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 05 - Unit.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 05 - Unit.fs.gold new file mode 100644 index 0000000000..b393690d55 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 05 - Unit.fs.gold @@ -0,0 +1,6 @@ +module Module + +let a = + {caret}() + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 06 - Lazy.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 06 - Lazy.fs new file mode 100644 index 0000000000..b69f248f79 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 06 - Lazy.fs @@ -0,0 +1,5 @@ +module Module + +let a = + let b{caret} = lazy 1 + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 06 - Lazy.fs.dump.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 06 - Lazy.fs.dump.gold new file mode 100644 index 0000000000..32345f5f6a --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 06 - Lazy.fs.dump.gold @@ -0,0 +1,39 @@ +IFSharpImplFile + INamedModuleDeclaration + FSharpTokenType+ModuleTokenElement(type:MODULE, text:module) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpIdentifierToken(type:IDENTIFIER, text:Module) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + ILetModuleDecl + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ITopBinding + ITopReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IChameleonExpression + ISequentialExpr + IBinaryAppExpr + ILazyExpr + FSharpTokenType+LazyTokenElement(type:LAZY, text:lazy) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpToken(type:INT32, text:1) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:SYMBOLIC_OP, text:|>) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IReferenceExpr + FSharpIdentifierToken(type:IDENTIFIER, text:ignore) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 06 - Lazy.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 06 - Lazy.fs.gold new file mode 100644 index 0000000000..e492b39f90 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 06 - Lazy.fs.gold @@ -0,0 +1,6 @@ +module Module + +let a = + l{caret}azy 1 |> ignore + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 07 - Comment.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 07 - Comment.fs new file mode 100644 index 0000000000..384943e13e --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 07 - Comment.fs @@ -0,0 +1,5 @@ +module Module + +let a = + let b{caret} = 1 // comment + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 07 - Comment.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 07 - Comment.fs.gold new file mode 100644 index 0000000000..b724bb6eb8 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 07 - Comment.fs.gold @@ -0,0 +1,5 @@ +module Module + +let a = + {caret}1 |> ignore // comment + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 08 - Ignore.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 08 - Ignore.fs new file mode 100644 index 0000000000..357457b43e --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 08 - Ignore.fs @@ -0,0 +1,5 @@ +module Module + +let a = + let b{caret} = 1 |> ignore + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 08 - Ignore.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 08 - Ignore.fs.gold new file mode 100644 index 0000000000..c207177a16 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 08 - Ignore.fs.gold @@ -0,0 +1,6 @@ +module Module + +let a = + 1 |>{caret} ignore + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 09 - Do expr.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 09 - Do expr.fs new file mode 100644 index 0000000000..6340492b72 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 09 - Do expr.fs @@ -0,0 +1,5 @@ +module Module + +let a = + let b{caret} = do () + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 09 - Do expr.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 09 - Do expr.fs.gold new file mode 100644 index 0000000000..b393690d55 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 09 - Do expr.fs.gold @@ -0,0 +1,6 @@ +module Module + +let a = + {caret}() + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 10 - Assert expr.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 10 - Assert expr.fs new file mode 100644 index 0000000000..e6f9d7cf8d --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 10 - Assert expr.fs @@ -0,0 +1,5 @@ +module Module + +let a = + let b{caret} = assert true + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 10 - Assert expr.fs.dump.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 10 - Assert expr.fs.dump.gold new file mode 100644 index 0000000000..872656bcd0 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 10 - Assert expr.fs.dump.gold @@ -0,0 +1,32 @@ +IFSharpImplFile + INamedModuleDeclaration + FSharpTokenType+ModuleTokenElement(type:MODULE, text:module) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpIdentifierToken(type:IDENTIFIER, text:Module) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + ILetModuleDecl + FSharpTokenType+LetTokenElement(type:LET, text:let) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ITopBinding + ITopReferencePat + IExpressionReferenceName + FSharpIdentifierToken(type:IDENTIFIER, text:a) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + FSharpTokenType+EqualsTokenElement(type:EQUALS, text:=) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IChameleonExpression + ISequentialExpr + IAssertExpr + FSharpTokenType+AssertTokenElement(type:ASSERT, text:assert) + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + ILiteralExpr + FSharpTokenType+TrueTokenElement(type:TRUE, text:true) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + NewLine(type:NEW_LINE, text:\n) spaces:"\n" + Whitespace(type:WHITE_SPACE, text: ) spaces:" " + IUnitExpr + FSharpTokenType+LparenTokenElement(type:LPAREN, text:() + FSharpTokenType+RparenTokenElement(type:RPAREN, text:)) + NewLine(type:NEW_LINE, text:\n) spaces:"\n" diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 10 - Assert expr.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 10 - Assert expr.fs.gold new file mode 100644 index 0000000000..3a49b7eccc --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 10 - Assert expr.fs.gold @@ -0,0 +1,6 @@ +module Module + +let a = + {caret}assert true + + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 11 - Function.fs b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 11 - Function.fs new file mode 100644 index 0000000000..7c9c8b36b7 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 11 - Function.fs @@ -0,0 +1,5 @@ +module Module + +let a = + let f{caret} x = 1 + () diff --git a/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 11 - Function.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 11 - Function.fs.gold new file mode 100644 index 0000000000..75868fbeaa --- /dev/null +++ b/ReSharper.FSharp/test/data/features/quickFixes/ignoreUnusedBindingExpression/Single line 11 - Function.fs.gold @@ -0,0 +1,18 @@ +module Module + +let a = + let |f|(0) |x|(1) = 1 + () + +------------------------------------------------ +0: The value 'f' is unused +QUICKFIXES: +Remove unused function +1: The value 'x' is unused +QUICKFIXES: +Replace with '_' +--Replace unused values with '_' in binding patterns +--Replace unused values with '_' in file +--Replace unused values with '_' in project +--Replace unused values with '_' in solution +Rename to '_x' diff --git a/ReSharper.FSharp/test/data/features/quickFixes/removeUnusedLocalBinding/Text - Value 01.fs.gold b/ReSharper.FSharp/test/data/features/quickFixes/removeUnusedLocalBinding/Text - Value 01.fs.gold index c92f5fabc8..941bbb9daf 100644 --- a/ReSharper.FSharp/test/data/features/quickFixes/removeUnusedLocalBinding/Text - Value 01.fs.gold +++ b/ReSharper.FSharp/test/data/features/quickFixes/removeUnusedLocalBinding/Text - Value 01.fs.gold @@ -13,3 +13,4 @@ Replace with '_' --Replace unused values with '_' in solution Rename to '_x' Remove unused value +Ignore expression diff --git a/ReSharper.FSharp/test/src/FSharp.Tests/FSharp.Tests.fsproj b/ReSharper.FSharp/test/src/FSharp.Tests/FSharp.Tests.fsproj index afe8617a67..cb36cda22d 100644 --- a/ReSharper.FSharp/test/src/FSharp.Tests/FSharp.Tests.fsproj +++ b/ReSharper.FSharp/test/src/FSharp.Tests/FSharp.Tests.fsproj @@ -78,6 +78,7 @@ + diff --git a/ReSharper.FSharp/test/src/FSharp.Tests/QuickFixes/IgnoreUnusedBindingExpressionTest.fs b/ReSharper.FSharp/test/src/FSharp.Tests/QuickFixes/IgnoreUnusedBindingExpressionTest.fs new file mode 100644 index 0000000000..689258e33d --- /dev/null +++ b/ReSharper.FSharp/test/src/FSharp.Tests/QuickFixes/IgnoreUnusedBindingExpressionTest.fs @@ -0,0 +1,51 @@ +namespace JetBrains.ReSharper.Plugins.FSharp.Tests.Features + +open JetBrains.ProjectModel +open JetBrains.ReSharper.Plugins.FSharp.Psi.Features.Daemon.QuickFixes +open JetBrains.ReSharper.Plugins.FSharp.Tests +open JetBrains.ReSharper.Psi +open JetBrains.ReSharper.Psi.ExtensionsAPI +open NUnit.Framework + +[] +type IgnoreUnusedBindingExpressionTest() = + inherit FSharpQuickFixTestBase() + + override x.RelativeTestDataPath = "features/quickFixes/ignoreUnusedBindingExpression" + + override x.DoTest(lifetime, project) = + base.DoTest(lifetime, project) + + for projectFile in project.GetAllProjectFiles() do + let file = projectFile.GetPrimaryPsiFile() + x.ExecuteWithSpecifiedGold( + x.GetTestDataFilePath2(x.TestName + ".dump.gold"), + fun writer -> DebugUtil.DumpPsi(writer, file)) |> ignore + + [] member x.``Single line 01 - No parens``() = x.DoNamedTest() + [] member x.``Single line 02 - Parens``() = x.DoNamedTest() + [] member x.``Single line 03 - If expr``() = x.DoNamedTest() + [] member x.``Single line 04 - Match expr``() = x.DoNamedTest() + [] member x.``Single line 05 - Unit``() = x.DoNamedTest() + [] member x.``Single line 06 - Lazy``() = x.DoNamedTest() + [] member x.``Single line 07 - Comment``() = x.DoNamedTest() + [] member x.``Single line 08 - Ignore``() = x.DoNamedTest() + [] member x.``Single line 09 - Do expr``() = x.DoNamedTest() + [] member x.``Single line 10 - Assert expr``() = x.DoNamedTest() + [] member x.``Single line 11 - Function``() = x.DoNamedTest() + + [] member x.``Multiline 01 - Seq expr``() = x.DoNamedTest() + [] member x.``Multiline 02 - Nested let``() = x.DoNamedTest() + [] member x.``Multiline 03 - If expr``() = x.DoNamedTest() + [] member x.``Multiline 04 - Match expr``() = x.DoNamedTest() + [] member x.``Multiline 05 - Match expr - Deindented last clause``() = x.DoNamedTest() + [] member x.``Multiline 06 - If expr - Deindented else expr``() = x.DoNamedTest() + [] member x.``Multiline 07 - Paren expr``() = x.DoNamedTest() + [] member x.``Multiline 08 - Unit``() = x.DoNamedTest() + [] member x.``Multiline 09 - Lazy``() = x.DoNamedTest() + [] member x.``Multiline 10 - Match lambda expr``() = x.DoNamedTest() + [] member x.``Multiline 11 - Lambda expr``() = x.DoNamedTest() + [] member x.``Multiline 12 - Try with expr``() = x.DoNamedTest() + [] member x.``Multiline 13 - Try finally expr``() = x.DoNamedTest() + [] member x.``Multiline 14 - Unit prefix app``() = x.DoNamedTest() + [] member x.``Multiline 15 - Seq expr with let expr``() = x.DoNamedTest()