Is it possible to disable compiler warnings for specific lines?
In C#, this works:
[Obsolete]
class Old { }
#pragma warning disable 612
var oldWithoutWarning = new Old();
#pragma warning restore 612
var oldWithWarning = new Old();
This would be very useful for disabling incomplete pattern matches warnings, especially when a function accepts a particular case of a DU.
No, the warnings are turned off per-file (or possibly ‘from here to the bottom of the file’) when using
#nowarn. (Or per compilation/project when using project properties /--nowarncommand-line.)