diff --git a/compiler/basicTypes/MkId.hs b/compiler/basicTypes/MkId.hs index 03ab04a24c6c8bcddce3a1c5d38a32ad6fcfda80..87e40dd62f79952a537a7a62ed7d9b0747331fae 100644 --- a/compiler/basicTypes/MkId.hs +++ b/compiler/basicTypes/MkId.hs @@ -530,7 +530,11 @@ mkDataConRep dflags fam_envs wrap_name mb_bangs data_con wrap_sig = mkClosedStrictSig wrap_arg_dmds (dataConCPR data_con) - wrap_arg_dmds = map mk_dmd arg_ibangs + wrap_arg_dmds = + replicate (length theta) topDmd ++ map mk_dmd arg_ibangs + -- Don't forget the dictionary arguments when building + -- the strictness signature (#14290). + mk_dmd str | isBanged str = evalDmd | otherwise = topDmd diff --git a/testsuite/tests/stranal/should_run/T14290.hs b/testsuite/tests/stranal/should_run/T14290.hs new file mode 100644 index 0000000000000000000000000000000000000000..7093239d4c223ef18fa8a7c4a6258372715fa064 --- /dev/null +++ b/testsuite/tests/stranal/should_run/T14290.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE ExistentialQuantification #-} +module Main (main) where + +main :: IO () +main = r `seq` return () + +r :: Rec +r = Rec{ a = error "xxx", b = 3, c = True } + +class C t +instance C Bool + +data Rec = forall t. C t => Rec + { a :: () + , b :: !Int + , c :: t + } diff --git a/testsuite/tests/stranal/should_run/all.T b/testsuite/tests/stranal/should_run/all.T index 076474608ef23845e9c68a922ed0e6633d000c04..dada8176cbc146e21de076ed506bfeaca9eef960 100644 --- a/testsuite/tests/stranal/should_run/all.T +++ b/testsuite/tests/stranal/should_run/all.T @@ -15,3 +15,4 @@ test('T11555a', normal, compile_and_run, ['']) test('T12368', exit_code(1), compile_and_run, ['']) test('T12368a', exit_code(1), compile_and_run, ['']) test('T13380', [expect_broken(13380), exit_code(1)], compile_and_run, ['']) +test('T14290', normal, compile_and_run, [''])