[GHC] #15499: Panic in occurence analysis phase (?), getRuntimeRep

GHC ghc-devs at haskell.org
Fri Aug 10 23:27:46 UTC 2018


#15499: Panic in occurence analysis phase (?), getRuntimeRep
-------------------------------------+-------------------------------------
        Reporter:  _deepfire         |                Owner:  RyanGlScott
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.4.4
       Component:  Compiler          |              Version:  8.4.3
      Resolution:                    |             Keywords:
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):

 * owner:  (none) => RyanGlScott
 * os:  Linux => Unknown/Multiple


Comment:

 Ugh, this is my fault. I introduced this regression in
 ef26182e2014b0a2a029ae466a4b121bf235e4e4 (`Track the order of user-written
 tyvars in DataCon`).

 The `-v4` logs are a bit misleading, as the real problem lies in
 desugaring, not occurrence analysis. Essentially, GHC tries to desugar
 this:

 {{{#!hs
 foo :: forall p. ADT p
 foo = undefined {b=undefined}
 }}}

 Into this:

 {{{#!hs
 foo :: forall p. ADT p
 foo @p = case undefined of
            ADT @a x y -> ADT @p @a x undefined
 }}}

 If the fact that I wrote `ADT @p @a` looks strange to you, that's because
 it is! The //real// type of the `ADT` constructor is:

 {{{#!hs
 ADT :: forall a p. a -> Integer -> ADT p
 }}}

 Due to the fact that type variables in GADT type signatures are now
 quantified in toposorted order after the aforementioned commit. This means
 that the correct order of arguments //should// be `ADT @a @p`. However,
 the code in `dsExpr` assumes that the universally quantified type
 variables always come before the existentially quantified type variables,
 so `@p` ends up being applied before `@a`, leading to utter disaster and
 chaos down the line.

 Thankfully, this isn't too difficult to fix. Patch incoming.

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


More information about the ghc-tickets mailing list