Refactor use of SearchFailure in implicits.

Introduces AmbiguousSearchFailure to go with the
the existing SearchFailure, and changes predicates
to use `SearchResult.{isFailure, isSuccess}`.

This doesn't change behaviour; it is a preparatory
commit for SI-6667.
Fix for SI-6712, bug in object lifting.
SI-6667 Abort after any ambiguous in-scope implicit

Rather than continuing on to a search of implicits
of the expected type.

Previously, the companion implicits were searched if the
the caller was running the implicit search in silent
mode, for example if searching for an implicit parameter
in an application which has an expected type.

After this commit, the behaviour is consistent, regardless
on silent/non-silent typing.
SI-5678 Bad return type for [Use Case] docs in Range

Many [Use Case] example in Range such as the one associated to the union method document that the method returns a Range which is just plain false.

Example:

val ran1 = Range(1,3)
val ran2 = Range(54, 57)
val result = ran1.union(ran2) // This is a perfectly valid use case yet obviously cannot be represented as a Range
adds c.introduceTopLevel

The first in the family of mutators for the global symbol table,
`introduceTopLevel` is capable of creating synthetic top-level
classes and modules.

The addition of nme.EMPTY_PACKAGE_NAME is necessary to let
programmers insert definitions into the empty package.
SI-6685 fixes error handling in typedApply

When MissingClassTagError doesn't lead to an exception, but rather
silently sets an error, we need to bubble the resulting erroneous tree
up the responsibility chain instead of mindlessly typechecking this again.

This wasn't an issue before, because as far as I can guess the
aforementioned error setter was always throwing exceptions in the most
common usage scenarios (therefore the typecheck-again-fail-again
vicious loop wasn't triggered).
SI-4664 Make scala.util.Random Serializable
Fixes SI-6558: typecheck lazy annotation info using non-silent context.

Make context for typing lazy annotations always non-silent. If lazy annotation info was created in local (silent) context, error could go unnoticed because later they would still use silent typer for typing the annotation.
SI-6558 Expand test case for annotation typos
SI-6547: elide box unbox pair only when primitives match
Merge pull request #1686 from scalamacros/ticket/6685

Ticket/6685
Split test case to workaround incomplete error report.

Reporting some errors prevents reporting others. This
residual issue had been lodged as SI-6758.
SI-6549 Improve escaping in REPL codegen.

 - Escape the LHS of an assign when printing results
   - e.g. X("").foo = bar
 - Escape val names
   - e.g. val `"` = 0`
SI-4664 [Make scala.util.Random Serializable] Add test case
SI-6535 Step back from the precipice of a cycle

Adding any non-local parent to WrapAsScala will trigger a valid
cyclic reference error. By moving the import of `Wrapper._`
inside `WrapAsScala` and `WrapAsJava`, it is not in scope when
typing the parents of those, and we avoid the cycle.

Adds a test case to show the essense of the promiscious mutual
imports that triggers this.
Adds debug logging for synthetic registration.

Investigatory tools for SI-5877
SI-5877 Support implicit classes in package objects

This used to crash, as both the package and the package object
had the synthetic method in `decls`, and the typer tried to add
the tree to both places.

Now, synthetics in the package object are excluded from the pacakge
itself.
SI-5877 Tweak the check for package object owner.

Reuses existing function `isInPackageObject` and reads
better.
Fix for rangepos crasher.

wrapClassTagUnapply was generating an unpositioned tree
which would crash under -Yrangepos.  See SI-6338.
SI-5361 Avoid cyclic type with malformed refinement

The statement `val x = this` in the refinment type:

    (new {}): {val x = this}

is lazily typechecked, in order to, according to the comment
in `typedRefinment, "avoid cyclic reference errors".

But the approximate type used ends up with:

    Refinment@1(
      parents = [...]
      decls = { val x: Refinement@1 })

This commit eagerly checks that there is no term definitions
in type refinments, rather than delaying this.

This changes the error message for SI-3614.