summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-11-19 20:33:43 +0100
committerJason Zaugg <jzaugg@gmail.com>2013-11-19 20:47:12 +0100
commit60ac821192c1b19f91f19eb7a746f0889b3e804e (patch)
treeb07f32c6751c2762db7ff4a4d15347536a566079 /src/compiler/scala/tools/nsc/typechecker/Implicits.scala
parentd8ffaac6ae544457fa43f2ede674bbe80930cc27 (diff)
downloadscala-60ac821192c1b19f91f19eb7a746f0889b3e804e.tar.gz
scala-60ac821192c1b19f91f19eb7a746f0889b3e804e.tar.bz2
scala-60ac821192c1b19f91f19eb7a746f0889b3e804e.zip
Account for a variation of package types in Implicit Divergence.
While debugging pos/t7983.scala, I noticed that: complexity(scala.type): 1 complexity(Int): 2 The intent of the code is that top level classes should have a complexity of one. This commit restores that for cases when we see the prefix type as a ThisType, rather than a SingleType. I can't construct a test case in which this small difference is observable in the divergence checks.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Implicits.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index d9a4f60d48..025c262c8d 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -404,6 +404,7 @@ trait Implicits {
def complexity(tp: Type): Int = tp.dealias match {
case NoPrefix => 0
case SingleType(pre, sym) => if (sym.isPackage) 0 else complexity(tp.dealiasWiden)
+ case ThisType(sym) => if (sym.isPackage) 0 else 1
case TypeRef(pre, sym, args) => complexity(pre) + (args map complexity).sum + 1
case RefinedType(parents, _) => (parents map complexity).sum + 1
case _ => 1