[GHC] #13394: PatternSynonyms/OverloadedStrings regression in GHC HEAD

GHC ghc-devs at haskell.org
Wed Mar 8 01:34:42 UTC 2017


#13394: PatternSynonyms/OverloadedStrings regression in GHC HEAD
-------------------------------------+-------------------------------------
           Reporter:  RyanGlScott    |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  highest        |         Milestone:  8.2.1
          Component:  Compiler       |           Version:  8.1
           Keywords:                 |  Operating System:  Unknown/Multiple
  PatternSynonyms                    |
       Architecture:                 |   Type of failure:  Compile-time
  Unknown/Multiple                   |  crash or panic
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 `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:

 {{{#!hs
 {-# 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.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13394>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list