Skip to content

Commit

Permalink
Merge PR fsprojects#675 from webwarrior-ws/pipe-operator-range
Browse files Browse the repository at this point in the history
AvoidSinglePipeOperator: fix range.
  • Loading branch information
knocte authored Jan 9, 2024
2 parents 9d29f9e + ee09316 commit 354a45a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ let runner (args: AstNodeRuleParams) =
match synExpr with
| SynExpr.App(_exprAtomicFlag, _isInfix, funcExpr, _argExpr, _range) ->
match funcExpr with
| SynExpr.App(_exprAtomicFlag, _isInfix, funcExpr, argExpr, range) ->
| SynExpr.App(_exprAtomicFlag, _isInfix, funcExpr, argExpr, _range) ->
match funcExpr with
| ExpressionUtilities.Identifier([ ident ], _) ->
if ident.idText = "op_PipeRight" then
match argExpr with
| SynExpr.App(_exprAtomicFlag, _isInfix, _funcExpr, _argExpr, _range) ->
Array.empty
| _ ->
errors range
errors ident.idRange
else
Array.empty
| _ ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let someFunc someParam =
|> someOtherFunc
"""

Assert.IsTrue this.ErrorsExist
Assert.IsTrue <| this.ErrorExistsAt(4, 4)

[<Test>]
member this.``Use pipe operator twice``() =
Expand All @@ -38,7 +38,7 @@ module MyModule =
|> someOtherFunc
"""

Assert.IsTrue this.ErrorsExist
Assert.IsTrue <| this.ErrorExistsAt(5, 8)

[<Test>]
member this.``Use pipe operator twice in module``() =
Expand All @@ -61,7 +61,7 @@ type CustomerName(firstName) =
|> someOtherFunc
"""

Assert.IsTrue this.ErrorsExist
Assert.IsTrue <| this.ErrorExistsAt(5, 8)

[<Test>]
member this.``Use pipe operator twice in type``() =
Expand Down

0 comments on commit 354a45a

Please sign in to comment.