summaryrefslogtreecommitdiff
path: root/compiler/stranal
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2014-02-07 17:59:29 +0000
committerJoachim Breitner <mail@joachim-breitner.de>2014-02-07 17:59:29 +0000
commit312686c172eefb74237c8a61e2cca1b2af7459c1 (patch)
tree705cc336844aa1f978b611117f026a4c6835286b /compiler/stranal
parentc3ff5f29c80680a09c7779aee2535fa64b880cd9 (diff)
downloadhaskell-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.
Diffstat (limited to 'compiler/stranal')
-rw-r--r--compiler/stranal/WwLib.lhs4
1 files changed, 3 insertions, 1 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}