[GHC] #15692: GHC panic from pattern synonyms + deferred type errors

GHC ghc-devs at haskell.org
Sun Sep 30 14:52:19 UTC 2018


#15692: GHC panic from pattern synonyms + deferred type errors
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.6.1
      Resolution:                    |             Keywords:
                                     |  PatternSynonyms
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  crash or panic                     |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * keywords:  PatternSynonyms, TypeInType => PatternSynonyms


Comment:

 Here's a version which doesn't require any `TypeInType` voodoo:

 {{{#!hs
 {-# LANGUAGE GADTs #-}
 {-# LANGUAGE PatternSynonyms #-}
 {-# OPTIONS_GHC -fdefer-type-errors #-}
 module Bug where

 data F x where
   FS :: F (f a) -> F a

 pattern FS' = FS False
 }}}
 {{{
 $ /opt/ghc/8.6.1/bin/ghc Bug.hs
 [1 of 1] Compiling Bug              ( Bug.hs, Bug.o )

 Bug.hs:9:18: warning: [-Wdeferred-type-errors]
     • Couldn't match expected type ‘F (f x)’ with actual type ‘Bool’
     • In the pattern: False
       In the pattern: FS False
       In the declaration for pattern synonym ‘FS'’
   |
 9 | pattern FS' = FS False
   |                  ^^^^^
 ghc: panic! (the 'impossible' happened)
   (GHC version 8.6.1 for x86_64-unknown-linux):
         urk! lookup local fingerprint
   $mFS'
   [iESfI6 :-> ($trModule, 550028d00664444fecdab255e6368e70),
    iESgIq :-> ($tc'FS, a6b7c6b435bb17f938e26b19c786b9e3),
    iESgIs :-> ($tcF, 59ff366e0583120727f8be6ecf210589)]
   Call stack:
       CallStack (from HasCallStack):
         callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in
 ghc:Outputable
         pprPanic, called at compiler/iface/MkIface.hs:524:37 in
 ghc:MkIface
 }}}

 This is a regression from GHC 8.4.3:

 {{{
 $ /opt/ghc/8.4.3/bin/ghci Bug.hs
 GHCi, version 8.4.3: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/rgscott/.ghci
 [1 of 1] Compiling Bug              ( Bug.hs, interpreted )

 Bug.hs:9:18: warning: [-Wdeferred-type-errors]
     • Couldn't match expected type ‘F (f x)’ with actual type ‘Bool’
     • In the pattern: False
       In the pattern: FS False
       In the declaration for pattern synonym ‘FS'’
   |
 9 | pattern FS' = FS False
   |                  ^^^^^

 Bug.hs:9:18: warning: [-Wdeferred-type-errors]
     • Couldn't match expected type ‘F (f0 x)’ with actual type ‘Bool’
     • In the first argument of ‘FS’, namely ‘False’
       In the expression: FS False
       In an equation for ‘FS'’: FS' = FS False
     • Relevant bindings include $bFS' :: F x (bound at Bug.hs:9:9)
   |
 9 | pattern FS' = FS False
   |                  ^^^^^
 }}}

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


More information about the ghc-tickets mailing list