diff --git a/src/FSharpLint.Core/fsharplint.json b/src/FSharpLint.Core/fsharplint.json index 296ec9811..d005ee763 100644 --- a/src/FSharpLint.Core/fsharplint.json +++ b/src/FSharpLint.Core/fsharplint.json @@ -431,7 +431,6 @@ "false <> a ===> a", "if a then true else false ===> a", "if a then false else true ===> not a", - "if x then y else y ===> y", "not (not x) ===> x", "(fst x, snd x) ===> x", diff --git a/tests/FSharpLint.Core.Tests/Rules/Hints/HintMatcher.fs b/tests/FSharpLint.Core.Tests/Rules/Hints/HintMatcher.fs index 447f4e0be..839175b86 100644 --- a/tests/FSharpLint.Core.Tests/Rules/Hints/HintMatcher.fs +++ b/tests/FSharpLint.Core.Tests/Rules/Hints/HintMatcher.fs @@ -1017,3 +1017,31 @@ let foo = """ Assert.That this.NoErrorsExist + + [] + [] + member this.``Records with different data (not a literal constant) should be treated as diffrerent``() = + this.SetConfig(["if x then y else y ===> y"]) + + this.Parse """ +type Foo = + | Bar + | Baz + +type Record = + { + Foo: Foo + } + +let foo = + if 2 = 2 then + { + Foo = Bar + } + else + { + Foo = Baz + } +""" + + Assert.That this.NoErrorsExist