Skip to content

Commit

Permalink
Core.Tests: add NoPartialFunctions regression test
Browse files Browse the repository at this point in the history
Added regression test for NoPartialFunctions for case when
`Value` instance method is called on non value that is not
Option, but another Option value exists in scope.
  • Loading branch information
webwarrior-ws committed Dec 27, 2023
1 parent 791df60 commit 86c56fc
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@ module Program =
Assert.IsTrue(this.ErrorExistsAt(7, 34))
this.AssertErrorWithMessageExists("Consider using pattern matching instead of partial function/method 'Option.Value'.")

[<Test>]
member this.``No error for calling Value on ref type (regression)``() =
this.Parse("""
namespace Foo
module Program =
let foo = None
let bar = ref 0
let printFoo() =
System.Console.WriteLine (bar.Value.ToString())""")

Assert.IsTrue this.NoErrorsExist

[<Test>]
member this.``Error for Option.Value (List.tryHead test case)``() =
this.Parse("""
Expand Down

0 comments on commit 86c56fc

Please sign in to comment.