[GHC] #14552: GHC panic on pattern synonym

GHC ghc-devs at haskell.org
Sat Dec 2 00:43:22 UTC 2017


#14552: GHC panic on pattern synonym
-------------------------------------+-------------------------------------
           Reporter:  Iceland_jack   |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.3
           Keywords:                 |  Operating System:  Unknown/Multiple
  PatternSynonyms, TypeInType,       |
  ViewPatterns                       |
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 {{{#!hs
 {-# Language RankNTypes, ViewPatterns, PatternSynonyms, TypeOperators,
 KindSignatures, PolyKinds, DataKinds, TypeFamilies, TypeInType, GADTs #-}

 import Data.Kind

 data family Sing a

 type a --> b = (a, b) -> Type

 type family (@@) (f::a --> b) (x::a) :: b

 data Proxy a = Proxy

 newtype Limit' :: (k --> Type) -> Type where
   Limit' :: (forall xx. Proxy xx -> f@@xx) -> Limit' f

 data Exp :: [Type] -> Type -> Type where
   TLam' :: Proxy f
         -> (forall aa. Proxy aa -> Exp xs (f @@ aa))
         -> Exp xs (Limit' f)

 pattern FOO f <- TLam' Proxy (($ Proxy) -> f)
 }}}

 --->

 {{{
 $ ghci -ignore-dot-ghci 119-bug.hs
 GHCi, version 8.3.20171122: http://www.haskell.org/ghc/  :? for help
 [1 of 1] Compiling Main             ( 119-bug.hs, interpreted )
 ghc-stage2: panic! (the 'impossible' happened)
   (GHC version 8.3.20171122 for x86_64-unknown-linux):
         ASSERT failed!
   in_scope InScope {a_a1Mh b_a1Mi rep_a1MB r_a1MC}
   tenv [a1MC :-> r_a1MC]
   cenv []
   tys [k_a1Mj[ssk:3]]
   cos []
   needInScope [a1Mj :-> k_a1Mj[ssk:3]]
   Call stack:
       CallStack (from HasCallStack):
         callStackDoc, called at compiler/utils/Outputable.hs:1205:22 in
 ghc:Outputable
         assertPprPanic, called at compiler/types/TyCoRep.hs:2136:51 in
 ghc:TyCoRep
         checkValidSubst, called at compiler/types/TyCoRep.hs:2159:29 in
 ghc:TyCoRep
         substTy, called at compiler/types/TyCoRep.hs:2364:41 in
 ghc:TyCoRep
         substTyVarBndr, called at compiler/coreSyn/CoreSubst.hs:571:10 in
 ghc:CoreSubst
   Call stack:
       CallStack (from HasCallStack):
         callStackDoc, called at compiler/utils/Outputable.hs:1147:37 in
 ghc:Outputable
         pprPanic, called at compiler/utils/Outputable.hs:1203:5 in
 ghc:Outputable
         assertPprPanic, called at compiler/types/TyCoRep.hs:2136:51 in
 ghc:TyCoRep
         checkValidSubst, called at compiler/types/TyCoRep.hs:2159:29 in
 ghc:TyCoRep
         substTy, called at compiler/types/TyCoRep.hs:2364:41 in
 ghc:TyCoRep
         substTyVarBndr, called at compiler/coreSyn/CoreSubst.hs:571:10 in
 ghc:CoreSubst

 Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

 >
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14552>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list