Reworked phases.

Aims

1) next/prev should be context-independent. Phase now stores
its ContextBase in a field.

2) More robust handling of phaseNamed and the phase properties
erasedTypes, flattened, refchecked, etc. These were previously
dependent on when the first call to any of these methods was made, which
led to a data race.

There is now an init method in phases which centralizes all necessary intialization.
It is checked that a phase is initialized only once.
Changes to how we compute type parameters

Aim: Avoid expensive scanning of definitions in denotations other than the initial one.

Technique:

1. If phase is erased, type params is Nil (except for Array class)
2. Otherwise, type params is the same as it was in initial phase.
Fix context.withPhase

Previous version was wrong because every context is a fresh context at runtime,
so the overriding version would always be executed, which means that withPhase
becomes a side-effecting operation!
Fix Denotations#current

The logic for dealing with periods in denotation histories did not
correctly take into account the case where the current validity period of
a denotation ends some phases before the next type transformer starts.

And there was an off-by-one error in startPid.

And Types#computeDenot erroneously tried to reload denotations even
the run did not change.
Rename stillValid to isValidInRun, add quickpath to it
 Rename methods on FreshContext to make mutation obvious

And avoid name clashes