[Git][ghc/ghc][wip/az/locateda-epa-improve-2023-07-15] 41 commits: EPA: Replace Monoid with NoAnn

Alan Zimmerman (@alanz) gitlab at gitlab.haskell.org
Sun Aug 13 20:26:30 UTC 2023



Alan Zimmerman pushed to branch wip/az/locateda-epa-improve-2023-07-15 at Glasgow Haskell Compiler / GHC


Commits:
68f58649 by Alan Zimmerman at 2023-08-10T19:07:22+01:00
EPA: Replace Monoid with NoAnn

We currently use the Monoid class as a constraint on Exact Print
Annotation functions, so we can use mempty. But this leads to
requiring Semigroup instances too, which do not always make sense.

Instead, introduce a class NoAnn, with a function noAnn analogous to
mempty.

Closes #20372

- - - - -
8a0b2a0e by Alan Zimmerman at 2023-08-12T14:50:08+01:00
EPA: Instroduce HasAnnotation class

All tests pass [2023-08-10 Thu]

- - - - -
c594e3f9 by Alan Zimmerman at 2023-08-13T12:02:08+01:00
EPA: put noAnnSrcSpan in HasAnnotation

All tests pass [2023-08-13 Sun]

- - - - -
2eebc664 by Alan Zimmerman at 2023-08-13T12:34:04+01:00
EPA: Fix span for GRHS

Tests all pass [2023-08-13 Sun]

- - - - -
d3114392 by Alan Zimmerman at 2023-08-13T13:35:38+01:00
EPA: Capture full range for a CaseAlt Match

All tests pass [2023-08-13 Sun]

- - - - -
3c1b0726 by Alan Zimmerman at 2023-08-13T13:35:40+01:00
EPA Use full range for Anchor, and do not widen for [TrailingAnn]

Known failures at the end of this
  Ppr023
  Ppr034
  TestBoolFormula

Fixed in subsequent commits

- - - - -
880b4397 by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: Move TrailingAnns from last match to FunBind

- - - - -
178ff48e by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: Fix simple tests

- - - - -
0629a90f by Alan Zimmerman at 2023-08-13T21:25:31+01:00
Summary: Patch:  use-anchor-end-as-prior-end
Author: Alan Zimmerman <alan.zimm at gmail.com>
Date:   2023-06-25 12:41:37 +0100

EPA: Use the current Anchor end as prior end

Use the original anchor location end as the source of truth for
calculating print deltas.

This allows original spacing to apply in most cases, only changed AST
items need initial delta positions.

- - - - -
cf424308 by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: Add DArrow to TrailingAnn

- - - - -
278be18f by Alan Zimmerman at 2023-08-13T21:25:31+01:00
[EPA] Introduce HasTrailing in ExactPrint

29 Failing tests by 4600 processed

- - - - -
d15df6d5 by Alan Zimmerman at 2023-08-13T21:25:31+01:00
Summary: HasTrailing instances

- - - - -
18c967b3 by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA use [TrailingAnn] in enterAnn

And remove it from ExactPrint (LocatedN RdrName)

- - - - -
cef12a7c by Alan Zimmerman at 2023-08-13T21:25:31+01:00
Summary: Patch:  epa-in-hsdo-put-trailinganns
Author: Alan Zimmerman <alan.zimm at gmail.com>
Date:   2023-07-03 22:33:49 +0100

EPA: In HsDo, put TrailingAnns at top of LastStmt

Failures
5300 of 9700 [0, 103, 0]

- - - - -
50559a40 by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: do not convert comments to deltas when balancing.

It seems its not needed with the new approach

- - - - -
aadebd77 by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: deal with fallout from getMonoBind

- - - - -
16841a0f by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA fix captureLineSpacing

- - - - -
ea32224e by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA print any comments in the span before exiting it

- - - - -
4b69dea8 by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: getting rid of tweakDelta

WIP at present

- - - - -
309161e0 by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: tweaks to ExactPrint

- - - - -
36181466 by Alan Zimmerman at 2023-08-13T21:25:31+01:00
Summary: Patch:  epa-anchor-op-comments
Author: Alan Zimmerman <alan.zimm at gmail.com>
Date:   2023-07-25 22:40:51 +0100

EPA: Add comments to AnchorOperation

6000 of 9700 [0, 14, 0]
Failures seem to be mainly in transform tests

- - - - -
d04a8d35 by Alan Zimmerman at 2023-08-13T21:25:31+01:00
Summary: Patch:  epa-remove-anneofcomment
Author: Alan Zimmerman <alan.zimm at gmail.com>
Date:   2023-07-26 22:00:58 +0100

EPA: remove AnnEofComment

It is no longer used

At this point just ne normal 2 failures
  HsDocTy
  T15242

- - - - -
6881fd7f by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: make locA a function, not a field name

- - - - -
d7fcac60 by Alan Zimmerman at 2023-08-13T21:25:31+01:00
Summary: Patch:  epa-generalise-reloc
Author: Alan Zimmerman <alan.zimm at gmail.com>
Date:   2023-07-23 23:05:42 +0100

EPA: generalise reLoc

Normal 2 failures

- - - - -
ad6e1931 by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: get rid of l2l and friends

- - - - -
cbdddb9c by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: get rid of l2l and friends

- - - - -
55327406 by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: harmonise acsa and acsA

- - - - -
4c69574d by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: Replace Anchor with EpaLocation

- - - - -
1964df67 by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: get rid of AnchorOperation

- - - - -
2173a12e by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: splitLHsForAllTyInvis no ann returned

- - - - -
ab0f0b34 by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: Replace Monoid with NoAnn

- - - - -
eb365c82 by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: Use SrcSpan in EpaSpan

- - - - -
b3c8391e by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: Present no longer has annotation

- - - - -
fddfa418 by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: empty tup_tail has no ann

Parser.y: tup_tail rule was
          | {- empty -} %shift   { return [Left noAnn] }

This means we add an extra Missing constructor if the last item was a comma.

Change the annotation type to a Bool to indicate this, and use the
EpAnn Anchor for the print location for the others.

- - - - -
ea0fdcfe by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: Remove parenthesizeHsType

- - - - -
901f0c20 by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: Remove EpAnnNotUsed

- - - - -
b81a9f78 by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: Remove SrcSpanAnn

- - - - -
8cc95038 by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: Remove SrcSpanAnn completely

- - - - -
066eb092 by Alan Zimmerman at 2023-08-13T21:25:31+01:00
Clean up mkScope

- - - - -
02e54d5f by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: Clean up TC Monad Utils

- - - - -
ea97847f by Alan Zimmerman at 2023-08-13T21:25:31+01:00
EPA: EpaDelta for comment has no comments

- - - - -


16 changed files:

- compiler/GHC/Hs.hs
- compiler/GHC/Hs/Binds.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Dump.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Extension.hs
- compiler/GHC/Hs/ImpExp.hs
- compiler/GHC/Hs/Pat.hs
- compiler/GHC/Hs/Type.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore/Arrows.hs
- compiler/GHC/HsToCore/Docs.hs
- compiler/GHC/HsToCore/Monad.hs
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Iface/Ext/Utils.hs
- compiler/GHC/Parser.y


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/9901623c2d526e27a7a6c98e450254bff1a604db...ea97847f02bfa8a2f548d804e937062437371e9a

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/9901623c2d526e27a7a6c98e450254bff1a604db...ea97847f02bfa8a2f548d804e937062437371e9a
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/20230813/294fce1a/attachment-0001.html>


More information about the ghc-commits mailing list