Open vasily-kirichenko opened 5 years ago
Seems to be a duplicate of https://github.com/dotnet/fsharp/issues/1281#issuecomment-229061892. It looks like a thing worth fixing some day, though.
For the above example I agree it would be good to fix.
That said, it will be a game of whack-a-mole - partial active patterns do impact on exhaustivity checking and always will, there will always be cases where the programmer feels that warnings should be given but the compiler doesn't give them.
warnOnUnused
is specifically disabled when there is a "problematic" clause in order to avoid out-of-control code expansion. Is it the plan to use some heuristic to decide whether the pattern match as a whole is simple enough to go down the warn/meticulous route anyway? Maybe a pattern match complexity score, computed by some sort of a weighted multiplication of the number of clauses, when
guards, disjunctions, subpatterns, etc.?
results with proper warnings:
However, if an active pattern is used in match expression, there are no warnings at all: