Corralling Modes into a smaller pen.

Attempting to reduce the frequency of low-level operations
with modes. I mean stuff like this:

  if ((mode & (EXPRmode | LHSmode)) == EXPRmode)

THey don't make those ten line boolean guards any easier
to understand. Hopefully this will lead us toward eliminating
some of the modes entirely, or at least better isolating
their logic rather than having it interspersed at arbitrary
points throughout the typer.

Modes are in their entirety a leaked implementation detail.
Typing a tree requires a tree and optionally an expected type.
It shouldn't require a bucket of state bits. In subsequent
commits I will start eliminating them.

This commit also breaks adapt down into more digestible chunks.
Started eliminating modes.

Consolidating the scattered typer state in Context, where it's
relatively easy to keep an eye on, rather than threaded throughout
the typer in sneaky/sticky bitmasks. The general pattern will be
what was once an explicitly passed around bit in Mode becomes
an implicitly propagated-as-appropriate bit in Context.

In this commit:

          ALTmode becomes context mode "PatternAlternative"
         STARmode becomes context mode "StarPatterns"
  SUPERCONSTRmode becomes context mode "SuperInit"
Eliminated SNDTRYmode.

It becomes context mode "SecondTry".
Eliminated RETmode.

It becomes context mode "ReturnExpr".
Eliminated HKmode.

It becomes context mode "TypeConstructor".
Refactored stabilize.

Mode elimination ramps up in difficulty now, so I pursued
other forms of code hygiene.
Incorporated reviewer feedback.

Made things a little more consistent and self-apparent.
Merge branch 'master' into HEAD

* master:
  SI-7469 Remove @deprecated scala.util.logging
  SI-3943 Test case for already-fixed Java interop bug
  Fix formatting for couple of docs in the compiler
  SI-7476 Add documentation to GenericTraversableTemplate
  SI-7469 Remove @deprecated scala.util.parsing.ast
  SI-7469 Remove @deprecated MurmurHash elements
  SI-7469 Remove deprecated elements in s.u.parsing.combinator
  SI-7469 Make @deprecated elems in scala.concurrent private[scala]
  removes duplication in inferImplicitValue
  SI-7047 fixes silent for c.inferImplicitXXX
  SI-7167 implicit macros decide what is divergence
  macroExpandAll is now triggered in all invocations of typed
  SI-5923 instantiates targs in deferred macro applications
  SI-6406 Restore deprecated API
  SI-6039 Harden against irrelevant filesystem details
  Limit unnecessary calls to Type#toString.
  fix typo in comment
  SI-7432 add testcases
  SI-7432 Range.min should throw NoSuchElementException on empty range
  AbstractFile.getDirectory does not return null when outDir is "."

Conflicts:
	src/compiler/scala/tools/nsc/typechecker/Typers.scala
Incorporated reviewer feedback.

Made things a little more consistent and self-apparent.
Merge commit 'd93826f278' into pr/enter-elimination-mode

* commit 'd93826f278':
  Incorporated reviewer feedback.
  Incorporated reviewer feedback.
  Refactored stabilize.
  Eliminated HKmode.
  Eliminated RETmode.
  Eliminated SNDTRYmode.
  Started eliminating modes.
  Corralling Modes into a smaller pen.

Conflicts:
	src/compiler/scala/tools/nsc/typechecker/Macros.scala
	src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
	src/compiler/scala/tools/nsc/typechecker/Typers.scala
Merge remote-tracking branch 'origin/master' into pr/enter-elimination-mode

* origin/master:
  An attempt to make tests deterministic.
  SI-7427 stop crashing under -Ydebug.
Harden partest against duplicate paths.

A serious issue: partest would launch the same test multiple
times if a test path was given in multiple forms (e.g. absolute
and relative paths.) Unfortunately all those tests would share
the same logfile, output directory, etc. which would predictably
lead to explosions.

Since overwriting classfiles while being loaded can lead to
jvm core dumps, it's possible this is involved in recent jvm
crashes and other test breakdowns.

This commit also alters the default partest verbosity to only
full print test transcripts under --verbose.
Merge pull request #2571 from paulp/pr/canonicalize-paths

Harden partest against duplicate paths.
Merge pull request #2492 from paulp/pr/enter-elimination-mode

Toward more organized typer state.
Cleaning up isApplicable and neighbors.

I'd really like these methods to receive greater scrutiny.
To that end I'm scrutinizing them.
Cleaning crew moves down the hall.

Swabbing the decks of isAsSpecific and isApplicableSafe.
Wow isApplicableSafe, you don't really need to declare and
allocate a two-argument case class in order to manage a
second method call.
Moving on to checkBounds.

So much dust and debris, so little time.
Scrubbing up inferPolyAlternatives.

Now you can take inferPolyAlternatives home to meet your mother.
Commented out code from 2006.

Yes, 2006. Perhaps we should have a "sunset provision"
which removes commented-out code after seven years. Or even
slightly sooner.
Commented out code from 2007.

It's not exactly 2006-era code but it's still a little ripe.