SI-7200 Test case for fixed type inference error.

Broken in 2.9.2 and 2.10.0, but working in 2.10.1

--- sandbox/2.10.0.log
+++ sandbox/2.10.1.log
       def coflatMap[A >: Nothing <: Any, B >: Nothing <: Any](f: Test.Nel[A] => B): Test.Nel[A] => Test.Nel[B] = ((l: Test.Nel[A]) => Test.this.Nel.apply[B](f.apply(l), l.tail match {
         case immutable.this.Nil => immutable.this.Nil
-        case (hd: A, tl: List[A])scala.collection.immutable.::[A]((h @ _), (t @ _)) => {
-          val r: Test.Nel[Nothing] = NelFoo.this.coflatMap[A, Nothing](f).apply(Test.this.Nel.apply[A](h, t));
+        case (hd: A, tl: List[A])scala.collection.immutable.::[?A1]((h @ _), (t @ _)) => {
+          val r: Test.Nel[B] = NelFoo.this.coflatMap[A, B](f).apply(Test.this.Nel.apply[A](h, t));
           {
-            <synthetic> val x$1: Nothing = r.head;
-            r.tail.::[Nothing](x$1)
+            <synthetic> val x$1: B = r.head;
+            r.tail.::[B](x$1)
           }
         }
       }))

b74c33eb86 represents the exact moment of progression. Comments
in pos/t7200b.scala, a minimal test that demonstrates the problem
without type constructors or code execution, pinpoint the line of
code responsible for the fix.

Incidentally, I'm currently on a train somewhere between Solothurn
and Biel, and am consequently without the power of scala-bisector.
Undeterred, and inspired by a line I saw in Skyfall last night
("sometimes the olds ways are better"), I just pulled off a two-hop
bisection. Take that, O(log N)!

The one remaining worry is the appearance of the type variable
?A1 in the output of -Xprint:typer for run/t7200.scala.
SI-7330 better error when pattern isn't a value

Somehow an applied type managed to sneak past the type checker in pattern mode.
Patterns must be values, though.

`case C[_] =>` was probably meant to be `case _: C[_] =>`
Advice is dispensed accordingly. (Generalizing the existing advice machinery.)
Interactive scaladoc: mark new typer run when done.

As of now, when backgroundCompile is in the same typer run as
scaladoc-fetching logic, typer is confused with stale symbols.
Rewrite TailCalls for performance and immutability.

While logging symbols created after typer, I discovered that
TailCalls was far and away the largest creator. It turns out
this was due to a bug where thousands of labels were eagerly
created during tail call analysis, even if the method weren't
tail recursive and no label would ever be required.

This commit shaves 10% off the total number of method symbol
creations (compiling quick.lib drops from 88K to 80K.)
Quiet down overloaded implicit warning.

Apparently implicit classes product both a method symbol and
a module symbol, both of which are marked implicit, which left
this warning code believing there was an overloaded implicit
method.
Merge pull request #2322 from retronym/ticket/7200

SI-7200 Test case for fixed type inference error.
-Yshow-member-pos, print the positions of members.

Here for instance is a command line which leverages the
output of this option to print the method bodies of all
methods called 'transformInfo' found under src. Given
1500 source files it accomplishes this in four seconds,
thanks to -Ystop-after:parser.

% scalac -Yshow-member-pos sed -Ystop-after:parser \
    $(find src/compiler -name '*.scala') | \
    grep transformInfo | sed 's/ # .*//;' | \
    while read line; do echo "// $line" && gsed -n $line && echo; done

Or more simply, the start/end lines of each member of Random:

% scalac -Yshow-member-pos "" ./src/library/scala/util/Random.scala
./src/library/scala/util/Random.scala
20,134               class Random
 33                  def nextBoolean
 38                  def nextBytes
 43                  def nextDouble
 48                  def nextFloat
 54                  def nextGaussian
 59                  def nextInt
 65                  def nextInt
 70                  def nextLong
 81,89               def nextString
  82,86              def safeChar
   83                val surrogateStart
   84                val res
 94,98               def nextPrintableChar
 [snip]

It makes me sad I'm always in the position of having to hack
the compiler to do this sort of thing. All we need is something
like -Yinsert-phase:Foo where Foo is a class implementing a
(Phase, Tree) => Tree method, and the compiler runs all the
unit.bodies through it after each phase, and then one could
easily accomplish this in the privacy of one's own compiler.
SI-7345 Represent the boolean modes in Context in ContextMode.

 - This is a value class in the same spirit of Mode.
 - Code that temporarily changes mode can be simplified
   by saving and restoring this one field.
SI-7345 Rationalize overloads of Context#make

Used default arguments and removed of variations only used
in one place.

I couldn't eliminate them all: one remaining overload avoids
allocating a new context when the scope/owner/tree don't change,
but moving this optimizatin to the primary overload of make breaks
things. This is noted in a TODO comment.
SI-7345 Remove comment that appears obsolete.

Obsolete since ee02ad59c, as best as I can judge.
SI-7345 Use combinator to find next enclosing non-template.
SI-7345 Add Context#isLocal, akin to Symbol#isLocal

Out with the old, in with the new. `isLocal()`, which
has been removed, was unused. `isLocal`, the new entry,
has the same semantics as `Symbol#isLocal`.
SI-7345 Encapsulate warning and error buffers in ReportBuffer.

  - merge `Context#{buffer, warningBuffer}` into `Context#reportBuffer`.
  - only expose immutable copies of the error and warnings buffers
  - Introduce a convenience method, `firstError`.
  - replace `condBufferFlush` more specific methods to retain or
    clear errors by error kind.
SI-7345 Exploit named/default args
  - Collapse overloads of `rootContext`
  - make `atOwner` more concise
SI-7345 More refactoring and documentation in Contexts

  - Use `firstError match {}` rather than `if (c.hasErrors) c.firstError ..`
  - Convert implementation comments to doc comments
  - Add new doc comments
  - Refactor `Context#make` for better readability.
  - Note a few TODOs.
  - Roughly delineate the internal structure of Contexts with comments.
  - Combine `mode` and `state` methods into `contextMode`.
  - Move `isNameInScope` closer to its compadres.
  - Improving alignment, tightening access.
SI-7345 Prefer using a throwaway silent context over buffer flushing.

When we are using a throwaway silent context, we can just let it drift out of
scope and over the horizon, rather than ceremoniously flushing its buffers
on completion.

 - Applied to Scaladoc.
 - Applied to Infer#isApplicableSafe. Less manual error buffer management
   affords greater opportunity to cleanly express the logic.
 - Applied to `typerReportAnyContextErrors`.

The reasoning for the last case is as follows:

 - There were only two callers to `typerReportAnyContextErrors`, and
   they both passed in as `c` a child context of `context`.
 - That child context must share the error reporting mode and buffer
   with `context`.
 - Therefore, extracting an error from `c` and issuing it into `context`
   is a no-op. Because the error buffer is Set, it was harmless.

This part will probably textually conflict with the same change made in
SI-7319, but the end results are identical.
SI-7345 remove unused methods.
SI-7345 Move `inSilentMode` from Infer to Context.
SI-7345 Refactor manual iteration to use foreach.
SI-7345 Produce Context#imports from the context chain

Rather than keeping a List[ImportInfo] around as a field.

This sort of change reduces our bug exposure by structurally
enforcing the invariant that `Context#imports` must mirror
the `outer` chain.

This entails changing a few elements of Contexts from mutable
vars to constructor pararameters, which seems desirable anyway.

We no longer need `makeNewImport`, as `make` now inspects
the provided tree and determines does import specific things
(tracking of used imports / mixin of ImportContext) when
appropriate.

The only wrinkle in this commit is the unfortunate need to pass
`owner = null` in the extends clause of NoContext. I don't see
cleaner way around this.

Applied minor rework to `implicitss` to avoid needlessly re-evaluating
`imports` and `nextOuter`.