diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-11-19 20:33:43 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-11-19 20:47:12 +0100 |
commit | 60ac821192c1b19f91f19eb7a746f0889b3e804e (patch) | |
tree | b07f32c6751c2762db7ff4a4d15347536a566079 | |
parent | d8ffaac6ae544457fa43f2ede674bbe80930cc27 (diff) | |
download | scala-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.
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Implicits.scala | 1 |
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 |