summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-08-14 23:50:00 +0200
committerJason Zaugg <jzaugg@gmail.com>2013-08-15 10:35:42 +0200
commit3222add79cb873ee42a1459edcea1c9cb61d8ec9 (patch)
treeb19cfa3f58ad248c5e516cd2aa3fd7123ba62e00 /src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala
parentf1886cdc9d921d5878105c59b0b22a812b3e4458 (diff)
downloadscala-3222add79cb873ee42a1459edcea1c9cb61d8ec9.tar.gz
scala-3222add79cb873ee42a1459edcea1c9cb61d8ec9.tar.bz2
scala-3222add79cb873ee42a1459edcea1c9cb61d8ec9.zip
SI-7752 Don't disambiguate type parameters of overloaded alts
These are passed through from `InferencerContextErrors#applyErrorMsg` to `withDisambiguation` as the `locals` parameter, which is promptly ignored. This looks to be an unintended change in 39938bcc299. Without this patch, the enclosed test case enters a pathalogical disambiguation session, that not only flirts with unpleasant big-O complexities, but also flails about appending "(in method foo)" only to find that *all* occurences of the same-named type parameter come from some method named "foo". [snipping error message 40 seconds in the making] method foo), O(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo), P(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo), Q(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo), R(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo), S(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo), T, U(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo)(in method foo), V) cannot be applied to (Int) foo((1))
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala
index 4950a7efef..2270e812eb 100644
--- a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala
@@ -366,11 +366,14 @@ trait TypeDiagnostics {
val strings = mutable.Map[String, Set[TypeDiag]]() withDefaultValue Set()
val names = mutable.Map[Name, Set[TypeDiag]]() withDefaultValue Set()
- def record(t: Type, sym: Symbol) = {
- val diag = TypeDiag(t, sym)
+ val localsSet = locals.toSet
- strings("" + t) += diag
- names(sym.name) += diag
+ def record(t: Type, sym: Symbol) = {
+ if (!localsSet(sym)) {
+ val diag = TypeDiag(t, sym)
+ strings("" + t) += diag
+ names(sym.name) += diag
+ }
}
for (tpe <- types ; t <- tpe) {
t match {