[commit: ghc] ghc-7.8: In deepSplitCprType_maybe, be more forgiving (6e3feef)

git at git.haskell.org git at git.haskell.org
Mon Feb 17 09:14:55 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-7.8
Link       : http://ghc.haskell.org/trac/ghc/changeset/6e3feefb818ae04ff326ba7815ccaf4aa9d3f2ab/ghc

>---------------------------------------------------------------

commit 6e3feefb818ae04ff326ba7815ccaf4aa9d3f2ab
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Fri Feb 7 17:59:29 2014 +0000

    In deepSplitCprType_maybe, be more forgiving
    
    the ConTag may be out of range (e.g. if the type constructor is imported
    via SOURCE and we don't know any of its data constructors); just return
    Nothing without complaining in that case. This fixes #8743.
    
    (cherry picked from commit 312686c172eefb74237c8a61e2cca1b2af7459c1)


>---------------------------------------------------------------

6e3feefb818ae04ff326ba7815ccaf4aa9d3f2ab
 compiler/stranal/WwLib.lhs                   |    4 +++-
 testsuite/tests/stranal/should_compile/all.T |    2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/compiler/stranal/WwLib.lhs b/compiler/stranal/WwLib.lhs
index 57937d6..f88c9ad 100644
--- a/compiler/stranal/WwLib.lhs
+++ b/compiler/stranal/WwLib.lhs
@@ -529,7 +529,9 @@ deepSplitCprType_maybe fam_envs con_tag ty
   , Just (tc, tc_args) <- splitTyConApp_maybe ty1
   , isDataTyCon tc
   , let cons = tyConDataCons tc
-        con = ASSERT( cons `lengthAtLeast` con_tag ) cons !! (con_tag - fIRST_TAG)
+  , cons `lengthAtLeast` con_tag -- This might not be true if we import the
+                                 -- type constructor via a .hs-bool file (#8743)
+  , let con  = cons !! (con_tag - fIRST_TAG)
   = Just (con, tc_args, dataConInstArgTys con tc_args, co)
 deepSplitCprType_maybe _ _ _ = Nothing
 \end{code}
diff --git a/testsuite/tests/stranal/should_compile/all.T b/testsuite/tests/stranal/should_compile/all.T
index 2c53ebb..0d10a99 100644
--- a/testsuite/tests/stranal/should_compile/all.T
+++ b/testsuite/tests/stranal/should_compile/all.T
@@ -18,5 +18,5 @@ test('newtype', req_profiling, compile, ['-prof -auto-all'])
 test('T1988', normal, compile, [''])
 test('T8467', normal, compile, [''])
 test('T8037', normal, compile, [''])
-test('T8743', [ expect_broken(8743), extra_clean(['T8743.o-boot', 'T8743.hi-boot']) ], multimod_compile, ['T8743', '-v0'])
+test('T8743', [ extra_clean(['T8743.o-boot', 'T8743.hi-boot']) ], multimod_compile, ['T8743', '-v0'])
 



More information about the ghc-commits mailing list