ApiAnnotations : mkGadtDecl discards annotations for HsFunTy

Authored by alanz on May 11 2015, 3:57 AM.

Description

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: Trac #10309

Details

Committed
alanzMay 11 2015, 3:57 AM
Pushed
bgamariAug 25 2016, 1:39 PM
Reviewer
austin
Differential Revision
D848: ApiAnnotations : mkGadtDecl discards annotations for HsFunTy
Parents
rGHCDIFF811b72adedcd: Api Annotations: RdrHsSyn.mkAtDefault causes annotations to be disconnected.
Branches
Unknown
Tags
Unknown