summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-05-17 10:34:09 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-05-19 23:41:57 -0400
commitc4099b0908e3f4ae04312ca82af147eb1585cd09 (patch)
tree6af196559899d1b13c41db6061168c6d5cccf949
parent6a577cf0edb38577e703c9523a4307ae9fa7576d (diff)
downloadhaskell-c4099b0908e3f4ae04312ca82af147eb1585cd09.tar.gz
Make setBndrsDemandInfo work with only type variables
Fixes #19849 Co-authored-by: Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io>
-rw-r--r--compiler/GHC/Core/Opt/DmdAnal.hs8
-rw-r--r--testsuite/tests/stranal/should_compile/T19849.hs7
-rw-r--r--testsuite/tests/stranal/should_compile/all.T1
3 files changed, 12 insertions, 4 deletions
diff --git a/compiler/GHC/Core/Opt/DmdAnal.hs b/compiler/GHC/Core/Opt/DmdAnal.hs
index 1828f65276..373bdcb033 100644
--- a/compiler/GHC/Core/Opt/DmdAnal.hs
+++ b/compiler/GHC/Core/Opt/DmdAnal.hs
@@ -1262,10 +1262,10 @@ conservative thing and refrain from strictifying a dfun's argument
dictionaries.
-}
-setBndrsDemandInfo :: [Var] -> [Demand] -> [Var]
-setBndrsDemandInfo (b:bs) (d:ds)
- | isTyVar b = b : setBndrsDemandInfo bs (d:ds)
- | otherwise =
+setBndrsDemandInfo :: HasCallStack => [Var] -> [Demand] -> [Var]
+setBndrsDemandInfo (b:bs) ds
+ | isTyVar b = b : setBndrsDemandInfo bs ds
+setBndrsDemandInfo (b:bs) (d:ds) =
let !new_info = setIdDemandInfo b d
!vars = setBndrsDemandInfo bs ds
in new_info : vars
diff --git a/testsuite/tests/stranal/should_compile/T19849.hs b/testsuite/tests/stranal/should_compile/T19849.hs
new file mode 100644
index 0000000000..9fa50ef001
--- /dev/null
+++ b/testsuite/tests/stranal/should_compile/T19849.hs
@@ -0,0 +1,7 @@
+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 3e77a602ae..61e9c58dee 100644
--- a/testsuite/tests/stranal/should_compile/all.T
+++ b/testsuite/tests/stranal/should_compile/all.T
@@ -66,3 +66,4 @@ test('T18894b', [ grep_errmsg(r'Arity=2') ], compile, ['-ddump-stranal -dsuppre
test('T18982', [ grep_errmsg(r'\$w. .*Int#$') ], compile, ['-dppr-cols=1000 -ddump-simpl -dsuppress-idinfo -dsuppress-uniques'])
test('T19180', normal, compile, [''])
+test('T19849', normal, compile, [''])