in-tree API Annotations

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

in-tree API Annotations

Alan & Kim Zimmerman
I am trying to get my head around the best way to put the API annotations into the GHC ParsedSource directly, so ghc-exactprint can move in to GHC and make the development/testing process easier.

Prior to API Annotations, there were very few locations in the AST, as they were added as anchor points for the annotations, being separate from the AST and indexed to it by the SrcSpan.

I am intending to strip out the superfluous ones, in particular all the (Located RdrName), replacing them with something like

  data ApiAnnName a = N ApiAnn a

instead. So they would still be wrapped, but the annotations would be only ones that can occur for a RdrName, such a backticks, parens, and so on.

Does anything actually need these locations now they are there?  I am thinking specifically of the .hie files, as the `toHie` instances seem to make use of locations extensively.

Regards
  Alan


_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: in-tree API Annotations

Alan & Kim Zimmerman
And to reply to my own question, yes we do, we use them to tie up the ParsedSource RdrName to the renamed Name when considering refactorings.

On Mon, 25 May 2020 at 23:33, Alan & Kim Zimmerman <[hidden email]> wrote:
I am trying to get my head around the best way to put the API annotations into the GHC ParsedSource directly, so ghc-exactprint can move in to GHC and make the development/testing process easier.

Prior to API Annotations, there were very few locations in the AST, as they were added as anchor points for the annotations, being separate from the AST and indexed to it by the SrcSpan.

I am intending to strip out the superfluous ones, in particular all the (Located RdrName), replacing them with something like

  data ApiAnnName a = N ApiAnn a

instead. So they would still be wrapped, but the annotations would be only ones that can occur for a RdrName, such a backticks, parens, and so on.

Does anything actually need these locations now they are there?  I am thinking specifically of the .hie files, as the `toHie` instances seem to make use of locations extensively.

Regards
  Alan


_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs