[GHC] #10872: More informative assertion for non-unique TH names

GHC ghc-devs at haskell.org
Sat Sep 12 08:37:23 UTC 2015


#10872: More informative assertion for non-unique TH names
-------------------------------------+-------------------------------------
              Reporter:  jstolarek   |             Owner:
                  Type:  task        |            Status:  new
              Priority:  low         |         Milestone:
             Component:  Compiler    |           Version:  7.11
              Keywords:              |  Operating System:  Unknown/Multiple
          Architecture:              |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
             Test Case:              |        Blocked By:
              Blocking:              |   Related Tickets:
Differential Revisions:              |
-------------------------------------+-------------------------------------
 Let's say that by accident I have duplicated uniques of Template Haskell
 built-in identifiers defined in `THNames` module:

 {{{#!hs
 returnQIdKey        = mkPreludeMiscIdUnique 200
 bindQIdKey          = mkPreludeMiscIdUnique 200
 }}}
 If I have a debugging build (`-DDEBUG`) and start a GHCi session it
 crashes immediately with a very uninformative error message:

 {{{
 GHCi, version 7.11.20150903: http://www.haskell.org/ghc/  :? for help

 <interactive>:1:1: error:
     Bad interface file: /dane/projekty/ghc/build/libraries/base/dist-
 install/build/Prelude.hi
         ghc-stage2: panic! (the 'impossible' happened)
   (GHC version 7.11.20150903 for x86_64-unknown-linux):
         ASSERT failed!
 <<details unavailable>>

 Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
 }}}

 I have no idea where this assertion comes from as it gives absolutely no
 clue as to what caused the problem. During ICFP this costed me and Richard
 a total of around 6 man-hours. We should replace that assertion with
 something more meaningful. One thing we could do is add an assertion to
 the definition of `THNames.templateHaskellNames` that makes sure that
 `length templateHaskellNames == length (nub templateHaskellNames)`. That
 by itself is very simple but the problem is that the uninformative
 assertion given above still kicks in first.

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


More information about the ghc-tickets mailing list