File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
tests/FSharpLint.Core.Tests/Rules/Hints Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 411411 " false <> a ===> a" ,
412412 " if a then true else false ===> a" ,
413413 " if a then false else true ===> not a" ,
414+ " if x then y else y ===> y" ,
414415 " not (not x) ===> x" ,
415416
416417 " (fst x, snd x) ===> x" ,
Original file line number Diff line number Diff line change @@ -964,3 +964,21 @@ let x y =
964964 this.SetConfig([ " (List.singleton x) @ y ===> x :: y" ])
965965 this.Parse( source)
966966 Assert.AreEqual( expected, this.ApplyQuickFix source)
967+
968+ [<Test>]
969+ member this. ``Result same regardless of condition can remove conditional block`` () =
970+ let source = """
971+ if (someCondition a b) then
972+ res
973+ else
974+ res
975+ """
976+
977+ let expected = """
978+ res
979+ """
980+
981+ this.SetConfig([ " if x then y else y ===> y" ])
982+ this.Parse( source)
983+ Assert.AreEqual( expected, this.ApplyQuickFix source)
984+
You can’t perform that action at this time.
0 commit comments