Skip to content

isUnliftedType panic with out of scope variable

Given

{-# LANGUAGE RankNTypes, PolyKinds, KindSignatures #-}

module T where
import GHC.Types

bad :: forall (r :: RuntimeRep) a (b :: TYPE r). a -> b
bad x = outOfScope

attempting ghc T.hs -fdefer-out-of-scope-variables shows:

T.hs:7:9: warning: [-Wdeferred-out-of-scope-variables]
    Variable not in scope: outOfScope
  |
7 | bad x = outOfScope
  |         ^^^^^^^^^^
ghc-stage2: panic! (the 'impossible' happened)
  (GHC version 8.11.0.20200203:
	isUnliftedType
  b_au8 :: TYPE r_au6
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1187:37 in ghc:Outputable
        pprPanic, called at compiler/types/Type.hs:1975:10 in ghc:Type
        isUnliftedType, called at compiler/coreSyn/CoreUtils.hs:497:27 in ghc:CoreUtils

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

Tested on 8.6, 8.8 and HEAD.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information