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

#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

#10872: More informative assertion for non-unique TH names -------------------------------------+------------------------------------- Reporter: jstolarek | Owner: Type: task | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by goldfire): Your idea of where to put the assertion looks good, but I'm incredulous that the nasty `ASSERT` could kick in first. If there's no way to get at the `templateHaskellNames` without going through an assertion of their sensibility, then how could the contents of that list affect anything? Something is fishy somewhere. If you're stuck, post on Phab. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10872#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10872: More informative assertion for non-unique TH names -------------------------------------+------------------------------------- Reporter: jstolarek | Owner: jstolarek Type: task | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by jstolarek): * owner: => jstolarek -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10872#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10872: More informative assertion for non-unique TH names -------------------------------------+------------------------------------- Reporter: jstolarek | Owner: jstolarek Type: task | Status: new Priority: low | Milestone: 8.0.1 Component: Template Haskell | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by goldfire): * component: Compiler => Template Haskell * milestone: => 8.0.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10872#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10872: More informative assertion for non-unique TH names -------------------------------------+------------------------------------- Reporter: jstolarek | Owner: goldfire Type: task | Status: new Priority: low | Milestone: 8.0.1 Component: Template Haskell | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by goldfire): * owner: jstolarek => goldfire Comment: I have solved this in the course of my work on #7961. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10872#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10872: More informative assertion for non-unique TH names -------------------------------------+------------------------------------- Reporter: jstolarek | Owner: goldfire Type: task | Status: new Priority: low | Milestone: 8.0.1 Component: Template Haskell | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by jstolarek): Is the solution part od Phab:D808? I'd love to see how you solved that - I still don't understand where I went wrong with my implementation. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10872#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10872: More informative assertion for non-unique TH names -------------------------------------+------------------------------------- Reporter: jstolarek | Owner: goldfire Type: task | Status: new Priority: low | Milestone: 8.0.1 Component: Template Haskell | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by jstolarek): Richard, I believe you claimed this is fixed. But I don't see any assertions in [[GhcFile(compiler/prelude/THNames.hs)]]. Is the assertion somewhere else? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10872#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10872: More informative assertion for non-unique TH names -------------------------------------+------------------------------------- Reporter: jstolarek | Owner: goldfire Type: task | Status: new Priority: low | Milestone: 8.0.1 Component: Template Haskell | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): It's good you asked. This check exists (in `PrelInfo.knownKeyNames`), but it actually doesn't snag problems in TH. Will fix. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10872#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10872: More informative assertion for non-unique TH names
-------------------------------------+-------------------------------------
Reporter: jstolarek | Owner: goldfire
Type: task | Status: new
Priority: low | Milestone: 8.0.1
Component: Template Haskell | Version: 7.11
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Richard Eisenberg

#10872: More informative assertion for non-unique TH names -------------------------------------+------------------------------------- Reporter: jstolarek | Owner: goldfire Type: task | Status: closed Priority: low | Milestone: 8.0.1 Component: Template Haskell | Version: 7.11 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by goldfire): * status: new => closed * resolution: => fixed Comment: This is just a debugging aid. No crying need to merge. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10872#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10872: More informative assertion for non-unique TH names -------------------------------------+------------------------------------- Reporter: jstolarek | Owner: goldfire Type: task | Status: closed Priority: low | Milestone: 8.0.1 Component: Template Haskell | Version: 7.11 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): Cherry-picked to `ghc-8.0` as a1a054b1c91a4dc234d879064a0612eefdcd3fcf. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10872#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC