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

Simon Peyton Jones simonpj at microsoft.com
Mon Nov 23 16:40:03 UTC 2015


The commit is a one-line change to IEThingAll, which says:
        -- See Note [Located RdrNames] in HsExpr

But HsExpr does not contain such a Note.  Did you omit something?

Simon

From: Alan & Kim Zimmerman [mailto:alan.zimm at gmail.com]
Sent: 23 November 2015 13:40
To: Simon Peyton Jones <simonpj at microsoft.com>
Subject: Re: [GHC] #11019: ApiAnnotations: Make all RdrName occurences Located

Done, see https://phabricator.haskell.org/rGHC7c9a04d6eda5495f150a1140e6d26fc64e319b7e

On Mon, Nov 23, 2015 at 12:13 PM, Simon Peyton Jones <simonpj at microsoft.com<mailto:simonpj at microsoft.com>> wrote:
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<mailto:ghc-tickets-bounces at haskell.org>] On Behalf
|  Of GHC
|  Sent: 22 November 2015 23:11
|  Cc: ghc-tickets at haskell.org<mailto: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<https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2faskell.org&data=01%7c01%7csimonpj%40064d.mgd.microsoft.com%7c132a7ad8a5d94d6364d608d2f40badf2%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=8LAYjhdWrzeCWyXOw%2bHWE4pNOdtWyN1vialpOAibZ0k%3d>%2ftrac%2fghc%2fticket%2f11019%23comment%3a5&data=01%7c01%7c
|  simonpj%40064d.mgd.microsoft.com<https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2f40064d.mgd.microsoft.com&data=01%7c01%7csimonpj%40064d.mgd.microsoft.com%7c132a7ad8a5d94d6364d608d2f40badf2%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=o7LJAE9yQyC%2buXGzNDXO6JTke5DWSkyFlICw%2fKYMVsQ%3d>%7cd486e47f742f47e34e7308d2f39230b0%7c
|  72f988bf86f141af91ab2d7cd011db47%7c1&sdata=AmQZ%2boKbdHXQ4cuPjYOVePqF7
|  ivXocZyqHXbcyBj3GY%3d>
|  GHC
|  <https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fwww.h
|  askell.org<https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2faskell.org&data=01%7c01%7csimonpj%40064d.mgd.microsoft.com%7c132a7ad8a5d94d6364d608d2f40badf2%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=8LAYjhdWrzeCWyXOw%2bHWE4pNOdtWyN1vialpOAibZ0k%3d>%2fghc%2f&data=01%7c01%7csimonpj%40064d.mgd.microsoft.com<https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2f40064d.mgd.microsoft.com&data=01%7c01%7csimonpj%40064d.mgd.microsoft.com%7c132a7ad8a5d94d6364d608d2f40badf2%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=o7LJAE9yQyC%2buXGzNDXO6JTke5DWSkyFlICw%2fKYMVsQ%3d>%7c
|  d486e47f742f47e34e7308d2f39230b0%7c72f988bf86f141af91ab2d7cd011db47%7c
|  1&sdata=Ca9k88QpvsPGDgrkQCANdKLAPCnAKwoZdHzbIhBgnIU%3d>
|  The Glasgow Haskell Compiler
|  _______________________________________________
|  ghc-tickets mailing list
|  ghc-tickets at haskell.org<mailto:ghc-tickets at haskell.org>
|  https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fmail.h
|  askell.org<https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2faskell.org&data=01%7c01%7csimonpj%40064d.mgd.microsoft.com%7c132a7ad8a5d94d6364d608d2f40badf2%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=8LAYjhdWrzeCWyXOw%2bHWE4pNOdtWyN1vialpOAibZ0k%3d>%2fcgi-bin%2fmailman%2flistinfo%2fghc-
|  tickets%0a&data=01%7c01%7csimonpj%40064d.mgd.microsoft.com<https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2f40064d.mgd.microsoft.com&data=01%7c01%7csimonpj%40064d.mgd.microsoft.com%7c132a7ad8a5d94d6364d608d2f40badf2%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=o7LJAE9yQyC%2buXGzNDXO6JTke5DWSkyFlICw%2fKYMVsQ%3d>%7cd486e47f7
|  42f47e34e7308d2f39230b0%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=Q
|  aS%2fcmZrioGbpGHXUFNcdCmhyFt6mnV4DH4ucOsO7eo%3d

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20151123/3b1b1bcd/attachment-0001.html>


More information about the ghc-devs mailing list