Commit 681d7813 authored by Jan Rasmus Tikovsky 's avatar Jan Rasmus Tikovsky
Browse files

Merge remote-tracking branch 'origin/PositionBug'

parents a68ce6c3 b47dfeab
......@@ -751,7 +751,7 @@ checkVariable v
return $ Variable v
[Constr _ _] -> return $ Constructor v
[GlobalVar _ _] -> return $ Variable v
[LocalVar v' _] -> return $ Variable $ qualify v'
[LocalVar v' _] -> return $ Variable $ qualify v' @> v
[RecordLabel _ _] -> return $ Variable v
rs -> do
m <- getModuleIdent
......@@ -760,7 +760,7 @@ checkVariable v
return $ Variable v
[Constr _ _] -> return $ Constructor v
[GlobalVar _ _] -> return $ Variable v
[LocalVar v' _] -> return $ Variable $ qualify v'
[LocalVar v' _] -> return $ Variable $ qualify v' @> v
[RecordLabel _ _] -> return $ Variable v
rs' -> do report $ errAmbiguousIdent rs' v
return $ Variable v
......
......@@ -321,7 +321,11 @@ constrain cs e = if null cs then e else foldr1 (&) cs &> e
-- 'Success' if it is not restricted by the guard expression.
dsRhs :: Position -> (Expression -> Expression) -> Rhs -> DsM Rhs
dsRhs p f rhs = expandRhs prelFailed f rhs >>= dsExpr p >>= return . simpleRhs p
dsRhs p f rhs = expandRhs prelFailed f rhs
>>= dsExpr pRhs
>>= return . simpleRhs pRhs
where
pRhs = fromMaybe p (getRhsPosition rhs)
expandRhs :: Expression -> (Expression -> Expression) -> Rhs -> DsM Expression
expandRhs _ f (SimpleRhs _ e ds) = return $ Let ds (f e)
......@@ -346,6 +350,10 @@ addDecls :: [Decl] -> Rhs -> Rhs
addDecls ds (SimpleRhs p e ds') = SimpleRhs p e (ds ++ ds')
addDecls ds (GuardedRhs es ds') = GuardedRhs es (ds ++ ds')
getRhsPosition :: Rhs -> Maybe Position
getRhsPosition (SimpleRhs p _ _) = Just p
getRhsPosition (GuardedRhs _ _) = Nothing
-- -----------------------------------------------------------------------------
-- Desugaring of non-linear patterns
-- -----------------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment