projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
10c4d19
)
Make a parse error say what it is failing to parse; part of #3811
author
Ian Lynagh
<igloo@earth.li>
Sun, 8 Aug 2010 15:57:32 +0000
(15:57 +0000)
committer
Ian Lynagh
<igloo@earth.li>
Sun, 8 Aug 2010 15:57:32 +0000
(15:57 +0000)
compiler/parser/RdrHsSyn.lhs
patch
|
blob
|
history
diff --git
a/compiler/parser/RdrHsSyn.lhs
b/compiler/parser/RdrHsSyn.lhs
index
ac1a028
..
4c1da58
100644
(file)
--- a/
compiler/parser/RdrHsSyn.lhs
+++ b/
compiler/parser/RdrHsSyn.lhs
@@
-799,12
+799,14
@@
checkValSig
checkValSig (L l (HsVar v)) ty
| isUnqual v && not (isDataOcc (rdrNameOcc v))
= return (TypeSig (L l v) ty)
checkValSig (L l (HsVar v)) ty
| isUnqual v && not (isDataOcc (rdrNameOcc v))
= return (TypeSig (L l v) ty)
-checkValSig lhs@(L l _) _
- | looks_like_foreign lhs
- = parseError l "Invalid type signature; perhaps you meant to use -XForeignFunctionInterface?"
- | otherwise
- = parseError l "Invalid type signature: should be of form <variable> :: <type>"
+checkValSig lhs@(L l _) ty
+ = parseErrorSDoc l ((text "Invalid type signature:" <+>
+ ppr lhs <+> text "::" <+> ppr ty)
+ $$ text hint)
where
where
+ hint = if looks_like_foreign lhs
+ then "Perhaps you meant to use -XForeignFunctionInterface?"
+ else "Should be of form <variable> :: <type>"
-- A common error is to forget the ForeignFunctionInterface flag
-- so check for that, and suggest. cf Trac #3805
-- Sadly 'foreign import' still barfs 'parse error' because 'import' is a keyword
-- A common error is to forget the ForeignFunctionInterface flag
-- so check for that, and suggest. cf Trac #3805
-- Sadly 'foreign import' still barfs 'parse error' because 'import' is a keyword