
#12489: undefined in view pattern inside pattern synonym causes GHC to panic -------------------------------------+------------------------------------- Reporter: pkmx | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Compile-time Unknown/Multiple | crash Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The following: {{{#!hs {-# LANGUAGE PatternSynonyms, ViewPatterns #-} pattern P :: a -> b pattern P a <- (undefined -> a) }}} causes GHC HEAD and 8.0.1 to panic: {{{ ghc: panic! (the 'impossible' happened) (GHC version 8.1.20160813 for x86_64-unknown-linux): StgCmmEnv: variable not found }}} Removing the pattern signature or moving `undefined` behind another name work however: {{{#!hs {-# LANGUAGE PatternSynonyms, ViewPatterns #-} bottom :: a bottom = undefined pattern P :: a -> b pattern P a <- (bottom -> a) -- OK! -- No type signature pattern P' a <- (undefined -> a) -- OK! }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12489 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler