summaryrefslogtreecommitdiff
path: root/compiler/GHC/Parser.y
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2020-05-29 13:50:02 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-06-01 06:41:18 -0400
commit0fde53770cacb0d54f0583707ef7ceec78f92c41 (patch)
tree978537c734d65232080212b9580cf7fcb2daf077 /compiler/GHC/Parser.y
parent730fcd54467e82083d56fa87e44bbe346458c531 (diff)
downloadhaskell-0fde53770cacb0d54f0583707ef7ceec78f92c41.tar.gz
Improve parser error messages for TypeApplications
With this patch, we always parse f @t as a type application, thereby producing better error messages. This steals two syntactic forms: * Prefix form of the @-operator in expressions. Since the @-operator is a divergence from the Haskell Report anyway, this is not a major loss. * Prefix form of @-patterns. Since we are stealing loose infix form anyway, might as well sacrifice the prefix form for the sake of much better error messages.
Diffstat (limited to 'compiler/GHC/Parser.y')
-rw-r--r--compiler/GHC/Parser.y8
1 files changed, 3 insertions, 5 deletions
diff --git a/compiler/GHC/Parser.y b/compiler/GHC/Parser.y
index 6dde13f7a9..a9bb4fa87d 100644
--- a/compiler/GHC/Parser.y
+++ b/compiler/GHC/Parser.y
@@ -2738,11 +2738,9 @@ fexp :: { ECP }
mkHsAppPV (comb2 $1 $>) $1 $2 }
-- See Note [Whitespace-sensitive operator parsing] in GHC.Parser.Lexer
- | fexp PREFIX_AT atype {% runECP_P $1 >>= \ $1 ->
- runPV (checkExpBlockArguments $1) >>= \_ ->
- fmap ecpFromExp $
- ams (sLL $1 $> $ HsAppType noExtField $1 (mkHsWildCardBndrs $3))
- [mj AnnAt $2] }
+ | fexp PREFIX_AT atype { ECP $
+ runECP_PV $1 >>= \ $1 ->
+ amms (mkHsAppTypePV (comb2 $1 $>) $1 $3) [mj AnnAt $2] }
| 'static' aexp {% runECP_P $2 >>= \ $2 ->
fmap ecpFromExp $