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 methods on FreshContext to make mutation obvious

And avoid name clashes
Fix #95: Phases now have their own periods.
Merge pull request #100 from DarkDimius/treetransform-next

Give phases periods, not only id's
Reworked erasure denotation transformer

Now works for all combinations of

    java/scala
    sue ErasedValueClass/go directly to underlying type
    constructors/others
    wildcards ok/not

Signatures had to be refined as well, because the signature depends
on whether a type comes form Java or Scala (handling of intersections
is different).

Also, replaced splitArray method in TypeApplication by extractors for
single- and multi-dimensional array types in definitions.
Transform for normalizing type tests and type casts

To be executed before erasure.
More flexible () applications.

New method ensureApplied which will add a () parameter list if
a tree's widened type takes parameters.

Used in numericConversion, so that we are independent whether we
run before () insertion or after. With that change TypeTestCasts can stay enabled for
the whole build.

Conflicts:
	src/dotty/tools/dotc/ast/tpd.scala
Fix error message for missing parameters
Summary printing

Added general way to produce summaries when shwowing trees or types.
Summaries have limited, configrable recusion depth.
fix showSummary
Erasure phase PoC

Still missing: bridge method generation, signatures.

Other changes

 - Turned around Checking and NoChecking. Checking is the default, NoChecking
   disables it.

 - Refactored Typer#typed to expose typedNamed, so that it can be overridden in
   erasure.

 - Made logging more forgiving wrt off-buy-one phase errors.

Conflicts:
	src/dotty/tools/dotc/typer/Typer.scala
Enable squashed phases by default.

Squash was accidenbtally turned off before. Is now on again.
Take phase control settings into account

Run now interprets correctly

     -YstopBefore
     -YstopAfter
     -Yskip
     -Tprint

phase settings. For now, we stop by default before
erasure, until erasure is fully debugged.
Fixes to erasure

Various fixes to the tree transformer.

In the denotation transformer we now keep self types around because otherwise
sourceModule would stop to work.

Conflicts:
   src/dotty/tools/dotc/core/transform/Erasure.scala