Basing Futures on Try instead of Either
SI-6185 - add "prepare" hook to ExecutionContext

Enables important abstractions to be built on top of futures,
such as Twitter's "Local" for handling data local to a callback chain.
Temporarily skips failing test due to optimizer bug SI-6188

Also swaps the arguments to method transform on Try, so as to mirror transform on scala.concurrent.Future.
Merge branch 'try-based-futures' of https://github.com/heathermiller/scala into try-based-futures
SI-6145 lax typing of args to synthetic case-labels

Use wildcard for the expected type of the arguments of a jump to a label
synthesized by the pattern matcher... except during erasure: we must take the
expected type into account as it drives the insertion of casts!

It's ok since we're typing the translation of well-typed code. The only "type
errors" we catch are skolem mismatches. (after erasure the existential types that
before caused problems have disappeared.)

It's necessary to balance GADT magic, SI-6145, CPS type-driven transforms and
other existential trickiness. I've exhausted all other semi-clean approaches I
could think of:
  - the right thing to do -- packing existential types -- runs into limitations
    in subtyping existential types,
  - casting breaks SI-6145 (and it's an unnecessary cast at run time),
  - not casting breaks GADT typing as it requires sneaking ill-typed trees
    past typer
SI-6183 don't crash on type error in outer test

unfortunately without test case since the report was hard to minimize
since it was a crash on erroneous code, I figured a backstop against a crash should suffice
Added tests, removal of unnecessary methods, fixes prepare
Doc fix on exec ctx prepare method, fix to tests
Fix test for ExecutionContext.prepare
SI-5739 (bis) vals for subpatterns unless -optimize

To facilitate debugging pattern matches, we store the values for
sub-patterns of extractor (synthetic or user-defined) patterns in local variables.
When performing an optimized build, and when possible, we don't do store but inline them directly.

For soundness, SI-5158, SI-6070, we must always store the values of mutable case class fields.

(Specifying -optimize is the only way to suppress emitting these local variables.
An unoptimized build will always generate them, which was deemed the right default during the meeting.)

(updated flags for t4425 to get consistent runs on optimized and non-optimized partest runs
 by always passing -optimize)
Fixes SI-5687.

Recover from erroneous type alias override to report
more useful error message.
SI-6205 make pt fully defined before inferTypedPattern

refines my fix for SI-2038 (#981) by making pt fully defined before calling inferTypedPattern,
instead of making the result of inferTypedPattern fully defined

I finally realized my mistake by diffing the -Ytyper-debug output of compiling the variants with:

```
  x match {case Holder(k: A[kt]) => (k: A[kt])}
```

and

```
  (x: Any) match {case Holder(k: A[kt]) => (k: A[kt])}
```
Merge pull request #1056 from heathermiller/try-based-futures

Bases futures on Try instead of Either
Merge pull request #1073 from adriaanm/ticket-6183

SI-6183 don't crash on type error in outer test
Merge pull request #1087 from hubertp/2.10.x-issue/5687

Fixes SI-5687.
Better pattern matcher error message.

For the common case when someone hasn't quite grokked
the significance of lower case in a pattern match.  I'd
like to make all the unreachables errors, not warnings,
but there may be a bug or two to clear out first.

class A {
  def badEquals(x: Any, y: Any) = x match {
    case y => true
    case _ => false
  }
}

a.scala:3: warning: patterns after a variable pattern cannot match (SLS 8.1.1)
If you intended to match against parameter y of method badEquals, you must use backticks, like: case `y` =>
    case y => true
         ^
a.scala:4: warning: unreachable code due to variable pattern 'y' on line 3
    case _ => false
              ^
two warnings found
Merge pull request #1064 from adriaanm/ticket-6145

SI-6145 lax typing of args to synthetic case-labels
Merge pull request #1088 from adriaanm/ticket-6205

SI-6205 make pt fully defined before inferTypedPattern
Merge pull request #1060 from adriaanm/ticket-5739b

SI-5739 (bis) vals for subpatterns when -g:patmatvars
Moved inline logic before pickler.

The test case failed due to separate compilation. The problem was
that we don't pickle the fact that the field was made public.

Original patch by @odersky. Cleaned up by me. Changes I made:

  * removed stale test-case
  * reduced whitespace changes

Supersedes #1089.

Review by @odersky and @moors.