[GHC] #15289: isUnliftedType GHC panic on pattern with True :: Maybe

GHC ghc-devs at haskell.org
Mon Jun 18 22:30:34 UTC 2018


#15289: isUnliftedType GHC panic on pattern with True :: Maybe
-------------------------------------+-------------------------------------
        Reporter:  Remi              |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  low               |            Milestone:  8.6.1
       Component:  Compiler (Type    |              Version:  8.4.3
  checker)                           |             Keywords:
      Resolution:                    |  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


Comment:

 This also panics on GHC HEAD:

 {{{
 $ /opt/ghc/head/bin/ghc Bug2.hs
 [1 of 1] Compiling Oops             ( Bug2.hs, Bug2.o )
 ghc: panic! (the 'impossible' happened)
   (GHC version 8.5.20180616 for x86_64-unknown-linux):
         isUnliftedType
   (Maybe |> {co_aWy}) :: TYPE t_aWE[tau:0]
   Call stack:
       CallStack (from HasCallStack):
         callStackDoc, called at compiler/utils/Outputable.hs:1164:37 in
 ghc:Outputable
         pprPanic, called at compiler/types/Type.hs:1934:10 in ghc:Type
 }}}

 This appears to be a regression from GHC 8.2.2, in which the same program
 simply gives an error message:

 {{{
 $ /opt/ghc/8.2.2/bin/ghc Bug2.hs
 [1 of 1] Compiling Oops             ( Bug2.hs, Bug2.o )

 Bug2.hs:5:16: error:
     • Couldn't match expected type ‘Maybe’ with actual type ‘Bool’
     • In the pattern: True
       In the pattern: True :: Maybe
       In the declaration for pattern synonym ‘What’
   |
 5 | pattern What = True :: Maybe
   |                ^^^^

 Bug2.hs:5:16: error:
     • Couldn't match expected type ‘Maybe’ with actual type ‘Bool’
     • In the expression: True
       In an equation for ‘What’: What = True
   |
 5 | pattern What = True :: Maybe
   |                ^^^^^^^^^^^^^

 Bug2.hs:5:24: error:
     • Expecting one more argument to ‘Maybe’
       Expected a type, but ‘Maybe’ has kind ‘* -> *’
     • In the type ‘Maybe’
       In a pattern type signature: Maybe
       In the pattern: True :: Maybe
   |
 5 | pattern What = True :: Maybe
   |                        ^^^^^
 }}}

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


More information about the ghc-tickets mailing list