Commit cc45450c authored by simonpj@microsoft.com's avatar simonpj@microsoft.com

Improve error message when 'forall' is not a keyword

parent 1bb3a4f7
......@@ -30,7 +30,7 @@ module RnEnv (
mapFvRn, mapFvRnCPS,
warnUnusedMatches, warnUnusedModules, warnUnusedImports,
warnUnusedTopBinds, warnUnusedLocalBinds,
dataTcOccs, unknownNameErr
dataTcOccs, unknownNameErr, perhapsForallMsg
) where
#include "HsVersions.h"
......@@ -986,10 +986,13 @@ unknownNameErr rdr_name
<+> quotes (ppr rdr_name))
, extra ]
where
extra | rdr_name == forall_tv_RDR
= vcat [ptext (sLit "Perhaps you intended to use -XRankNTypes or similar flag"),
ptext (sLit "to enable explicit-forall syntax: forall <tvs>. <type>?")]
| otherwise = empty
extra | rdr_name == forall_tv_RDR = perhapsForallMsg
| otherwise = empty
perhapsForallMsg :: SDoc
perhapsForallMsg
= vcat [ ptext (sLit "Perhaps you intended to use -XRankNTypes or similar flag")
, ptext (sLit "to enable explicit-forall syntax: forall <tvs>. <type>")]
unknownSubordinateErr :: SDoc -> RdrName -> SDoc
unknownSubordinateErr doc op -- Doc is "method of class" or
......
......@@ -538,7 +538,7 @@ opTyErr op ty@(HsOpTy ty1 _ _)
2 extra
where
extra | op == dot_tv_RDR && forall_head ty1
= ptext (sLit "Perhaps you intended to use -XRankNTypes or similar flag")
= perhapsForallMsg
| otherwise
= ptext (sLit "Use -XTypeOperators to allow operators in types")
......
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