Commit 8802bfad authored by Björn Peemöller 's avatar Björn Peemöller
Browse files

Improved error message for equations with different arities

parent 98a9f073
......@@ -447,7 +447,7 @@ top-level.
> joinEquations [] = return []
> joinEquations (FunctionDecl p f eqs : FunctionDecl _ f' [eq] : ds)
> | f == f' = do
> when (getArity (head eqs) /= getArity eq) $ report $ errDifferentArity f
> when (getArity (head eqs) /= getArity eq) $ report $ errDifferentArity [f, f']
> joinEquations (FunctionDecl p f (eqs ++ [eq]) : ds)
> where getArity = length . snd . getFlatLhs
> joinEquations (d : ds) = (d :) `liftM` joinEquations ds
......@@ -1067,9 +1067,13 @@ Error messages.
> errNotALabel l = posMessage l $
> text (escName l) <+> text "is not a record label"
> errDifferentArity :: Ident -> Message
> errDifferentArity f = posMessage f $ hsep $ map text
> ["Equations for", escName f, "have different arities"]
> errDifferentArity :: [Ident] -> Message
> errDifferentArity [] = internalError
> "SyntaxCheck.errDifferentArity: empty list"
> errDifferentArity (i:is) = posMessage i $
> text "Equations for" <+> text (escName i) <+> text "have different arities"
> <+> text "at:" $+$
> nest 2 (vcat (map (ppPosition . getPosition) (i:is)))
> errWrongArity :: QualIdent -> Int -> Int -> Message
> errWrongArity c arity' argc = posMessage c $ hsep (map text
......
test x = x
test x y = y
test x y z = z
\ No newline at end of file
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