ApiAnnotations : mkGadtDecl discards annotations for HsFunTy
ClosedPublic

Authored by alanz on Apr 16 2015, 4:18 PM.

Details

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

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Branch
wip/10309-2
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 3940
Build 3970: GHC Patch Validation (amd64/Linux)
alanz updated this revision to Diff 2779.Apr 16 2015, 4:18 PM
alanz retitled this revision from to ApiAnnotations : mkGadtDecl discards annotations for HsFunTy.
alanz updated this object.
alanz edited the test plan for this revision. (Show Details)
alanz added reviewers: austin, hvr.
alanz updated the Trac tickets for this revision.
alanz added a subscriber: mpickering.
alanz updated this revision to Diff 2795.Apr 17 2015, 10:47 AM

Rebase against D842

alanz updated this revision to Diff 2796.Apr 17 2015, 11:31 AM

Remove extraneous master changes

austin requested changes to this revision.Apr 18 2015, 12:09 PM
austin edited edge metadata.

Minor wibble, otherwise LGTM.

testsuite/tests/ghc-api/annotations/.gitignore
8

merge-o

This revision now requires changes to proceed.Apr 18 2015, 12:09 PM
alanz updated this revision to Diff 2801.Apr 19 2015, 6:54 AM
alanz edited edge metadata.

Remove spurious merge residue

alanz updated this revision to Diff 2880.May 5 2015, 4:26 PM
alanz edited edge metadata.

Remove dependency on D842

alanz updated this revision to Diff 2881.May 5 2015, 4:46 PM

Actually apply the working part of the patch

austin accepted this revision.May 10 2015, 6:05 PM
austin edited edge metadata.

lgtm

This revision is now accepted and ready to land.May 10 2015, 6:05 PM
alanz updated this revision to Diff 2911.May 11 2015, 3:10 AM
alanz edited edge metadata.

Rebase against master

This revision was automatically updated to reflect the committed changes.