File tree Expand file tree Collapse file tree
src/FSharpLint.Core/Rules/Conventions
tests/FSharpLint.Core.Tests/Rules/Conventions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ let private partialFunctionIdentifiers =
5757 ( " Seq.reduce" , Function " Seq.fold" )
5858 ( " Seq.reduceBack" , Function " Seq.foldBack" )
5959 ( " Seq.pick" , Function " Seq.tryPick" )
60+ ( " Seq.cast" , Function " Seq.choose tryUnbox" )
6061
6162 // List
6263 ( " List.exactlyOne" , Function " List.tryExactlyOne" )
Original file line number Diff line number Diff line change @@ -171,6 +171,16 @@ if foo.Head 1 then
171171 Assert.IsTrue this.ErrorsExist
172172 this.AssertErrorWithMessageExists( " Consider using 'List.tryHead' instead of partial function/method 'List.Head'." )
173173
174+ [<Test>]
175+ member this. ``Error for Seq.cast`` () =
176+ this.Parse """
177+ let foo = [ box "Hello"; box 42 ]
178+ let bar = Seq.cast<string> foo
179+ """
180+
181+ Assert.IsTrue this.ErrorsExist
182+ this.AssertErrorWithMessageExists( " Consider using 'Seq.choose tryUnbox' instead of partial function/method 'Seq.cast'." )
183+
174184 [<Test>]
175185 member this. ``Regression found when parsing Console / Program_fs`` () =
176186 this.Parse """
You can’t perform that action at this time.
0 commit comments