[project @ 2005-01-31 13:25:33 by simonpj]
--------------------------- Types and evaluated-ness in CoreTidy and CorePrep --------------------------- This commmit fixes two problems. 1. DataToTagOp requires its argument to be evaluated, otherwise it silently gives the wrong answer. This was not happening because we had case (tag2Enum x) of y -> ...(dataToTag y)... and the tag2Enum was being inlined (it's non-speculative), giving ...(dataToTag (tag2Enum x))... Rather than relying on a somewhat-delicate global invariant, CorePrep now establishes the invariant that DataToTagOp's argument is evaluated. It does so by putting up-to-date is-evaluated information into each binder's UnfoldingInfo; not a full unfolding, just the (OtherCon ) for evaluated binders. Then there's a special case for DataToTag where applications are dealt with. Finally, we make DataToTagOp strict, which it really is. 2. CoreTidy now does GADT refinement as it goes. This is important to ensure that each variable occurrence has informative type information, which in turn is essential to make exprType work (otherwise it can simply crash). [This happened in test gadt/tdpe] CorePrep has the same problem, but the solution is a little different: when looking up in the cloning environment, use the type at the occurrence site if we're inside a GADT. It might be cleaner to use the same story as CoreTidy, but then we'd need to keep an in-scope set for type variables. No big deal either way.