Compile-time constraint for complete pattern match

ぐ巨炮叔叔 提交于 2019-11-30 07:35:08

问题


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 as compile-time errors rather than warnings + run-time exceptions. Does anyone know what the warning number for this is? Specifically, this relates to compiled .fs / interactive FSI .fsx REPL interaction.

The warning:

Incomplete pattern matches on this expression. For example, the value 'LaLaLa (_)' may indicate a case not covered by the pattern(s).   

How to customise:

see "--warnaserror[+|-] []"

ref: https://msdn.microsoft.com/en-us/library/dd233171(v=vs.140).aspx


回答1:


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).



来源:https://stackoverflow.com/questions/30538390/compile-time-constraint-for-complete-pattern-match

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!