summaryrefslogtreecommitdiff
path: root/compiler/GHC
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2020-02-15 18:39:05 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-02-21 20:45:21 -0500
commit0482f58ab0490b2394ad60946dde3214a0ca1810 (patch)
tree86ffcb9761d1d8288d256ad2dbf25014a11c9200 /compiler/GHC
parent0a4c89b208c59ddf79c55ee446fcad5a012bb1bc (diff)
downloadhaskell-0482f58ab0490b2394ad60946dde3214a0ca1810.tar.gz
TH: wrapGenSyns, don't split the element type too much
The invariant which allowed the pervious method of splitting the type of the body to find the type of the elements didn't work in the new overloaded quotation world as the type can be something like `WriterT () m a` rather than `Q a` like before. Fixes #17839
Diffstat (limited to 'compiler/GHC')
-rw-r--r--compiler/GHC/HsToCore/Quote.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/GHC/HsToCore/Quote.hs b/compiler/GHC/HsToCore/Quote.hs
index 07ab2959ba..292cb4dca0 100644
--- a/compiler/GHC/HsToCore/Quote.hs
+++ b/compiler/GHC/HsToCore/Quote.hs
@@ -2122,10 +2122,12 @@ wrapGenSyms binds body@(MkC b)
= do { var_ty <- lookupType nameTyConName
; go var_ty binds }
where
- (_, [elt_ty]) = tcSplitAppTys (exprType b)
+ (_, elt_ty) = tcSplitAppTy (exprType b)
-- b :: m a, so we can get the type 'a' by looking at the
- -- argument type. NB: this relies on Q being a data/newtype,
- -- not a type synonym
+ -- argument type. Need to use `tcSplitAppTy` here as since
+ -- the overloaded quotations patch the type of the expression can
+ -- be something more complicated than just `Q a`.
+ -- See #17839 for when this went wrong with the type `WriterT () m a`
go _ [] = return body
go var_ty ((name,id) : binds)