diff options
author | Hubert Plociniczak <hubert.plociniczak@epfl.ch> | 2010-11-02 00:14:26 +0000 |
---|---|---|
committer | Hubert Plociniczak <hubert.plociniczak@epfl.ch> | 2010-11-02 00:14:26 +0000 |
commit | 3f26904e68a2693b57f5b08eac1847676ff748d2 (patch) | |
tree | af934de5b5e373440b041d9c5333cd46c8951e89 /src | |
parent | ae4910485511c12cda0c110b6563610041070b5d (diff) | |
download | scala-3f26904e68a2693b57f5b08eac1847676ff748d2.tar.gz scala-3f26904e68a2693b57f5b08eac1847676ff748d2.tar.bz2 scala-3f26904e68a2693b57f5b08eac1847676ff748d2.zip |
Closes #2792. no review
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/dependencies/Changes.scala | 15 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Symbols.scala | 10 |
2 files changed, 17 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/dependencies/Changes.scala b/src/compiler/scala/tools/nsc/dependencies/Changes.scala index 6aef637902..9794d71db1 100644 --- a/src/compiler/scala/tools/nsc/dependencies/Changes.scala +++ b/src/compiler/scala/tools/nsc/dependencies/Changes.scala @@ -24,8 +24,11 @@ abstract class Changes { /** Are the new modifiers more restrictive than the old ones? */ private def moreRestrictive(from: Long, to: Long): Boolean = ((((to & PRIVATE) != 0L) && (from & PRIVATE) == 0L) - || (((to & PROTECTED) != 0L) && (from & PROTECTED) == 0L)) || - ((from & IMPLICIT) != (to & IMPLICIT)) + || (((to & PROTECTED) != 0L) && (from & PROTECTED) == 0L)) + + /** Check if flags have changed **/ + private def modifiedFlags(from: Long, to: Long): Boolean = + (from & IMPLICIT) != (to & IMPLICIT) /** An entity in source code, either a class or a member definition. * Name is fully-qualified. @@ -163,7 +166,7 @@ abstract class Changes { val to = toSym.info changedTypeParams.clear - def omitSymbols(s: Symbol): Boolean = !s.hasFlag(LOCAL | LIFTED | PRIVATE) + def omitSymbols(s: Symbol): Boolean = !s.hasFlag(LOCAL | LIFTED | PRIVATE | SYNTHETIC) val cs = new mutable.ListBuffer[Change] if ((from.parents zip to.parents) exists { case (t1, t2) => !sameType(t1, t2) }) @@ -191,8 +194,12 @@ abstract class Changes { case _ => n.suchThat(ov => sameType(ov.tpe, o.tpe)) } - if (newSym == NoSymbol || moreRestrictive(o.flags, newSym.flags)) + if (newSym == NoSymbol || moreRestrictive(o.flags, newSym.flags) || modifiedFlags(o.flags, newSym.flags)) cs += Changed(toEntity(o))(n + " changed from " + o.tpe + " to " + n.tpe + " flags: " + Flags.flagsToString(o.flags)) + else if (newSym.isGetter && (o.accessed(from).hasFlag(MUTABLE) != newSym.accessed.hasFlag(MUTABLE))) + // o.owner is already updated to newSym.owner + // so o.accessed will return the accessed for the new owner + cs += Changed(toEntity(o))(o.accessed(from) + " changed to " + newSym.accessed) else newMembers -= newSym } diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala index 1d795d669f..f62d221320 100644 --- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala +++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala @@ -1094,11 +1094,13 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable => final def constrParamAccessors: List[Symbol] = info.decls.toList filter (sym => !sym.isMethod && sym.isParamAccessor) - /** The symbol accessed by this accessor (getter or setter) function. - */ - final def accessed: Symbol = { + /** The symbol accessed by this accessor (getter or setter) function. */ + final def accessed: Symbol = accessed(owner.info) + + /** The symbol accessed by this accessor function, but with given owner type */ + final def accessed(ownerTp: Type): Symbol = { assert(hasFlag(ACCESSOR)) - owner.info.decl(nme.getterToLocal(if (isSetter) nme.setterToGetter(name) else name)) + ownerTp.decl(nme.getterToLocal(if (isSetter) nme.setterToGetter(name) else name)) } /** The implementation class of a trait */ |