summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-05-17 10:34:09 +0100
committerZubin <zubin.duggal@gmail.com>2021-06-22 10:16:18 +0000
commit9c9be7c92a7ef20cc743683c6abd3b1c80281d7f (patch)
tree5f733e2f7f4d276a95722657f3a9ebd21c685548
parent1b5418b7a88989acdce5ebd15ee2d60572b51cf9 (diff)
downloadhaskell-wip/t19849-backport-9.0.tar.gz
Make setBndrsDemandInfo work with only type variableswip/t19849-backport-9.0
Fixes #19849 Co-authored-by: Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> (cherry picked from commit c4099b0908e3f4ae04312ca82af147eb1585cd09)
-rw-r--r--compiler/GHC/Core/Opt/DmdAnal.hs6
-rw-r--r--testsuite/tests/stranal/should_compile/T19849.hs9
-rw-r--r--testsuite/tests/stranal/should_compile/all.T1
3 files changed, 13 insertions, 3 deletions
diff --git a/compiler/GHC/Core/Opt/DmdAnal.hs b/compiler/GHC/Core/Opt/DmdAnal.hs
index 1cf34c2ff8..f0708f55ea 100644
--- a/compiler/GHC/Core/Opt/DmdAnal.hs
+++ b/compiler/GHC/Core/Opt/DmdAnal.hs
@@ -1076,9 +1076,9 @@ dictionaries.
-}
setBndrsDemandInfo :: [Var] -> [Demand] -> [Var]
-setBndrsDemandInfo (b:bs) (d:ds)
- | isTyVar b = b : setBndrsDemandInfo bs (d:ds)
- | otherwise = setIdDemandInfo b d : setBndrsDemandInfo bs ds
+setBndrsDemandInfo (b:bs) ds
+ | isTyVar b = b : setBndrsDemandInfo bs ds
+setBndrsDemandInfo (b:bs) (d:ds) = setIdDemandInfo b d : setBndrsDemandInfo bs ds
setBndrsDemandInfo [] ds = ASSERT( null ds ) []
setBndrsDemandInfo bs _ = pprPanic "setBndrsDemandInfo" (ppr bs)
diff --git a/testsuite/tests/stranal/should_compile/T19849.hs b/testsuite/tests/stranal/should_compile/T19849.hs
new file mode 100644
index 0000000000..d9bc2d87df
--- /dev/null
+++ b/testsuite/tests/stranal/should_compile/T19849.hs
@@ -0,0 +1,9 @@
+{-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE GADTs #-}
+module T19849 where
+
+data T where
+ C :: forall k. T
+
+f :: T -> ()
+f C = ()
diff --git a/testsuite/tests/stranal/should_compile/all.T b/testsuite/tests/stranal/should_compile/all.T
index bb3fcd2952..32fb3767cb 100644
--- a/testsuite/tests/stranal/should_compile/all.T
+++ b/testsuite/tests/stranal/should_compile/all.T
@@ -55,3 +55,4 @@ test('T13380b', [ grep_errmsg('bigDeadAction') ], compile, ['-dppr-cols=200 -dd
# We just want to find the worker of foo in there:
test('T18122', [ grep_errmsg(r'wfoo =') ], compile, ['-ddump-simpl'])
+test('T19849', normal, compile, [''])