Skip to content
  • Alan Zimmerman's avatar
    API Annotations : ExprWithTySig processing discards annotated spans · 8dc29448
    Alan Zimmerman authored
    In RdrHsSyn.checkAPat the processing for ExprWithTySig is defined as
    
       ExprWithTySig e t _ -> do e <- checkLPat msg e
                                 -- Pattern signatures are parsed as sigtypes,
                                 -- but they aren't explicit forall points.  Hence
                                 -- we have to remove the implicit forall here.
                                 let t' = case t of
                                            L _ (HsForAllTy Implicit _ _
                                                 (L _ []) ty) -> ty
                                            other -> other
                                 return (SigPatIn e (mkHsWithBndrs t'))
    
    The t' variable ends up losing its original SrcSpan in the first case
    branch. This results in annotations becoming detached from the AST.
    
    Reviewed By: austin
    
    Differential Revision: https://phabricator.haskell.org/D823
    
    GHC Trac Issues: #10255
    8dc29448