Skip to content

Commit 41e9595

Browse files
authored
Fix noisy diagnostic on PR's relating to f# nullable check (#1967)
1 parent 7c7c01e commit 41e9595

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

tests/authoring/Applicability/AppliesToFrontMatter.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ applies_to:
2424
"""
2525
[<Fact>]
2626
let ``apply matches expected`` () =
27-
markdown |> appliesTo (Unchecked.defaultof<ApplicableTo>)
27+
markdown |> appliesTo Unchecked.defaultof<ApplicableTo>
2828

2929
type ``apply default to top level arguments`` () =
3030
static let markdown = frontMatter """
@@ -212,7 +212,7 @@ applies_to:
212212
"""
213213
[<Fact>]
214214
let ``does not render label`` () =
215-
markdown |> appliesTo (Unchecked.defaultof<ApplicableTo>)
215+
markdown |> appliesTo Unchecked.defaultof<ApplicableTo>
216216

217217
type ``parses applies_to with multiple categories in any order`` () =
218218
static let markdown = frontMatter """

tests/authoring/Framework/MarkdownDocumentAssertions.fs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,19 @@ module MarkdownDocumentAssertions =
2727
unsupportedBlocks
2828

2929
[<DebuggerStepThrough>]
30-
let appliesTo (expectedAvailability: ApplicableTo) (actual: Lazy<GeneratorResults>) =
30+
let appliesTo (expectedAvailability: ApplicableTo | null) (actual: Lazy<GeneratorResults>) =
3131
let actual = actual.Value
3232
let result = actual.MarkdownResults |> Seq.find (fun r -> r.File.RelativePath = "index.md")
3333
let matter = result.File.YamlFrontMatter
3434
match matter with
3535
| NonNull m ->
36-
if expectedAvailability <> null then
37-
m.AppliesTo.Diagnostics <- expectedAvailability.Diagnostics
36+
match expectedAvailability with
37+
| NonNull a -> m.AppliesTo.Diagnostics <- a.Diagnostics
38+
| _ -> ()
39+
3840
let apply = m.AppliesTo
3941
test <@ apply = expectedAvailability @>
40-
| _ -> failwithf "%s has no yamlfront matter" result.File.RelativePath
42+
| _ -> failwithf $"%s{result.File.RelativePath} has no yamlfront matter"
4143

4244

4345
[<DebuggerStepThrough>]

0 commit comments

Comments
 (0)