[GHC] #11019: ApiAnnotations: Make all RdrName occurences Located

Simon Peyton Jones simonpj at microsoft.com
Mon Nov 23 10:13:33 UTC 2015


Alan

| ApiAnnotations: Make all RdrName occurences Located

There is a principle here: that every RdrName occurrence is located.  Is this principle articulated in a Note anywhere?  I wish it was!  (Including an explanation of why.) Otherwise you risk someone removing the change in a few years time.

When I built HsSyn originally I reasoned that

  data HsExpr = ...| HsVar RdrName
was better than
  data HsExpr = ... | HsVar (Located RdrName0

because the location on the RdrName is identical to that on the LHsExpr, so it's redundant.  But you think it is non-redundant.  I'm sure you are right (although I don't know why), but it would be a real help to document the invariant and the reasoning in the code somewhere.

Are there any other principles that the code embodies?

Thanks

Simon

|  -----Original Message-----
|  From: ghc-tickets [mailto:ghc-tickets-bounces at haskell.org] On Behalf
|  Of GHC
|  Sent: 22 November 2015 23:11
|  Cc: ghc-tickets at haskell.org
|  Subject: Re: [GHC] #11019: ApiAnnotations: Make all RdrName occurences
|  Located
|  
|  #11019: ApiAnnotations: Make all RdrName occurences Located
|  -------------------------------------+--------------------------------
|  --
|  -------------------------------------+---
|          Reporter:  alanz             |                Owner:  alanz
|              Type:  bug               |               Status:  new
|          Priority:  normal            |            Milestone:  8.0.1
|         Component:  Compiler          |              Version:  7.10.2
|        Resolution:                    |             Keywords:
|                                       |  ApiAnnotations
|  Operating System:  Unknown/Multiple  |         Architecture:
|                                       |  Unknown/Multiple
|   Type of failure:  None/Unknown      |            Test Case:
|        Blocked By:                    |             Blocking:
|   Related Tickets:                    |  Differential Rev(s):
|  Phab:1512
|         Wiki Page:                    |
|  -------------------------------------+--------------------------------
|  --
|  -------------------------------------+---
|  
|  Comment (by Ben Gamari <ben@…>):
|  
|   In [changeset:"3df9563e590bbfbfe1bc9171a0e8fc93ceef690d/ghc"
|   3df9563e/ghc]:
|   {{{
|   #!CommitTicketReference repository="ghc"
|   revision="3df9563e590bbfbfe1bc9171a0e8fc93ceef690d"
|   ApiAnnotations: Make all RdrName occurences Located
|  
|   At the moment the API Annotations can only be used on the
|  ParsedSource,  as there are changes made to the RenamedSource that
|  prevent it from  being used to round trip source code.
|  
|   It is possible to build a map from every Located Name in the
|  RenamedSource from its location to the Name, which can then be used
|  when  resolved names are required when changing the ParsedSource.
|  
|   However, there are instances where the identifier is not located,
|  specifically
|  
|     (GHC.VarPat name)
|     (GHC.HsVar name)
|     (GHC.UserTyVar name)
|     (GHC.HsTyVar name)
|  
|   Replace each of the name types above with (Located name)
|  
|   Updates the haddock submodule.
|  
|   Test Plan: ./validate
|  
|   Reviewers: austin, goldfire, bgamari
|  
|   Reviewed By: bgamari
|  
|   Subscribers: goldfire, thomie, mpickering
|  
|   Differential Revision: https://phabricator.haskell.org/D1512
|  
|   GHC Trac Issues: #11019
|   }}}
|  
|  --
|  Ticket URL:
|  <https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fghc.h
|  askell.org%2ftrac%2fghc%2fticket%2f11019%23comment%3a5&data=01%7c01%7c
|  simonpj%40064d.mgd.microsoft.com%7cd486e47f742f47e34e7308d2f39230b0%7c
|  72f988bf86f141af91ab2d7cd011db47%7c1&sdata=AmQZ%2boKbdHXQ4cuPjYOVePqF7
|  ivXocZyqHXbcyBj3GY%3d>
|  GHC
|  <https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fwww.h
|  askell.org%2fghc%2f&data=01%7c01%7csimonpj%40064d.mgd.microsoft.com%7c
|  d486e47f742f47e34e7308d2f39230b0%7c72f988bf86f141af91ab2d7cd011db47%7c
|  1&sdata=Ca9k88QpvsPGDgrkQCANdKLAPCnAKwoZdHzbIhBgnIU%3d>
|  The Glasgow Haskell Compiler
|  _______________________________________________
|  ghc-tickets mailing list
|  ghc-tickets at haskell.org
|  https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fmail.h
|  askell.org%2fcgi-bin%2fmailman%2flistinfo%2fghc-
|  tickets%0a&data=01%7c01%7csimonpj%40064d.mgd.microsoft.com%7cd486e47f7
|  42f47e34e7308d2f39230b0%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=Q
|  aS%2fcmZrioGbpGHXUFNcdCmhyFt6mnV4DH4ucOsO7eo%3d


More information about the ghc-devs mailing list