scala/scala — pull request #1859 by retronym (2013-01-08 11:29:22+00:00)
Title: SI-6912 Avoid a typer cycle in overload resolution.

c800d1fe, and followup commits 1ddc9358 and b10b5821
modified error handling in `Infer#inferExprAlternative`.
After these changes, this method could fail to resolve
the overloaded alternative if:

best != NoSymbol
&& !competing.isEmpty
&& !noAlternatives
&& pt.isErroneous

This commit calls `setError` in that case, which
prevents the cycle in `adapt`.

While I didn't extract a reproduction from the
original code base, I've included a test case that
exhibits the same symptom.

It was actually pretty tough to find an program that
got close to this code path, but luckilly we've been
pretty close to this bug in [SI-5553](https://issues.scala-lang.org/browse/SI-5553) / 4f99c2e5, and those
test cases formed the basis for this one.

Review by @hubertp, or by @paulp if he's not about.