diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2012-05-13 17:47:00 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2012-05-25 22:52:41 +0200 |
commit | 510f63778011060a8d912085b7248ef69e4217f8 (patch) | |
tree | 94b3aa1bd8d8e3e5209b839576339f9068a3bd9d /src/compiler/scala/tools/nsc/typechecker/Implicits.scala | |
parent | df3689f8da225679f4af85be2c4da47370b148cd (diff) | |
download | scala-510f63778011060a8d912085b7248ef69e4217f8.tar.gz scala-510f63778011060a8d912085b7248ef69e4217f8.tar.bz2 scala-510f63778011060a8d912085b7248ef69e4217f8.zip |
SI-5318 Make implicit divergence checking PolyType aware.
Replaces the two active subclasses of `SymCollector` with
direct use of traversal methods of `Type`.
Wildcard free class type parameters, not just method type parameters,
when stripping the core type of candidate implicits. The spec doesn't
make any such distinction, and the enclosed test, t5318c, crashes
without this change.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Implicits.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Implicits.scala | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala index 8f025336bb..43b96314b0 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala @@ -346,7 +346,11 @@ trait Implicits { case _ => tp } def stripped(tp: Type): Type = { - deriveTypeWithWildcards(freeTypeParametersNoSkolems.collect(tp))(tp) + // `t.typeSymbol` returns the symbol of the normalized type. If that normalized type + // is a `PolyType`, the symbol of the result type is collected. This is precisely + // what we require for SI-5318. + val syms = for (t <- tp; if t.typeSymbol.isTypeParameter) yield t.typeSymbol + deriveTypeWithWildcards(syms.distinct)(tp) } def sum(xs: List[Int]) = (0 /: xs)(_ + _) def complexity(tp: Type): Int = tp.normalize match { |