From 252abd9e355fe12e8f6f1e0192542a0df6ddccac Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 7 Sep 2004 12:30:28 +0000 Subject: [PATCH] [project @ 2004-09-07 12:30:27 by simonmar] Fix up the SrcSpan on the rhs of a function binding. --- ghc/compiler/parser/Parser.y.pp | 2 +- ghc/compiler/parser/RdrHsSyn.lhs | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ghc/compiler/parser/Parser.y.pp b/ghc/compiler/parser/Parser.y.pp index 2ba5ae0..83b299a 100644 --- a/ghc/compiler/parser/Parser.y.pp +++ b/ghc/compiler/parser/Parser.y.pp @@ -941,7 +941,7 @@ deriving :: { Located (Maybe [LHsType RdrName]) } decl :: { Located (OrdList (LHsDecl RdrName)) } : sigdecl { $1 } - | infixexp opt_sig rhs {% do { r <- checkValDef $1 $2 (unLoc $3); + | infixexp opt_sig rhs {% do { r <- checkValDef $1 $2 $3; return (LL $ unitOL (LL $ ValD r)) } } rhs :: { Located (GRHSs RdrName) } diff --git a/ghc/compiler/parser/RdrHsSyn.lhs b/ghc/compiler/parser/RdrHsSyn.lhs index 781b085..6fb6e86 100644 --- a/ghc/compiler/parser/RdrHsSyn.lhs +++ b/ghc/compiler/parser/RdrHsSyn.lhs @@ -762,17 +762,16 @@ patFail loc = parseError loc "Parse error in pattern" checkValDef :: LHsExpr RdrName -> Maybe (LHsType RdrName) - -> GRHSs RdrName + -> Located (GRHSs RdrName) -> P (HsBind RdrName) -checkValDef lhs opt_sig grhss +checkValDef lhs opt_sig (L rhs_span grhss) | Just (f,inf,es) <- isFunLhs lhs [] = if isQual (unLoc f) then parseError (getLoc f) ("Qualified name in function definition: " ++ showRdrName (unLoc f)) else do ps <- checkPatterns es - return (FunBind f inf [L (getLoc f) (Match ps opt_sig grhss)]) - -- TODO: span is wrong + return (FunBind f inf [L rhs_span (Match ps opt_sig grhss)]) | otherwise = do lhs <- checkPattern lhs return (PatBind lhs grhss) -- 1.7.10.4