Inject implicit bindings after CoreTidy, not before Simplify
Originally I inject the "implicit bindings" (record selectors, class
method selectors, data con wrappers...) after CoreTidy. However, in a
misguided attempt to fix Trac #2070, I moved the injection point to
before the Simplifier, so that record selectors would be optimised by
the simplifier.
This was misguided because record selectors (indeed all implicit bindings)
are GlobalIds, whose IdInfo is meant to be frozen. But the Simplifier,
and other Core-to-Core optimisations, merrily change the IdInfo. That
ultimately made Trac #2844 happen, where a record selector got arity 2,
but the GlobalId (which importing scopes re-construct from the class decl
rather than reading from the interface file) has arity 1.
So this patch moves the injection back to CoreTidy. Happily #2070 should
still be OK because we now use CoreSubst.simpleOptExpr on the unfoldings
for implict things, which gets rid of the most gratuitous infelicities.
Still, there's a strong case for stoppping record selectors from being
GlobalIds, and treating them much more like dict-funs. I'm thinking
about that. Meanwhile, #2844 is ok now.