[GHC] #10309: ApiAnnotations : mkGadtDecl discards annotations for HsFunTy

GHC ghc-devs at haskell.org
Mon May 11 08:56:29 UTC 2015


#10309: ApiAnnotations : mkGadtDecl discards annotations for HsFunTy
-------------------------------------+-------------------------------------
        Reporter:  alanz             |                   Owner:  alanz
            Type:  bug               |                  Status:  patch
        Priority:  normal            |               Milestone:  7.10.2
       Component:  Compiler          |                 Version:  7.10.1
  (Parser)                           |                Keywords:
      Resolution:                    |  ApiAnnotations
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:  Phab:D848
-------------------------------------+-------------------------------------

Comment (by Alan Zimmerman <alan.zimm@…>):

 In [changeset:"e4032b1951a35d8df63a74ebfee7449988b5ef40/ghc"]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="e4032b1951a35d8df63a74ebfee7449988b5ef40"
 ApiAnnotations : mkGadtDecl discards annotations for HsFunTy

 Summary:
 When mkGadtDecl is presented wih a HsFunTy it discards the SrcSpan, thus
 disconnecting any annotations on the HsFunTy.

 ```
 mkGadtDecl names (L ls (HsForAllTy imp Nothing qvars cxt tau))
   = return $ mk_gadt_con names
   where
     (details, res_ty)           -- See Note [Sorting out the result type]
       = case tau of
           L _ (HsFunTy (L l (HsRecTy flds)) res_ty)
                                             -> (RecCon (L l flds), res_ty)
           _other                                    -> (PrefixCon [], tau)
 ...
 ```

 This can be triggered by the following

 ```
 {-# LANGUAGE GADTs #-}
 module GADTRecords2 (H1(..)) where

 -- | h1
 data H1 a b where
   C3 :: (Num a) => { field :: a -- ^ hello docs
                    } -> H1 Int Int
 ```

 Test Plan: ./validate

 Reviewers: hvr, austin

 Reviewed By: austin

 Subscribers: bgamari, thomie, mpickering

 Differential Revision: https://phabricator.haskell.org/D848

 GHC Trac Issues: #10309
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10309#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list