PatternSynonyms/OverloadedStrings regression in GHC HEAD
purescript-0.10.7
fails to build with GHC HEAD at the moment due to an apparent regression in the way pattern synonyms and overloaded strings interact. Here is a simplified example:
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternSynonyms #-}
module Bug where
import Data.ByteString
newtype ProperName =
ProperName { runProperName :: ByteString
-- purescript actually uses the Text type, but this works
-- just as well for the purposes of illustrating the bug
}
newtype ModuleName = ModuleName [ProperName]
pattern TypeDataSymbol :: ModuleName
pattern TypeDataSymbol = ModuleName [ProperName "Type",ProperName "Data", ProperName "Symbol"]
Compiling this with GHC 7.10.3 or 8.0.2 works without issue. In GHC HEAD, if you compile this with optimization enabled, it'll trigger a GHC panic:
$ ~/Software/ghc5/inplace/bin/ghc-stage2 -O1 -fforce-recomp Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.1.20170303 for x86_64-unknown-linux):
isUnliftedType
r_a28T :: TYPE rep_a28S
Call stack:
CallStack (from HasCallStack):
prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1191:58 in ghc:Outputable
callStackDoc, called at compiler/utils/Outputable.hs:1195:37 in ghc:Outputable
pprPanic, called at compiler/types/Type.hs:1961:10 in ghc:Type
The presence of optimization is crucial for reproducing this bug, as compiling it with -O0
does not trigger the panic.
Trac metadata
Trac field | Value |
---|---|
Version | 8.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | highest |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |