
#13850: Incorrect function signature causes the impossible to happen -------------------------------------+------------------------------------- Reporter: erikd | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 Keywords: | Operating System: Linux Architecture: | Type of failure: Compile-time Unknown/Multiple | crash or panic Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- I made a mistake in my function signature: {{{
cat wibble.hs ecase :: Either a b -> (a -> c) (b -> c) -> c ecase (Left a) f _ = f a ecase (Right b) _ g = g b
ghci wibble.hs GHCi, version 8.2.0.20170507: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/erikd/.ghci [1 of 1] Compiling Main ( wibble.hs, interpreted ) ghc: panic! (the 'impossible' happened) (GHC version 8.2.0.20170507 for x86_64-unknown-linux): repSplitAppTys a_a1pA[sk:1] c_a1pC[sk:1] [] Call stack: CallStack (from HasCallStack): prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1134:58 in ghc:Outputable callStackDoc, called at compiler/utils/Outputable.hs:1138:37 in ghc:Outputable pprPanic, called at compiler/types/Type.hs:808:9 in ghc:Type }}}
GHC 8.02 correctly reports an error: {{{ GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/erikd/.ghci [1 of 1] Compiling Main ( wibble.hs, interpreted ) wibble.hs:1:24: error: • Expecting one fewer argument to ‘a -> c’ Expected kind ‘* -> *’, but ‘a -> c’ has kind ‘*’ • In the type signature: ecase :: Either a b -> (a -> c) (b -> c) -> c }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13850 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler