#8368: Panic in rejigConRes -------------------------------------+------------------------------------ Reporter: goldfire | Owner: goldfire Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by Krzysztof Gogolewski <krz.gogolewski@…>): In [changeset:0c7d2d7507b9e4dca24c159c0bfcce9de7b233c4/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="0c7d2d7507b9e4dca24c159c0bfcce9de7b233c4" Fix Trac #8368. Two different fixes were necessary here. First, we need to fail eagerly in kcConDecl, to prevent the return-type error in tcConDecl from firing twice. (This wasn't caught earlier because of the eager fail in the datatype kind-checking code -- which isn't used for data instances!) We also must check again in tcDataFamInstDecl, because it's possible for a data instance return type to have the right head but the wrong body (i.e., doesn't conform to the data instance type patterns). This check is only possible *after* desugaring from HsType to Type, so it can't be done in tcConRes with the first check. This is documented in a comment at check_valid_data_con, a local function within tcDataFamInstDecl. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8368#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler