Added a bit of extra help when a name is not found (suggesting other names)

This commit is contained in:
Neil Brown 2009-04-02 15:42:02 +00:00
parent f69030df34
commit 9e3e71c70a

View File

@ -396,6 +396,7 @@ findName thisN thisNT
(origN, origNT) <- (origN, origNT) <-
case lookup (A.nameName thisN) (csLocalNames st) of case lookup (A.nameName thisN) (csLocalNames st) of
Nothing -> dieP (A.nameMeta thisN) $ "name " ++ A.nameName thisN ++ " not defined" Nothing -> dieP (A.nameMeta thisN) $ "name " ++ A.nameName thisN ++ " not defined"
++ "; possibilities were: " ++ show (map fst (csLocalNames st))
Just def -> return def Just def -> return def
if thisNT /= origNT if thisNT /= origNT
then dieP (A.nameMeta thisN) $ "expected " ++ show thisNT ++ " (" ++ A.nameName origN ++ " is " ++ show origNT ++ ")" then dieP (A.nameMeta thisN) $ "expected " ++ show thisNT ++ " (" ++ A.nameName origN ++ " is " ++ show origNT ++ ")"