X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fparser%2FRdrHsSyn.lhs;h=b86068cf0f314f453e5292a2e024fa3d36d6f8ac;hp=746f3d623b95cde27b346db569f2075aaba9804c;hb=3ddb6bb4edf70b2456d789f34d3f56541818a696;hpb=bbeb08a18156abf1f719ab7273a134f5f21e7fa6 diff --git a/compiler/parser/RdrHsSyn.lhs b/compiler/parser/RdrHsSyn.lhs index 746f3d6..b86068c 100644 --- a/compiler/parser/RdrHsSyn.lhs +++ b/compiler/parser/RdrHsSyn.lhs @@ -867,8 +867,20 @@ checkValSig checkValSig (L l (HsVar v)) ty | isUnqual v && not (isDataOcc (rdrNameOcc v)) = return (TypeSig (L l v) ty) -checkValSig (L l _) _ - = parseError l "Invalid type signature" +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 :: " + where + -- 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 + looks_like_foreign (L _ (HsVar v)) = v == foreign_RDR + looks_like_foreign (L _ (HsApp lhs _)) = looks_like_foreign lhs + looks_like_foreign _ = False + + foreign_RDR = mkUnqual varName (fsLit "foreign") \end{code} @@ -965,6 +977,7 @@ mkInlinePragma :: Maybe Activation -> RuleMatchInfo -> Bool -> InlinePragma -- The Maybe is because the user can omit the activation spec (and usually does) mkInlinePragma mb_act match_info inl = InlinePragma { inl_inline = inl + , inl_sat = Nothing , inl_act = act , inl_rule = match_info } where