Skip to content

Commit 76ac4f0

Browse files
committed
Hints: morph hint to avoid issue
Workaround recently added hint in a related way to FL0089, in order to avoid issue found in: 6fa06f1
1 parent 6fa06f1 commit 76ac4f0

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

src/FSharpLint.Core/fsharplint.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@
451451
"pattern: x::[] ===> [x]",
452452

453453
"x @ [] ===> x",
454-
"[x] @ y ===> x::y",
454+
"(List.singleton x) @ y ===> x :: y",
455455

456456
"List.isEmpty [] ===> true",
457457
"Array.isEmpty [||] ===> true",

tests/FSharpLint.Core.Tests/Rules/Hints/HintMatcher.fs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -957,21 +957,10 @@ let x y =
957957

958958
[<Test>]
959959
member this.``List append of singleton item can be replaced with :: operator``() =
960-
let source = """[head] @ tail"""
960+
let source = """(List.singleton head) @ tail"""
961961

962962
let expected = """head :: tail"""
963963

964-
this.SetConfig(["[x] @ y ===> x::y"])
964+
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.``Demonstrate issue with recently added hint``() =
970-
let source = """[a;b] @ tail"""
971-
972-
this.SetConfig(["[x] @ y ===> x::y"])
973-
this.Parse(source)
974-
975-
// invalid!
976-
Assert.AreNotEqual("a;b :: tail", this.ApplyQuickFix source)
977-

0 commit comments

Comments
 (0)