SI-6448 Collecting the spoils of PartialFun#runWith

Avoids calling both `isDefinedAt` and `apply`. This pathological
case that would benefit the most looks like:

  xs collect {
    case x if {expensive(); true} => x
  }

The typical change looks like:

-    for (x <- this) if (pf.isDefinedAt(x)) b += pf(x)
+    foreach(pf.runWith(b += _))

Incorporates feedback provided by Pavel Pavlov:

  https://github.com/retronym/scala/commit/ef5430

A few more opportunities for optimization are noted in the
`Pending` section of the enclosed test. `Iterator.collect`
would be nice, but a solution eludes me.

Calling the guard less frequently does change the behaviour
of these functions in an obervable way, but not contravene
the documented semantics. That said, there is an alternative
opinion on the comment of the ticket:

  https://issues.scala-lang.org/browse/SI-6448
show developer guidelines on opening pull request

Includes "Improvements and typo fixes to CONTRIBUTING.md" by @heathercmiller
as well as feedback from @retronym.
SI-6632 SI-6633 Fixes issues and data corruption in ListBuffer

 - Disallow negative positions for ListBuffer#insert/insertAll/update
 - Fix data corruption issue in ListBuffer#insert
SI-6640 Better reporting of deficient classpaths.

In a55788e, StubSymbols were introduced to fail-slow when
the classpath was deficient. This allowed compilation to
succeed in cases when one didn't actually use the part of
class A which referred to some missing class B.

But a few problems were introduced.

Firstly, when the deferred error eventually happened, it was
signalled with abort(msg), rather than through a thrown
MissingRequirementError. The latter is desirable, as it doesn't
lead to printing a stack trace.

Second, the actual error message changed, and no longer
included the name of the class file that refers to the missing
class.

Finally, it seems that we can end up with a stub term symbol
in a situation where a class symbol is desired. An assertion
in the constructor of ThisType throws trips when calling .isClass,
before the useful error message from StubSymbol can be emitted.

This commit addresses these points, and rewords the error
a little to be more accessible. The last point is the most fragile
in this arrangement, there might be some whack-a-mole
required to find other places that also need this.
I don't see a clean solution for this, but am open to suggestions.

We should really build a facility in partest to delete
specified classfiles between groups in separate compilation
tests, in order to have tests for this. I'll work on that as a followup.

For now, here's the result of my manual testing:

[info] Set current project to default-821d14 (in build file:/Users/jason/code/scratch1/)
> compile

[info] Compiling 1 Scala source to /Users/jason/code/scratch1/target/scala-2.10/classes...
[error]
[error]      while compiling: /Users/jason/code/scratch1/test.scala
[error]         during phase: typer
[error]      library version: version 2.10.0-RC2
[error]     compiler version: version 2.10.0-RC2
...
[error]   last tree to typer: Ident(SwingWorker)
[error]               symbol: <none> (flags: )
[error]    symbol definition: <none>
[error]        symbol owners:
[error]       context owners: object Test -> package <empty>
 ...
[error] uncaught exception during compilation: java.lang.AssertionError
[trace] Stack trace suppressed: run last compile:compile for the full output.
[error] (compile:compile) java.lang.AssertionError: assertion failed: value actors
[error] Total time: 2 s, completed Nov 10, 2012 3:18:34 PM
>
> set scalaHome := Some(file("/Users/jason/code/scala/build/pack"))
[info] Defining *:scala-home
[info] The new value will be used by no settings or tasks.
[info] Reapplying settings...
[info] Set current project to default-821d14 (in build file:/Users/jason/code/scratch1/)
^[compile
[info] Compiling 1 Scala source to /Users/jason/code/scratch1/target/scala-2.10/classes...
[error] /Users/jason/code/scratch1/test.scala:4: A signature in SwingWorker.class refers to term actors in package scala which is missing from the classpath.
[error] object Test extends SwingWorker
[error]                     ^
[error] one error found
[error] (compile:compile) Compilation failed
[error] Total time: 2 s, completed Nov 10, 2012 3:18:45 PM
Refine the message and triggering of MissingRequirementError.

 - To force a failure of the stub, call a new method `failIfStub`
   rather than `info`.
 - Offer a broader range of potential root causes in the
   error message.
SI-6440 Address regressions around MissingRequirementError

 Go back to using globalError to report when a stub's info is referenced,
 and only throw the MissingRequirementError when compilation really
 must abort due to having a StubTermSymbol in a place where a
 StubClassSymbol would have been a better choice.

 This situation arises when an entire package is missing from the
 classpath, as was the case in the reported bug.

 Adds `StoreReporterDirectTest`, which buffers messages issued
 during compilation for more structured interrogation. Use this
 in two test for manifests -- these tests were using a crude means
 of grepping compiler console output to focus on the relevant output,
 but this approach was insufficient with the new multi-line error
 message emitted as part of this change.

 Also used that base test class to add two new tests: one for
 the reported error (package missing), and another for a simpler
 error (class missing). The latter test shows how stub symbols
 allow code to compile if it doesn't the subset of signatures
 in some type that refer to a missing class.

 Gave the INFO/WARNING/ERROR members of Reporter sensible
 toString implementations; they inherit from Enumeration#Value
 in an unusual manner (why?) that means the built in toString of
 Enumeration printed `Severity@0`.
sane printing of renamed imports

Having a select named "foo" with an underlying symbol named "bar"
and trying to make sense of all that by prettyprinting is very confusing
Fix raw string interpolator: string parts which were after the first argument were still escaped
SI-6648 copyAttrs must preserve TypeTree#wasEmpty

This field tracks whether the type is an inferred
on, subject to removal in `resetAttrs`, or an explicit
type, which must remain.

In ae5ff662, `ResetAttrs` was modified to duplicate
trees, rather than mutate trees in place. But the
tree copier didn't pass `wasEmpty` on to the new tree,
which in turn meant that the subsequent typing run
on the tree would not re-infer the types. If the
type refers to a local class, e.g. the anonymous
function in the enclosed test case, the reference
to the old symbol would persist.

This commit overrides `copyAttrs` in TypeTree to
copy `wasEmpty`.

We might consider representing this as a tree
attachment, but this would need to be validated
for the performance impact.
Fixes SI-6559 - StringContext not using passed in escape function.

As reported by Curtis Stanford, with indication of what to fix.  standardInterpolator was not correctly
calling the passed in process function, so raw strings were not really raw.
SI-5330, SI-6014 deal with existential self-type

This has been broken since https://github.com/scala/scala/commit/b7b81ca2#L0L567.
The existential rash is treated in a similar manner as in fc24db4c.

Conceptually, the fix would be `def selfTypeSkolemized =
widen.skolemizeExistential.narrow`, but simply widening before
narrowing achieves the same thing. Since we're in existential voodoo
territory, let's go for the minimal fix: replacing `this.narrow` by
`widen.narrow`.

--
Original patch by @retronym in #1074, refined by @paulp to
only perform widen.narrow incantation if there are
existentials present in the widened type, as
narrowing is expensive when the type is not a singleton.

The result is that compiling the entirety of quick, that
code path is hit only 143 times.  All the other calls hit
.narrow directly as before.  It looks like the definition
of negligible in the diff of -Ystatistics when compiling
src/library/scala/collection:

    < #symbols                      : 306315
    ---
    > #symbols                      : 306320
    12c13
    < #unique types                 : 293859
    ---
    > #unique types                 : 293865

I'm assuming based on the 2/1000ths of a percent increase
in symbol and type creation that wall clock is manageable,
but I didn't measure it.
Fixes SI-6150 - backport to 2.10.x branch.
SI-6661 - Remove obsolete implicit parameter of scala.concurrent.promise method

Clarification of @heathermiller:
This is an inconsistency introduced after refactoring implicit ExecutionContexts.
In commit 1dfce90246f7d334 the implicit ExecutionContexts were removed from everything else in Promise.scala,
but it appears that method promise was missed in the scala.concurrent package object, which would've made
sense to remove back then.
Fixes SI-6628, Revert "Fix for view isEmpty."

This reverts commit caf7eb6b56817fd1e1fbc1cf017f30e6f94c6bea.

I don't have a better idea right now than wholesale reversion.
Merge pull request #1612 from scalamacros/topic/showraw

sane printing of renamed imports
SI-6634 Fixes data corruption issue in ListBuffer#remove

This is the cut-down version with minimally invasive changes,
e. g. keeping the "auto-correcting" bounds algorithm.
Merge pull request #1614 from phaller/issue/correct-promise-signature

SI-6661 - Remove obsolete implicit parameter of scala.concurrent.promise method
Merge pull request #1615 from retronym/ticket/6648

SI-6648 copyAttrs must preserve TypeTree#wasEmpty
Merge pull request #1616 from retronym/backport/6559

SI-6559 Fix raw string interpolator: string parts which were after the first argument were still escaped
Merge pull request #1636 from paulp/issue/6628

Fixes SI-6628, Revert "Fix for view isEmpty."