Open smoothdeveloper opened 4 years ago
Interesting. I just ran your test in debug session with the compiler and the warning is displayed before the hash-directive is even parsed. Something odd is going on here.
Note, related: #17209.
EDIT: it took me a moment to realize, but this appears to be warning-number specific. I.e., if the warning is thrown inside the lexer, it is not suppressed. However, if it occurs at a later state, it is properly suppressed.
#nowarn "1104"
#nowarn "25"
module Foo =
let someFunc() =
match 42 with // warning 25 is suppressed
| 42 -> "yes"
| 43 -> "no"
let ``@nowarn`` = 1 // warning 1104 is not (because raised in lexer)
with nowarn.fsx containing the following:
trying to invoke it with
getting
If I try to do the same by pasting the contents in interactive session, it hides the warning.
The work around is to use
--nowarn
when invokingfsi
.Would it make sense to also hide the warnings in the first case?