• Alan Zimmerman's avatar
    ApiAnnotations : mkGadtDecl discards annotations for HsFunTy · e4032b19
    Alan Zimmerman authored
    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
    e4032b19
Parser.y 163 KB