diff options
author | Maciej Bielecki <zyla@prati.pl> | 2017-01-02 17:03:00 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-01-02 17:44:50 -0500 |
commit | b28ca38e6e1d75f3c10cc593cdd2ac80ec29690f (patch) | |
tree | d861809f4c3aea12c510341b5c64e3010b3d0e21 /compiler | |
parent | cc0abfa40b00b3b3ad4f4cf31b060026d677488a (diff) | |
download | haskell-b28ca38e6e1d75f3c10cc593cdd2ac80ec29690f.tar.gz |
Don't suggest enabling TypeApplications when it's already enabled
Previously when encountering EAsPat in an expression context,
TypeApplications was suggested even when already enabled. This patch
replaces the suggestion with more appropriate message.
Test Plan: validate
Reviewers: austin, bgamari, mpickering, goldfire, simonpj
Reviewed By: mpickering, goldfire, simonpj
Subscribers: simonpj, goldfire, mpickering, thomie
Differential Revision: https://phabricator.haskell.org/D2877
GHC Trac Issues: #12879
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/rename/RnExpr.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/rename/RnExpr.hs b/compiler/rename/RnExpr.hs index 811ecbafbe..17c9042f22 100644 --- a/compiler/rename/RnExpr.hs +++ b/compiler/rename/RnExpr.hs @@ -336,8 +336,14 @@ We return a (bogus) EWildPat in each case. -} rnExpr EWildPat = return (hsHoleExpr, emptyFVs) -- "_" is just a hole -rnExpr e@(EAsPat {}) = - patSynErr e (text "Did you mean to enable TypeApplications?") +rnExpr e@(EAsPat {}) + = do { opt_TypeApplications <- xoptM LangExt.TypeApplications + ; let msg | opt_TypeApplications + = "Type application syntax requires a space before '@'" + | otherwise + = "Did you mean to enable TypeApplications?" + ; patSynErr e (text msg) + } rnExpr e@(EViewPat {}) = patSynErr e empty rnExpr e@(ELazyPat {}) = patSynErr e empty |