scala/scala — pull request #3828 by retronym (2014-06-23 10:00:31+00:00)
Title: SI-8675 Avoid unreported error after second try using implicit view

This is specific to situations in which we first typecheck an
application `qual.m(arg)` against the method `m` directly provided
by `qual`, and then fall back to `implicitView(qual).m(arg)`.

Regressed in SI-3971 / 7fa77af, in which error reports were moved
to the innermost `Apply`, and the check for `errorInResult` was
accordingly changed to recurse through `Apply` trees.

Before that change, we did not fall back to using a view. After the
change, we do try a view. We retypecheck the arguments under the
`retyping` mode (see `tryTypedArgs`), but this doesn't seem to
be enough to avoid leaking the error typed nested trees from the
first try.

Here's an example from the enclosed test case:

a.update(0, x[A]({new isString(true)}))
`-- error typed

refArrayOps(a).update(0, x[A]({new isString(true)}))
` `-- error type persists
`-- this tree is retypecked by tryTypedArgs

This commit changes `onError` to only proceed with the second
try if the retyped argument trees are error free.