SI-2796 Warn if early definitions are used with a trait.

For which they (currently) have no special meaning.
GenASM: pipeline disk-write with building of classfiles
GenASM gets a 10% performance boost via switch
Scaladoc diff-firendly output

Scaladoc can create raw content files that we can easily diff and spot
any modifications. There is a cool project by Stefan Zeiger to export
the scaladoc model in JSON, but with the language and scaladoc being so
quick to evolve, it'll be a pain to properly maintain. In the long-run,
the plan is to sample a couple of raw files on each build and email me
the diff. If I spot anything that may be wrong I can fix it, revert the
commit or at least file a bug.

For now, .html.raw files are generated on-demand, using
  ant -Dscaladoc.raw.output="yes" <targets>

Also added a script that will do the job of diff-ing.

Review by @jsuereth.

Conflicts:

	src/compiler/scala/tools/nsc/doc/Settings.scala
Reorganized scaladoc model

Since the old model was "interruptible", it was prone to something
similar to race conditions -- where the model was creating a template,
that template creating was interrupted to creat another template, and
so on until a cycle was hit -- then, the loop would be broken by
returning the originally not-yet-finished template.

Now everything happens in a depth-first order, starting from root,
traversing packages and classes all the way to members. The previously
interrupting operations are now grouped in two categories:
 - those that were meant to add entities, like inheriting a class from
a template to the other (e.g. trait T { class C }; trait U extends T)
=> those were moved right after the core model creation
 - those that were meant to do lookups - like finding the companion
object -- those were moved after the model creation and inheritance
and are not allowed to create new documentable templates.

Now, for the documentable templates we have:

DocTemplateImpl - the main documentable template, it represents a
                  Scala template (class, trait, object or package).
                  It may only be created when modelFinished=false by
                  methods in the modelCreation object
NoDocTemplateMemberImpl - a non-documented (source not present)
                          template that was inherited. May be used as
                          a member, but does not get its own page
NoDocTemplateImpl - a non-documented (source not present) template
                    that may not be used as a member and does not
                    get its own page

For model users: you can use anything in the ModelFactory trait at
will, but not from the modelCreation object -- that is reserved for the
core model creation and using those functions may lead to duplicate
templates, invalid links and other ugly problems.
Scaladoc class diagrams part 1

This commit contains model changes required for adding class diagrams
to scaladoc. It also contains an improved implicit shadowing
computation, which hides the shadowed implicitly inherited members
from the main view and gives instructions on how to access them.

This is joint work with Damien Obrist (@damienobrist) on supporting
diagram generation in scaladoc, as part of Damien's semester project
in the LAMP laborarory at EPFL.

The full history is located at:
https://github.com/damienobrist/scala/tree/feature/diagrams-dev

Commit summary:

 - diagrams model
   - diagram settings (Settings.scala, ScalaDoc.scala)
   - diagram model object (Entity.scala, Diagram.scala)
   - model: tracking direct superclasses and subclasses,
     implicit conversions from and to (ModelFactory.scala)
   - diagram object computation (DiagramFactory.scala, DocFactory.scala)
   - capacity to filter diagrams (CommentFactory.scala,
     DiagramDirectiveParser.scala)
   - diagram statistics object (DiagramStats.scala)
   - delayed link evaluation (Body.scala, Comment.scala)
   - tests

 - improved implicits shadowing information
   - model shadowing computation (ModelFactoryImplicitSupport.scala,
     Entity.scala)
   - html generation for shadowing information (Template.scala)
   - tests

Also fixes an issue reported by @dragos, where single-line comment
expansion would lead to the comment disappearing.

Review by @kzys, @pedrofurla.

Adapted to the new model and fixed a couple of problems:
 - duplicate implicit conversions in StringAdd/StringFormat
 - incorrect implicit conversion signature (from X to X)

Conflicts:

	src/compiler/scala/tools/nsc/doc/Settings.scala
	src/compiler/scala/tools/nsc/doc/html/page/Template.scala
	src/compiler/scala/tools/nsc/doc/model/Entity.scala
	src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala
	src/compiler/scala/tools/nsc/doc/model/ModelFactoryImplicitSupport.scala
Scaladoc class diagrams part 2

This commit contains the svg diagram generation using the graphviz
package, the template changes, the css styling and javascript code
that enables displaying and interacting with the diagrams.

The full history is located at:
https://github.com/damienobrist/scala/tree/feature/diagrams-dev

The diagrams are included as svg markup inside the html code. This
enables interacting with the image beyond what would be possible
with a static image (highlighting, scaling, tooltips, links to
nodes, etc).

The svg generation has four main phases: model => dot,
dot => svg (using the graphviz package), svg postprocessing,
inclusion in the html page.

This commit also fixes SI-5212 - links to individual pages
automatically load the left navigation panel of the website.

Commit summary:

 - diagram generation
   - model => dot (DotDiagramGenerator.scala, DiagramGenerator.scala)
   - dot => svg (DotRunner.scala)
   - svg post-processing (DotDiagramGenerator.scala)
   - svg inclusion in the html (Template.scala)

 - diagram interaction
   - css, js and image files

Review by @heathermiller, @kzys.

Also fixed the memory leak that was causing the testsuite to timeout.
Documented SyncVar

Since we used it in the DocRunner and noticed it could have better
documentation.

Review by @heathermiller.
Diagram tweaks #1

- relaxed the restrictions on nodes - nodes can be classes, traits and
objects, both stand-alone and companion objects -- all are added to the
diagram, but usually companion objects are filtered out as they don't
have any superclasses
- changed the rules for default diagram creation:
  - classes and traits (and AnyRef) get inheritance diagrams
  - packages and objects get content diagrams
(can be overridden by @contentDiagram [hideDiagram] and
@inheritanceDiagram [hideDiagram])
- tweaked the model to register subclasses of Any
- hardcoded the scala package diagram to show all relations
- enabled @contentDiagram showInheritedNodes by default and changed
the setting to hideInheritedNodes (and added a test for this)
- better node selection (can select nodes that don't have a
corresponding trait)
- fixed the docsite link in member selection, which was broken since
the first commit :))
Diagram tweaks #2

- fixed the AnyRef linking (SI-5780)
- added tooltips to implicit conversions in diagrams
- fixed the intermittent dot error where node images would be left out
(dot is not reliable at all -- with all the mechanisms in place to fail
gracefully, we still get dot errors crawling their way into diagrams -
and that usually means no diagram generated, which is the most
appropriate way to fail, I think...)
SI-5830 switches: support guards, unreachability

turn switches with guards into guard-free switches by collecting all cases
that are (possibly) guarded by different guards but that switch on the same constant,
and pushing the implied if-then-else into the collapsed case body

```
case C if G1 => B1
case C if Gi => Bi
case C if GN => BN
```

becomes

```
case C => if (G1) B1
     else if (Gi) Bi
     else if (GN) BN
     else default() // not necessary if GN == EmptyTree
```

default() is a jump to the default case; to enable this, we wrap a default() { } labeldef
around the last case's body (the user-defined default or the synthetic case that throws the matcherror)
so we can jump to the default case after the last guard is checked
(assuming unreachability is checked, once we ended up in a non-default case,
one of the guards either matches or we go to the default case)

the unreachability analysis is minimal -- we simply check (after rewriting to guard-free form)
that:
  - there are no duplicate cases
  - the default case comes last

misc notes:
  - can't jump in exception handlers (TODO: a more fine-grained analysis on when we need to jump)
  - work around SI-6015 (test file run/t5830.scala crashed the inliner)
  - propagate type of case body to label def of default case
    (needed for existentials, see e.g., t2683)
  - the default(){} LabelDef breaks SelectiveANFTransform -- workaround: don't write guarded switches in CPS code
    (do the above transformation manually)
SI-5959 type equality now accounts for mirrors

TypeRef(ThisType(<package1>), sym, args) should always be equal to
TypeRef(ThisType(<package2>), sym, args) regardless of whether
package1 and package2 actually represent the same symbols of not.

This goes for subtyping (<:<) and type equality (=:=).
However regular equality (==) and hashconsing is unaffected
as per http://groups.google.com/group/scala-internals/browse_thread/thread/4bef4e6987bb68fe

This is done to account for the fact that mirrors share normal symbols,
but never share package symbols. Therefore at times it will occur that
the same types loaded by different mirrors appear different because of
the package symbols. More details: https://issues.scala-lang.org/browse/SI-5959.
tags for AnyVal and AnyRef
Adds `Type.resultType` to reflection API

Seems to be quite an essential piece of functionality.

Got requests for it from Paul back then, and now Daniel
in his latest blog post has to painfully pattern match
his way to resultType.
Merge pull request #818 from scalamacros/topic/tags-for-anyval-and-anyref

tags for AnyVal and AnyRef
Merge pull request #777 from retronym/ticket/2796

SI-2796 Warn if early definitions are used with a trait.
Merge pull request #803 from magarciaEPFL/offload-classfile-writing-B

performance improvements (10% to 20% depending on HDD vs SSD) in GenASM
Merge pull request #821 from adriaanm/64acb46ab7

SI-5830 switches: support guards, unreachability
Enhanced presentation compiler test infrastructure

* Removed unneeded .flags.
* Renamed a few methods in `InteractiveTest`.
* Force the presentation compiler to shut down after each test.
* -sourcepath in the .flags file is now relative to the test's base directory.
* Use `InteractiveReporter` in Presentation Compiler tests.
  By using the `InteractiveReporter`, compilation errors are collected in the
  compilation unit. This was necessary for testing SI-5975.
Allow attachments for symbols, just like for trees.

Removes the two global hash maps in Namers, and the one in NamesDefaults. Also fixes SI-5975.