Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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.
  • Loading branch information...
commit 60ac821192c1b19f91f19eb7a746f0889b3e804e 1 parent d8ffaac
@retronym retronym authored
Showing with 1 addition and 0 deletions.
  1. +1 −0  src/compiler/scala/tools/nsc/typechecker/Implicits.scala
View
1  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
Please sign in to comment.
Something went wrong with that request. Please try again.