Fix for t1002

Need to compile the self type of a class not in the context of the class members but one context further out.
Reason: self type should not be able to see the members.
Fix problems related to t0039

This test case exercised several problems:

1.)2.) Two ways to run into a cyclic references. Fixed by
 - assuming an early info when completing a typedef, similarly to what is done for a classdef
 - doing wellformed bounds checking in a later phase.

Failure to check whether arguments correspond to F-bounds.
 - a substitution was missing.
Fix constructor completion problem detected in t0054

Constructors need to be completed in the context which immediately encloses
a class. Otherwise type references in the constructor see the wrong types,
as is demonstrated in t0054. The difficulty here is that the inner class B
nested in A also extends from A. Then it makes a difference whether the constructor
parameter types of B are resolved in the context of B or in the context of A.
Added explanation for context handling of constructors.
Added test for implicits which fail in Scala 2.11.

Mentioned in scala-user by Haoyi Li on 12-Mar-2014
Fix of #56 - newModuleSymbol & newCompleteModuleSymbol

Needs new TypeRef creation method that works for NoPrefix and at the same time
does not need a denotation. This is provided by method TermRef.withNakedSymbol.
Fix for #55

Distringuish between ModifierFlags -- which can appear in trees -- and SourceModifierFlags -- which are
modifiers according to the language spec.
PostTyper transformers

1) reorders companion objects so that they allways follow matching
classes
2) removes imports and named arguments
3) rewrites all trees holding types are to TypeTrees
TreeTransform: add support for transforming stats

Added a prepareForStats&transformStats pair of methods,
which provide a convinient way to alter scopes of
PackageDefs, Templates and Block's.
CreateCompanionObjects transformer

A transformer that provides a convenient way to create
companion objects.
add tests from scala/test/files/{pos,neg}

with explicit Unit return type
Fixed two problems with annotated types in patterns

Problem 1: The parser did not accept them. It has to accept a "RefinedType" as an ascription,
not a "WithType" (as it did before), or even a "SimpleType" (as speced in the SyntaxSummary).

Problem 2: Annotations are always typed as expressions. The annotations in question were typed
as patterns before.

Tests in Patterns.scala and in the Dotty compiler itself.
Give context to predicate of CreateCompanionObject
Stop running phases after errors were encountered
Reset frozen for transformed class denotations.

... so that we can add new members to transformed class denotations.
Reorg of info transformer framework
Renamings TreeTransformer -> TreeMap, TreeMapper -> TreeTypeMap

This makes naming uniform between trees and types, and also avoids the clash with
transform.TreeTransformer. The idea is that transformers are parts of phases, and
have logic that is phase-specific. In particular, a context is passed around when
transforming a tree. Maps are simpler, they only have a T -> T apply method.
Renaming core.Transformer(s) -> core.DenotTransformer(s)

To bring in line with TreeTransformer terminology.
Refactored denotation transformers

Many small and large changes. Added samplePhase to demonstrate functionality.

To test functioning, run the compiler with args

     tests/pos/uncurry.scala -Ylog:sample,terminal
Re-enabled and renamed tests

CreateCompanionObjectTests were re-enabled. They failed in a previous version but succeed again in the latest commit.
Also uncurry.scala got renamed to curried.scala.
LazyVals phase.

Creates accessors for lazy vals:
1) lazy local vals are rewritten to dotty.runtime.Lazy*** holders
2) for a non-volatile field lazy val create a non-thread-safe accessor and flag:
2.a) if lazy val type indicates that val is not nullable, uses null value as a flag
2.b) else uses boolean flag for sake of performance, method size, and
allowing more jvm optimizations
3) for a volatile field lazy val use double locking scheme, that guaranties no
spurious deadlocks, using long bits as bitmaps and creating companion
objects to store offsets needed for unsafe methods.