summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2022-02-21 19:40:52 -0500
committerRyan Scott <ryan.gl.scott@gmail.com>2022-02-21 19:41:01 -0500
commitc1d48bcffcf70dcd38c12531ec6541f3067d2eda (patch)
tree041d273d3c95a0fae6ba49650d96b4a377300f4b
parent13f81d6fb947116ab1c55fa16946975843c97c9d (diff)
downloadhaskell-wip/T21077.tar.gz
Draft: tweak add_head_ctxt to check for EWrapswip/T21077
-rw-r--r--compiler/GHC/Tc/Gen/Head.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/GHC/Tc/Gen/Head.hs b/compiler/GHC/Tc/Gen/Head.hs
index 4c432ff3c0..ef4ee6d7fb 100644
--- a/compiler/GHC/Tc/Gen/Head.hs
+++ b/compiler/GHC/Tc/Gen/Head.hs
@@ -205,6 +205,11 @@ data AppCtxt
(HsExpr GhcRn) Int -- In the third argument of function f
SrcSpan -- The SrcSpan of the application (f e1 e2 e3)
+-- | Determine if an 'HsExprArg' is an 'EWrap'.
+isEWrap :: HsExprArg p -> Bool
+isEWrap EWrap{} = True
+isEWrap _ = False
+
appCtxtLoc :: AppCtxt -> SrcSpan
appCtxtLoc (VAExpansion _ l) = l
appCtxtLoc (VACall _ _ l) = l
@@ -464,10 +469,10 @@ tcInferAppHead_maybe fun args
_ -> return Nothing
add_head_ctxt :: HsExpr GhcRn -> [HsExprArg 'TcpRn] -> TcM a -> TcM a
--- Don't push an expression context if the arguments are empty,
+-- Don't push an expression context if the arguments are all EWraps,
-- because it has already been pushed by tcExpr
add_head_ctxt fun args thing_inside
- | null args = thing_inside
+ | all isEWrap args = thing_inside
| otherwise = addExprCtxt fun thing_inside