diff options
| author | Joachim Breitner <mail@joachim-breitner.de> | 2014-02-07 17:59:29 +0000 |
|---|---|---|
| committer | Joachim Breitner <mail@joachim-breitner.de> | 2014-02-07 17:59:29 +0000 |
| commit | 312686c172eefb74237c8a61e2cca1b2af7459c1 (patch) | |
| tree | 705cc336844aa1f978b611117f026a4c6835286b | |
| parent | c3ff5f29c80680a09c7779aee2535fa64b880cd9 (diff) | |
| download | haskell-312686c172eefb74237c8a61e2cca1b2af7459c1.tar.gz | |
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.
| -rw-r--r-- | compiler/stranal/WwLib.lhs | 4 | ||||
| -rw-r--r-- | 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 57937d696f..f88c9ad54f 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 2c53ebb252..0d10a99fe6 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']) |
