[Git][ghc/ghc][wip/az/exactprint] Proof of Concept implementation of in-tree API Annotations

Alan Zimmerman gitlab at gitlab.haskell.org
Sun Jul 5 21:04:46 UTC 2020



Alan Zimmerman pushed to branch wip/az/exactprint at Glasgow Haskell Compiler / GHC


Commits:
195c9d4f by Alan Zimmerman at 2020-07-05T22:03:02+01:00
Proof of Concept implementation of in-tree API Annotations

This MR introduces a possible machinery to introduce API Annotations
into the TTG extension points.

It is intended to be a concrete example for discussion.

It still needs to process comments.

----

Work in progress, adding more TTG extensions for annotations.

And fixing ppr round-trip tests by being able to blank out in-tree
annotations, as done with SrcSpans.

This is needed for the case of

  class Foo a where

for which current ppr does not print the "where".

Rename AA to AddApiAnn and AA to AddAnn

Add XConPatIn and XConPatOut

Rebase

----

First pass at bringing in LocatedA for API anns in locations

Treatment of ECP in parsing is provisional at this stage, leads to some
horribly stuff in Parser.y and RdrHsSyn.

It is an extensive but not invasive change. I think (AZ).

Locally it reports some parsing tests using less memory.

Add ApiAnns to the HsExpr data structure.

rebase.

Change HsMatchContext and HsStmtContext to use an id, not a GhcPass
parameter.

Add ApiAnns to Hs/Types

Rebase

Rebased 2020-03-25

WIP on in-tree annotations

Includes updating HsModule

Imports

LocateA ImportDecl so we can hang AnnSemi off it

A whole bunch of stuff more

InjectivityAnn and FamEqn now have annotations in them

Add annotations to context srcspan

----

In-tree annotations: LHsDecl and LHsBind LocatedA

----

WIP on in-tree annotations

----

in-tree annotations: LHsType is now LocatedA

----

FunDeps is now also a HS data type

----

WIP.  Added LocatedA to Pat, Expr, Decl

And worked some more through Parser.y

----

LStmt now Located

----

Finished working through Parser.y, tests seem ok

failures relate to annotations.

Adding test infrastructure for check-exact

Like check-ppr, but checking for an exact reproduction of the parsed
source file.

Starting to work on actual exact printer

Bring in ApiAnnName

As an alternative for LocatedA, to be used for names only.

Carrying extra name adornments, such as locations of backticks,
parens, etc.

Working on changing ApiAnnName to accurately reflect actual usage

Get rid of AnnApiName in favour of LocatedN

Working on check-exact. Making progress

Working on the ghc-exact bit

Progress, can reproduce the first Test.hs file.

Move API Annotations out of the extensions to annotations

- - - - -


20 changed files:

- .gitmodules
- compiler/GHC.hs
- compiler/GHC/Data/BooleanFormula.hs
- compiler/GHC/Data/OrdList.hs
- compiler/GHC/Driver/Backpack.hs
- compiler/GHC/Driver/Main.hs
- compiler/GHC/Driver/Types.hs
- compiler/GHC/Hs.hs
- compiler/GHC/Hs/Binds.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Dump.hs
- + compiler/GHC/Hs/Exact.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Expr.hs-boot
- compiler/GHC/Hs/Extension.hs
- compiler/GHC/Hs/ImpExp.hs
- compiler/GHC/Hs/Instances.hs
- compiler/GHC/Hs/Pat.hs
- compiler/GHC/Hs/Stats.hs
- compiler/GHC/Hs/Type.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/195c9d4ffa8b39b4acdf66770d17051ae5ed4337

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/195c9d4ffa8b39b4acdf66770d17051ae5ed4337
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200705/5b43b248/attachment.html>


More information about the ghc-commits mailing list