Compile-time constraint for complete pattern match

前端 未结 2 1018
耶瑟儿~
耶瑟儿~ 2020-12-17 01:30

I\'m looking for the warning number for incomplete pattern matches. Anyone know what it is?

More fully, I want to make FSC.EXE return incomplete pattern matches

相关标签:
2条回答
  • 2020-12-17 01:47

    use --warnaserror+:25

    To know which one it was I simply produced myself the warning using let f (Some x) = x which gaves me warning FS0025: Incomplete pattern matches on this expression. For e xample, the value 'None' may indicate a case not covered by the pattern(s).

    0 讨论(0)
  • 2020-12-17 02:13

    In a .Net Standard F# project you can also achieve this by adding an element to your fsproj file like so:

    <PropertyGroup>
    <TargetFramework>netstandard2.1</TargetFramework>
    <WarningsAsErrors>FS0025</WarningsAsErrors>
    </PropertyGroup>
    
    0 讨论(0)
提交回复
热议问题