diff options
author | Paul Phillips <paulp@improving.org> | 2013-01-12 21:46:49 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-01-12 21:46:49 -0800 |
commit | 5d65772762072aa950a488c666673dc248b01d6d (patch) | |
tree | c06ad41a4c23410489ba42cbf51a42036e25bc61 /src | |
parent | 9ea0a208346e86031a58fa9c28daf6103778a02f (diff) | |
parent | 7a23562431e3e9673112b0f5ec5624eb28194ee5 (diff) | |
download | scala-5d65772762072aa950a488c666673dc248b01d6d.tar.gz scala-5d65772762072aa950a488c666673dc248b01d6d.tar.bz2 scala-5d65772762072aa950a488c666673dc248b01d6d.zip |
Merge pull request #1859 from retronym/ticket/6912
SI-6912 Avoid a typer cycle in overload resolution.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Infer.scala | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index 0f52687c75..fc61aec0e3 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -1512,6 +1512,13 @@ trait Infer extends Checkable { } else if (!competing.isEmpty) { if (noAlternatives) NoBestExprAlternativeError(tree, pt, isSecondTry) else if (!pt.isErroneous) AmbiguousExprAlternativeError(tree, pre, best, competing.head, pt, isSecondTry) + else { + // SI-6912 Don't give up and leave an OverloadedType on the tree. + // Originally I wrote this as `if (secondTry) ... `, but `tryTwice` won't attempt the second try + // unless an error is issued. We're not issuing an error, in the assumption that it would be + // spurious in light of the erroneous expected type + setError(tree) + } } else { // val applicable = alts1 filter (alt => // global.typer.infer.isWeaklyCompatible(pre.memberType(alt), pt)) |