Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,251
    • Issues 5,251
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 576
    • Merge requests 576
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #14552
Closed
Open
Issue created Dec 02, 2017 by Icelandjack@IcelandjackReporter

GHC panic on pattern synonym

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

> 
Trac metadata
Trac field Value
Version 8.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
b = (a, b) -> Type\r\n\r\ntype family (@@) (f::a --> b) (x::a) :: b\r\n\r\ndata Proxy a = Proxy\r\n\r\nnewtype Limit' :: (k --> Type) -> Type where\r\n Limit' :: (forall xx. Proxy xx -> f@@xx) -> Limit' f\r\n\r\ndata Exp :: [Type] -> Type -> Type where\r\n TLam' :: Proxy f\r\n -> (forall aa. Proxy aa -> Exp xs (f @@ aa))\r\n -> Exp xs (Limit' f)\r\n\r\npattern FOO f <- TLam' Proxy (($ Proxy) -> f)\r\n}}}\r\n\r\n--->\r\n\r\n{{{\r\n$ ghci -ignore-dot-ghci 119-bug.hs \r\nGHCi, version 8.3.20171122: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling Main ( 119-bug.hs, interpreted )\r\nghc-stage2: panic! (the 'impossible' happened)\r\n (GHC version 8.3.20171122 for x86_64-unknown-linux):\r\n\tASSERT failed!\r\n in_scope InScope {a_a1Mh b_a1Mi rep_a1MB r_a1MC}\r\n tenv [a1MC :-> r_a1MC]\r\n cenv []\r\n tys [k_a1Mj[ssk:3]]\r\n cos []\r\n needInScope [a1Mj :-> k_a1Mj[ssk:3]]\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler/utils/Outputable.hs:1205:22 in ghc:Outputable\r\n assertPprPanic, called at compiler/types/TyCoRep.hs:2136:51 in ghc:TyCoRep\r\n checkValidSubst, called at compiler/types/TyCoRep.hs:2159:29 in ghc:TyCoRep\r\n substTy, called at compiler/types/TyCoRep.hs:2364:41 in ghc:TyCoRep\r\n substTyVarBndr, called at compiler/coreSyn/CoreSubst.hs:571:10 in ghc:CoreSubst\r\n Call stack:\r\n CallStack (from HasCallStack):\r\n callStackDoc, called at compiler/utils/Outputable.hs:1147:37 in ghc:Outputable\r\n pprPanic, called at compiler/utils/Outputable.hs:1203:5 in ghc:Outputable\r\n assertPprPanic, called at compiler/types/TyCoRep.hs:2136:51 in ghc:TyCoRep\r\n checkValidSubst, called at compiler/types/TyCoRep.hs:2159:29 in ghc:TyCoRep\r\n substTy, called at compiler/types/TyCoRep.hs:2364:41 in ghc:TyCoRep\r\n substTyVarBndr, called at compiler/coreSyn/CoreSubst.hs:571:10 in ghc:CoreSubst\r\n\r\nPlease report this as a GHC bug: http://www.haskell.org/ghc/reportabug\r\n\r\n> \r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking