diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-05-17 10:34:09 +0100 |
---|---|---|
committer | Zubin Duggal <zubin.duggal@gmail.com> | 2021-09-21 22:28:28 +0530 |
commit | 0d92ef3513ba52d4d7b1b15eb54cbaecd55b81bd (patch) | |
tree | a50add24c0a6210ad1fd62fed213e318a64ae545 | |
parent | 6fd912f27b7a920d30568a8487b1e073b1f4d9b3 (diff) | |
download | haskell-0d92ef3513ba52d4d7b1b15eb54cbaecd55b81bd.tar.gz |
Make setBndrsDemandInfo work with only type variables
Fixes #19849
Co-authored-by: Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io>
(cherry picked from commit c4099b0908e3f4ae04312ca82af147eb1585cd09)
(cherry picked from commit 066317d688ee09ebfe1e07aa52ff171cde223d15)
-rw-r--r-- | compiler/GHC/Core/Opt/DmdAnal.hs | 9 | ||||
-rw-r--r-- | testsuite/tests/stranal/should_compile/T19849.hs | 7 | ||||
-rw-r--r-- | testsuite/tests/stranal/should_compile/all.T | 2 |
3 files changed, 15 insertions, 3 deletions
diff --git a/compiler/GHC/Core/Opt/DmdAnal.hs b/compiler/GHC/Core/Opt/DmdAnal.hs index 1cf34c2ff8..150185e3ee 100644 --- a/compiler/GHC/Core/Opt/DmdAnal.hs +++ b/compiler/GHC/Core/Opt/DmdAnal.hs @@ -1076,9 +1076,12 @@ 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) = + let !new_info = setIdDemandInfo b d + !vars = setBndrsDemandInfo bs ds + in new_info : vars 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..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 bb3fcd2952..59348d6f13 100644 --- a/testsuite/tests/stranal/should_compile/all.T +++ b/testsuite/tests/stranal/should_compile/all.T @@ -55,3 +55,5 @@ 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, ['']) |