diff options
author | Paul Phillips <paulp@improving.org> | 2012-09-19 10:46:45 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-09-19 10:58:12 -0700 |
commit | 3cec321f0541c1c2ccb44413676ba213cbfbfca4 (patch) | |
tree | 6581af59f3e4c41bcb03ea143790f95f1a429583 /src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala | |
parent | d521ba28725fb8def570b0ebec4d9172e274c9c9 (diff) | |
parent | 2f9f8d5d67441f6f1999d68b2b2e57f5451f8da7 (diff) | |
download | scala-3cec321f0541c1c2ccb44413676ba213cbfbfca4.tar.gz scala-3cec321f0541c1c2ccb44413676ba213cbfbfca4.tar.bz2 scala-3cec321f0541c1c2ccb44413676ba213cbfbfca4.zip |
Merge branch '2.10.x' into master
* 2.10.x: (51 commits)
improved/fixed reflection docs based on comments
Fixes SI-6354: improved error messages for Dynamic signature mismatches.
Add RedBlackTree tests for take/drop/slice.
Retain Ordering in drop/take/slice signatures.
test case closes SI-5770
clarify caveats of App trait
Remove `@static` annotation from the library.
New starr that does not depend on `@static`.
improved reflection documentation
pull request feedback
SI-5692 better error message
SI-5942 toolboxes now reset front ends
SI-6287 fixes synthetic symbol clashes in toolbox
Revert "Implement @static annotation on singleton object fields."
Revert "WIP add private/lazy checks and a few tests."
Revert "Fixes SI-6189."
Revert "Fixes SI-6236."
Revert "Fix SI-4581."
Revert "Fix SI-6294."
refactors java reflection tests
...
Conflicts:
src/compiler/scala/tools/nsc/typechecker/Typers.scala
src/partest/scala/tools/partest/package.scala
src/reflect/scala/reflect/internal/Trees.scala
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala index 0d12cad401..2306575d74 100644 --- a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala +++ b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala @@ -70,7 +70,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT storeAccessorDefinition(clazz, DefDef(acc, EmptyTree)) acc } - + atPos(sel.pos)(Select(gen.mkAttributedThis(clazz), superAcc) setType sel.tpe) } @@ -287,16 +287,19 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT // FIXME - this should be unified with needsProtectedAccessor, but some // subtlety which presently eludes me is foiling my attempts. val shouldEnsureAccessor = ( - currentClass.isTrait + currentClass.isTrait && sym.isProtected && sym.enclClass != currentClass && !sym.owner.isTrait && (sym.owner.enclosingPackageClass != currentClass.enclosingPackageClass) - && (qual.symbol.info.member(sym.name) ne NoSymbol)) + && (qual.symbol.info.member(sym.name) ne NoSymbol) + && !needsProtectedAccessor(sym, tree.pos) + ) if (shouldEnsureAccessor) { log("Ensuring accessor for call to protected " + sym.fullLocationString + " from " + currentClass) ensureAccessor(sel) - } else + } + else mayNeedProtectedAccessor(sel, EmptyTree.asList, false) } @@ -525,7 +528,14 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT ) true } - isCandidate && !host.isPackageClass && !isSelfType + def isJavaProtected = host.isTrait && sym.isJavaDefined && { + restrictionError(pos, unit, + s"""|$clazz accesses protected $sym inside a concrete trait method. + |Add an accessor in a class extending ${sym.enclClass} as a workaround.""".stripMargin + ) + true + } + isCandidate && !host.isPackageClass && !isSelfType && !isJavaProtected } /** Return the innermost enclosing class C of referencingClass for which either |