Skip to content
This repository was archived by the owner on Aug 3, 2024. It is now read-only.

Improve error messages with context information #1060

Merged
merged 1 commit into from
Aug 1, 2019

Conversation

pepeiborra
Copy link
Contributor

Haddock started failing for a large project of ours. It's likely caused by a missing type signature or similar, but unfortunately the error message did not contain a module or data type name to help diagnose the issue.

Error before:

 haddock: internal error: extractPatternSyn: constructor pattern not found                                                                                                                                                             
    CallStack (from HasCallStack):                                                                                                                                                                                                        
        error, called at utils/haddock/haddock-api/src/Haddock/Interface/Create.hs:1122:11 in main:Haddock.Interface.Create                                                                                                               

Error now:

haddock: While creating Haddock interface for Strats.Service.Pricing.CM.FuturesOption:

haddock: panic! (the 'impossible' happened)
  (GHC version 8.6.2 for x86_64-unknown-linux):
	extractPatternSyn

constructor pattern  TradeInput not found in type TradeInput
Call stack:
    CallStack (from HasCallStack):
      callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
      pprPanic, called at src/Haddock/Interface/Create.hs:1129:11 in haddock-api-2.22.1-EKeb0YKljx1FKocDSu56k7:Haddock.Interface.Create
      extractPatternSyn, called at src/Haddock/Interface/Create.hs:1087:32 in haddock-api-2.22.1-EKeb0YKljx1FKocDSu56k7:Haddock.Interface.Create
      extractDecl, called at src/Haddock/Interface/Create.hs:818:43 in haddock-api-2.22.1-EKeb0YKljx1FKocDSu56k7:Haddock.Interface.Create
      availExportDecl, called at src/Haddock/Interface/Create.hs:762:24 in haddock-api-2.22.1-EKeb0YKljx1FKocDSu56k7:Haddock.Interface.Create
      availExportItem, called at src/Haddock/Interface/Create.hs:699:7 in haddock-api-2.22.1-EKeb0YKljx1FKocDSu56k7:Haddock.Interface.Create
      mkExportItems, called at src/Haddock/Interface/Create.hs:155:18 in haddock-api-2.22.1-EKeb0YKljx1FKocDSu56k7:Haddock.Interface.Create
      createInterface, called at src/Haddock/Interface.hs:193:42 in haddock-api-2.22.1-EKeb0YKljx1FKocDSu56k7:Haddock.Interface

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

@alexbiehl
Copy link
Member

Oh this is neat! I was in need for this a few times as well!

@alexbiehl alexbiehl merged commit 1f704e3 into haskell:ghc-8.6 Aug 1, 2019
alexbiehl pushed a commit that referenced this pull request Dec 8, 2020
* Fix multiple typos and inconsistencies in doc/markup.rst

Note: I noticed some overlap with #1112 from @wygulmage and #1081 from
@parsonsmatt after creating these proposed changes - mea culpa for not
looking at the open PRs sooner.

* Fix #1113 If no Signatures, no section of index.html

* Change the formatting of missing link destinations

The current formatting of the missing link destination does not really
help user to understand the reasons of the missing link.

To address this, I've changed the formatting in two ways:

- the missing link symbol name is now fully qualified. This way you
immediately know which haskell module cannot be linked. It is then easier
to understand why this module does not have documentation (hidden module
or broken documentation).
- one line per missing link, that's more readable now that symbol name
can be longer due to qualification.

For example, before haddock was listing missing symbol such as:

```
could not find link destinations for:
  Word8 Word16 mapMaybe
```

Now it is listed as:

```
could not find link destinations for:
  - Data.Word.Word8
  - Data.Word.Word16
  - Data.Maybe.mapMaybe
```

* Add `--ignore-link-symbol` command line argument

This argument can be used multiples time. A missing link to a symbol
listed by `--ignore-link-symbol` won't trigger "missing link" warning.

* Forbid spaces in anchors (#1148)

* Improve error messages with context information (#1060)

Co-authored-by: Matt Audesse <[email protected]>
Co-authored-by: Mike Pilgrem <[email protected]>
Co-authored-by: Guillaume Bouchard <[email protected]>
Co-authored-by: Pepe Iborra <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants