Skip to content

Add info about typeclass evidence to .hie files

Zubin requested to merge wz1000/ghc:hiefile-typeclass-info into master

See testsuite/tests/hiefile/should_run/HieQueries.hs and testsuite/tests/hiefile/should_run/HieQueries.stdout for an example of this

We add two new fields, EvidenceVarBind and EvidenceVarUse to the ContextInfo associated with an Identifier. These contexts are associated with the appropriate identifiers for the evidence variables collected when we come across HsWrappers, TcEvBinds and IPBinds while traversing the AST. This allows us to save a complete picture of the evidence constructed by the constraint solver, and will let us report this to the user, enabling features like going to the instance definition from the invocation of a class method(or any other method taking a constraint) and finding all usages of a particular instance.

Additionally, we mark NodeInfo with a NodeOrigin flag that tells us about the provenance of the node(whether it is from the source or generated by GHC). For now, this corresponds to the Origin field in the MatchGroup. This helps us ensure we don't display irrelevant information in hover tooltips generated by haddocks hyperlinker. It is necessary because we now recurse into the MatchGroup without guarding for the FromSource origin, so that we can collect all the typeclass evidence information required.

Fixes #17222

Edited by Zubin

Merge request reports