[nomaster] SI-5923 a simple alternative to onInfer

This fix provides implicit macros with an ability to affect type inference
in a more or less sane manner. That's crucial for materialization of
multi-parametric type class instances (e.g. Iso's from shapeless).
Details of the technique can be found in comments.

NOTE: The changes introduced here are good from the conceptual point of view,
but are sub-standard as far as clarity and cleanliness are concerned.
As the latest advances in implicit macrology show, there's no need for
an elaborate mechanism of keeping track of undetparams in Macros.scala,
therefore we should really clean that stuff out. However, this is 2.10.x,
and I want to minimize the surface of code changes in order to make sure
I don't break anything.

Having said all that, I'd like to note that this commit is only targeted
at 2.10.x. There's no reason for it to be merged into master.
[nomaster] SI-7167 implicit macros decide what is divergence

Imagine a macro writer which wants to synthesize a complex implicit
Complex[T] by making recursive calls to Complex[U] for its parts.

E.g. if we have `class Foo(val bar: Bar)` and `class Bar(val x: Int)`,
then it's quite reasonable for the macro writer to synthesize
Complex[Foo] by calling `inferImplicitValue(typeOf[Complex[Bar])`.

However if we didn't insert `info.sym.isMacro` check in `typedImplicit`,
then under some circumstances (e.g. as described in http://groups.google.com/group/scala-internals/browse_thread/thread/545462b377b0ac0a)
`dominates` might decide that `Bar` dominates `Foo` and therefore a
recursive implicit search should be prohibited.

Now when we yield control of divergent expansions to the macro writer,
what happens next? In the worst case, if the macro writer is careless,
we'll get a StackOverflowException from repeated macro calls. Otherwise,
the macro writer could check `c.openMacros` and `c.openImplicits` and
do `c.abort` when expansions are deemed to be divergent. Upon receiving
`c.abort` the typechecker will decide that the corresponding implicit
search has failed which will fail the entire stack of implicit searches,
producing a nice error message provided by the macro writer.

NOTE: the original commit from macro paradise also introduced a new
class, which encapsulates information about implicits in flight.
Unfortunately we cannot do that in 2.10.x, because of binary compatibility
concerns, therefore I'm marking this commit as [nomaster] and will be
resubmitting its full version in a separate pull request exclusively
targetting master.
[nomaster] SI-7291: No exception throwing for diverging implicit expansion

Since we don't throw exceptions for normal errors it was a bit odd
that we don't do that for DivergingImplicit.
As SI-7291 shows, the logic behind catching/throwing exception
was broken for divergence. Instead of patching it, I rewrote
the mechanism so that we now another SearchFailure type related
to diverging expansion, similar to ambiguous implicit scenario.
The logic to prevent diverging expansion from stopping the search
had to be slightly adapted but works as usual.

The upside is that we don't have to catch diverging implicit
for example in the presentation compiler which was again showing
that something was utterly broken with the exception approach.

NOTE: This is a partial backport of https://github.com/scala/scala/pull/2428,
with a fix for SI-7291, but without removal of error kinds (the former is
absolutely necessary, while the latter is nice to have, but not a must,
therefore I'm not risking porting it to 2.10.x). Also, the fix for SI-7291
is hidden behind a flag named -Xdivergence211 in order not to occasionally
break the code, which relies on pre-fix behavior.
[nomaster] SI-7047 fixes silent for c.inferImplicitXXX

silent = true now throws a TypecheckException even if we don't know why
an implicit search has failed (i.e. if context.hasErrors is false).

NOTE: this commit is a part of a pull request for 2.10.x, which makes sense of
implicit macros. Everything in that pull request is [nomaster] due to one
reason or another. This commit would work equally well in both 2.10.x and
master, but I'm marking it as [nomaster] as well, because I'm anyway going
to resubmit the whole pull request into master soon, so there's no reason
to introduce additional confusion.
[nomaster] SI-7166 catches DivergentImplicit in c.inferImplicitXXX

Despite inferImplicit usually being nice and buffering errors, apparently
it can also throw DivergentImplicit exception. This patch catches it and
only reports it if silent is set to false.

NOTE: we no longer have the DivergentImplicit exception in master,
so this commit only makes sense in 2.10.x.
[nomaster] removes duplication in inferImplicitValue

Shame-driven development at its best.