Opened 3 years ago

Closed 2 years ago

#13202 closed bug (fixed)

Levity polymorphism panic in GHCi

Reported by: bgamari Owned by:
Priority: high Milestone: 8.2.1
Component: Compiler Version: 8.0.1
Keywords: LevityPolymorphism Cc: goldfire
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: ghci/scripts/T13202{,a}
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

With current master,

$ ghci
GHCi, version 8.1.20170126: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/ben/.ghci
λ> import GHC.Exts
λ> :set -XTypeApplications -XMagicHash -XTypeInType
λ> data TypeRep (a :: k) = TypeRep
λ> let typeRepKind = undefined :: TypeRep (a :: k) -> TypeRep k
λ> let typeRep = undefined :: TypeRep (a :: k)
λ> let x = typeRepKind (typeRep @(Maybe Int#))
ghc: panic! (the 'impossible' happened)
  (GHC version 8.1.20170126 for x86_64-unknown-linux):
	isUnliftedType
  forall (a :: TYPE q). a :: TYPE q
  Call stack:
      CallStack (from HasCallStack):
        prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1166:58 in ghc:Outputable
        callStackDoc, called at compiler/utils/Outputable.hs:1170:37 in ghc:Outputable
        pprPanic, called at compiler/types/Type.hs:1869:10 in ghc:Type

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

Change History (5)

comment:1 Changed 3 years ago by adamgundry

I've just seen this as well, in a different context:

GHCi, version 8.1.20170217: http://www.haskell.org/ghc/  :? for help
Prelude> import GHC.Records
Prelude GHC.Records> :set -XTypeApplications -XDataKinds
Prelude GHC.Records> let foo = getField @"name"
ghc-stage2: panic! (the 'impossible' happened)
  (GHC version 8.1.20170217 for x86_64-unknown-linux):
	isUnliftedType
  forall (a :: TYPE q). a :: TYPE q
  Call stack:
      CallStack (from HasCallStack):
        prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1197:58 in ghc:Outputable
        callStackDoc, called at compiler/utils/Outputable.hs:1201:37 in ghc:Outputable
        pprPanic, called at compiler/types/Type.hs:1889:10 in ghc:Type
        isUnliftedType, called at compiler/typecheck/TcRnDriver.hs:1822:32 in ghc:TcRnDriver

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

comment:2 Changed 3 years ago by simonpj

Keywords: LevityPolymorphism added

comment:3 Changed 3 years ago by Richard Eisenberg <rae@…>

In fa13c136/ghc:

Fix #13202 by failing more eagerly in tcRnStmt

test cases: ghci/scripts/T13202{,a}

comment:4 Changed 3 years ago by goldfire

Status: newmerge
Test Case: ghci/scripts/T13202{,a}

comment:5 Changed 2 years ago by bgamari

Resolution: fixed
Status: mergeclosed
Note: See TracTickets for help on using tickets.