|
This was a hard nut to crack. The problem exemplified by t2429 is that in a situation like
val x: T = foo(...)
where `foo` needs implicit parameters the expected result type `T` is propagated into the
typechecking of foo(...) and consequently also into the implicit parameter search. This
is often necessary, for instance to instantiate type parameters. But it can lead to overconstrained
searches if in fact the right expansion is
val x: T = viewToT(foo(...)(implicit params))
where `viewToT` is some implicit conversion. The fix handles that case by re-hecking the
application foo(...) with an empty result type, if the implicit parameter search fails.
But the re-checking is very subtle as is explained in the comment to `TyperState#tryWithFallback`.
|