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

GHC ghc-devs at haskell.org
Wed Apr 15 18:09:41 UTC 2015


#10309: ApiAnnotations : mkGadtDecl discards annotations for HsFunTy
-------------------------------------+-------------------------------------
              Reporter:  alanz       |             Owner:  alanz
                  Type:  bug         |            Status:  new
              Priority:  normal      |         Milestone:  7.10.2
             Component:  Compiler    |           Version:  7.10.1
  (Parser)                           |  Operating System:  Unknown/Multiple
              Keywords:              |   Type of failure:  None/Unknown
  ApiAnnotations                     |        Blocked By:
          Architecture:              |   Related Tickets:
  Unknown/Multiple                   |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
 When `mkGadtDecl` is presented wih a `HsFunTy` it discards the SrcSpan,
 thus disconnecting any annotations on the `HsFunTy`.

 {{{#!hs
 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

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

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

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


More information about the ghc-tickets mailing list