diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2012-11-22 14:20:18 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2012-11-26 21:46:40 +0100 |
commit | 9aa6ded8e01179e7d55144de273b39f3a0b2d3ec (patch) | |
tree | 4746ee626e95c54b4a1e7e0339afae68c60dc0ff /src | |
parent | 3719f790f301852b85dcd95b401c921e286d4e1e (diff) | |
download | scala-9aa6ded8e01179e7d55144de273b39f3a0b2d3ec.tar.gz scala-9aa6ded8e01179e7d55144de273b39f3a0b2d3ec.tar.bz2 scala-9aa6ded8e01179e7d55144de273b39f3a0b2d3ec.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Implicits.scala | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index 8f32f0e653..a74470a9cd 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -1399,11 +1399,12 @@ trait Implicits { val failstart = if (Statistics.canEnable) Statistics.startTimer(oftypeFailNanos) else null val succstart = if (Statistics.canEnable) Statistics.startTimer(oftypeSucceedNanos) else null + val wasAmbigious = result.isAmbiguousFailure // SI-6667, never search companions after an ambiguous error in in-scope implicits result = materializeImplicit(pt) // `materializeImplicit` does some preprocessing for `pt` // is it only meant for manifests/tags or we need to do the same for `implicitsOfExpectedType`? - if (result.isFailure) result = searchImplicit(implicitsOfExpectedType, false) + if (result.isFailure && !wasAmbigious) result = searchImplicit(implicitsOfExpectedType, false) if (result.isFailure) { context.updateBuffer(previousErrs) |