Opened 10 days ago

#14552 new bug

GHC panic on pattern synonym

Reported by: Iceland_jack Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.3
Keywords: PatternSynonyms, TypeInType, ViewPatterns Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

{-# 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

> 

Change History (0)

Note: See TracTickets for help on using tickets.