[GHC] #7855: Use optimizer for more information about incomplete pattern matches

#7855: Use optimizer for more information about incomplete pattern matches -----------------------------+---------------------------------------------- Reporter: ezyang | Owner: Type: feature request | Status: new Priority: normal | Component: Compiler (Type checker) Version: 7.7 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- This mail gave me an idea that was too cute not to write down (though I don't expect it to be implemented any time soon), http://www.haskell.org/pipermail/haskell-cafe/2013-April/107775.html The observation is that the typechecking phase is not necessarily the best point in time to check for pattern coverage exhaustiveness: if we tentatively stub in a default case with an error, and after optimization passes, we find that this case has been eliminated, then in fact there was no pattern coverage incompleteness. So, the strategy would be to defer reporting certain coverage failures until we can do actually check if there are any problems later. Obviously if no predicates or view patterns (or similar things) are involved, then there is no point in attempting to defer it, but otherwise this could help reduce warnings in code that make heavy use of these features. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7855 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7855: Use optimizer for more information about incomplete pattern matches ----------------------------------------+----------------------------------- Reporter: ezyang | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler (Type checker) | Version: 7.7 Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ----------------------------------------+----------------------------------- Changes (by igloo): * difficulty: => Unknown Comment: This sounds fragile to me. e.g. whether this: {{{ module M (f) where f :: Int -> () f x = g True g :: Bool -> () g True = () }}} gives a warning would depend on whether g gets inlined and discarded. This could mean that a small change to the source could make dozens of warnings appear in seemingly unrelated functions. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7855#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC