Fix an nasty black hole, concerning computation of isRecursiveTyCon
authorsimonpj@microsoft.com <unknown>
Mon, 30 Mar 2009 08:49:12 +0000 (08:49 +0000)
committersimonpj@microsoft.com <unknown>
Mon, 30 Mar 2009 08:49:12 +0000 (08:49 +0000)
commit59fa6266f00b6edcfc20c491c8de9a1b215dfa22
treeec66c2b33328d51da9fe6bafc8e9c0616c306cea
parent21eea25f1212ec306aac806233a2ec048212d529
Fix an nasty black hole, concerning computation of isRecursiveTyCon

Fixing #246 (pattern-match order in record patterns) made GHC go into
a black hole, by changing the order of patterm matching in
TyCon.isProductTyCon!  It turned out that GHC had been avoiding the
black hole only by the narrowest of margins up to now!

The black hole concerned the computation of which type constructors
are recursive, in TcTyDecls.calcRecFlags.  We now refrain from using
isProductTyCon there, since it triggers the black hole (very
indirectly).  See the "YUK YUK" comment in the body of calcRecFlags.

As it turns out, the fact that TyCon.isProductTyCon matched on the
algTcRec field was quite redundant, so I removed that too.  However,
without the fix to calcRecFlags, this wouldn't fix the black hole
because of the use of isRecursiveTyCon in BuildTyCl.mkNewTyConRhs.

Anyway, it's fine now.
compiler/typecheck/TcTyDecls.lhs
compiler/types/TyCon.lhs