[commit: ghc] master: In deepSplitCprType_maybe, be more forgiving (312686c)

git at git.haskell.org git at git.haskell.org
Fri Feb 7 17:59:32 UTC 2014


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/312686c172eefb74237c8a61e2cca1b2af7459c1/ghc

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

commit 312686c172eefb74237c8a61e2cca1b2af7459c1
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.


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

312686c172eefb74237c8a61e2cca1b2af7459c1
 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