diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/dependencies/Changes.scala | 11 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Types.scala | 2 | ||||
-rw-r--r-- | test/files/buildmanager/t3140/A.scala | 8 | ||||
-rw-r--r-- | test/files/buildmanager/t3140/t3140.check | 6 | ||||
-rw-r--r-- | test/files/buildmanager/t3140/t3140.test | 2 | ||||
-rw-r--r-- | test/files/buildmanager/t4245/A.scala | 3 | ||||
-rw-r--r-- | test/files/buildmanager/t4245/t4245.check | 6 | ||||
-rw-r--r-- | test/files/buildmanager/t4245/t4245.test | 2 |
8 files changed, 37 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/dependencies/Changes.scala b/src/compiler/scala/tools/nsc/dependencies/Changes.scala index 42ccb2de0b..baab0271e1 100644 --- a/src/compiler/scala/tools/nsc/dependencies/Changes.scala +++ b/src/compiler/scala/tools/nsc/dependencies/Changes.scala @@ -21,6 +21,11 @@ abstract class Changes { private lazy val annotationsChecked = List(definitions.getClass("scala.specialized")) // Any others that should be checked? + private val flagsToCheck = IMPLICIT | FINAL | PRIVATE | PROTECTED | SEALED | + OVERRIDE | CASE | ABSTRACT | DEFERRED | METHOD | + MODULE | INTERFACE | PARAM | BYNAMEPARAM | CONTRAVARIANT | + DEFAULTPARAM | ACCESSOR | LAZY | SPECIALIZED + /** Are the new modifiers more restrictive than the old ones? */ private def moreRestrictive(from: Long, to: Long): Boolean = ((((to & PRIVATE) != 0L) && (from & PRIVATE) == 0L) @@ -46,10 +51,12 @@ abstract class Changes { private val changedTypeParams = new mutable.HashSet[String] + private def sameParameterSymbolNames(sym1: Symbol, sym2: Symbol): Boolean = + sameSymbol(sym1, sym2, true) || sym2.encodedName.startsWith(sym1.encodedName + "$") // see #3140 private def sameSymbol(sym1: Symbol, sym2: Symbol, simple: Boolean = false): Boolean = if (simple) sym1.encodedName == sym2.encodedName else sym1.fullName == sym2.fullName private def sameFlags(sym1: Symbol, sym2: Symbol): Boolean = - sym1.flags == sym2.flags + (sym1.flags & flagsToCheck) == (sym2.flags & flagsToCheck) private def sameAnnotations(sym1: Symbol, sym2: Symbol): Boolean = annotationsChecked.forall(a => (sym1.hasAnnotation(a) == sym2.hasAnnotation(a))) @@ -111,7 +118,7 @@ abstract class Changes { case (mt1 @ MethodType(params1, res1), mt2 @ MethodType(params2, res2)) => // new dependent types: probably fix this, use substSym as done for PolyType sameTypes(tp1.paramTypes, tp2.paramTypes) && - (tp1.params corresponds tp2.params)((t1, t2) => sameSymbol(t1, t2, true) && sameFlags(t1, t2)) && + (tp1.params corresponds tp2.params)((t1, t2) => sameParameterSymbolNames(t1, t2) && sameFlags(t1, t2)) && sameType(res1, res2) && mt1.isImplicit == mt2.isImplicit case (PolyType(tparams1, res1), PolyType(tparams2, res2)) => diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala index fee7fd2180..17898393ed 100644 --- a/src/compiler/scala/tools/nsc/symtab/Types.scala +++ b/src/compiler/scala/tools/nsc/symtab/Types.scala @@ -8,7 +8,7 @@ package symtab import scala.collection.{ mutable, immutable } import scala.ref.WeakReference -import scala.collection.mutable.ListBuffer +import mutable.ListBuffer import ast.TreeGen import util.{ Position, NoPosition } import util.Statistics._ diff --git a/test/files/buildmanager/t3140/A.scala b/test/files/buildmanager/t3140/A.scala new file mode 100644 index 0000000000..f7768044d1 --- /dev/null +++ b/test/files/buildmanager/t3140/A.scala @@ -0,0 +1,8 @@ +class As { + trait A { + def foo(parents: String): A = { + (() => parents) + null + } + } +} diff --git a/test/files/buildmanager/t3140/t3140.check b/test/files/buildmanager/t3140/t3140.check new file mode 100644 index 0000000000..008d5a9618 --- /dev/null +++ b/test/files/buildmanager/t3140/t3140.check @@ -0,0 +1,6 @@ +builder > A.scala +compiling Set(A.scala) +Changes: Map() +builder > A.scala +compiling Set(A.scala) +Changes: Map(class As -> List(), object As$A$class -> List(), trait As$A -> List()) diff --git a/test/files/buildmanager/t3140/t3140.test b/test/files/buildmanager/t3140/t3140.test new file mode 100644 index 0000000000..392e0d365f --- /dev/null +++ b/test/files/buildmanager/t3140/t3140.test @@ -0,0 +1,2 @@ +>>compile A.scala +>>compile A.scala diff --git a/test/files/buildmanager/t4245/A.scala b/test/files/buildmanager/t4245/A.scala new file mode 100644 index 0000000000..7c4efe1b4b --- /dev/null +++ b/test/files/buildmanager/t4245/A.scala @@ -0,0 +1,3 @@ +class A { + class B(val a: Int) +} diff --git a/test/files/buildmanager/t4245/t4245.check b/test/files/buildmanager/t4245/t4245.check new file mode 100644 index 0000000000..3d3898c671 --- /dev/null +++ b/test/files/buildmanager/t4245/t4245.check @@ -0,0 +1,6 @@ +builder > A.scala +compiling Set(A.scala) +Changes: Map() +builder > A.scala +compiling Set(A.scala) +Changes: Map(class A -> List(), class A$B -> List()) diff --git a/test/files/buildmanager/t4245/t4245.test b/test/files/buildmanager/t4245/t4245.test new file mode 100644 index 0000000000..392e0d365f --- /dev/null +++ b/test/files/buildmanager/t4245/t4245.test @@ -0,0 +1,2 @@ +>>compile A.scala +>>compile A.scala |