diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2015-04-14 07:32:40 -0500 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2015-04-14 07:33:25 -0500 |
commit | 8dc294487fdaf102349c373c7db4796693573310 (patch) | |
tree | 4816125b3b6457fc7d20353fedb8614d533dc626 /compiler/parser/RdrHsSyn.hs | |
parent | 79bfe27d9157fb3d44b4cc64f168bc11191d3f9b (diff) | |
download | haskell-8dc294487fdaf102349c373c7db4796693573310.tar.gz |
API Annotations : ExprWithTySig processing discards annotated spans
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
Diffstat (limited to 'compiler/parser/RdrHsSyn.hs')
-rw-r--r-- | compiler/parser/RdrHsSyn.hs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/parser/RdrHsSyn.hs b/compiler/parser/RdrHsSyn.hs index 6bf8bc3c76..06c6564716 100644 --- a/compiler/parser/RdrHsSyn.hs +++ b/compiler/parser/RdrHsSyn.hs @@ -847,7 +847,8 @@ checkAPat msg loc e0 = do L _ (HsForAllTy Implicit _ _ (L _ []) ty) -> ty other -> other - return (SigPatIn e (mkHsWithBndrs t')) + return (SigPatIn e (mkHsWithBndrs + (L (getLoc t) (HsParTy t')))) -- n+k patterns OpApp (L nloc (HsVar n)) (L _ (HsVar plus)) _ |