summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2010-06-08 08:48:01 +0000
committerMartin Odersky <odersky@gmail.com>2010-06-08 08:48:01 +0000
commitf49342c6bd0e085cd2b3dae94b51130e100727d4 (patch)
treeb4353971567288e2086606c62642866e02a3d34c
parent92ba00c0705c147bee8453b0ca53f1e82c405882 (diff)
downloadscala-f49342c6bd0e085cd2b3dae94b51130e100727d4.tar.gz
scala-f49342c6bd0e085cd2b3dae94b51130e100727d4.tar.bz2
scala-f49342c6bd0e085cd2b3dae94b51130e100727d4.zip
Merged patch for #3184 (which was a 2.7 -> 2.8 ...
Merged patch for #3184 (which was a 2.7 -> 2.8 regression)
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index aad80c1d8c..a892ae1582 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1831,6 +1831,13 @@ trait Typers { self: Analyzer =>
enterLabelDef(stat)
}
if (phaseId(currentPeriod) <= currentRun.typerPhase.id) {
+ // One reason for this code is that structural refinements
+ // come with strings attached; for instance the inferred type
+ // may not refer to enclosing type parameters.
+ // So abstracting out an anonymous class might lead to type errors.
+ // The setPrivateWithin below is is a quick hack to avoid escaping privates checks
+ // we need to go back and address the problem of escaping
+ // idents form ths ground up.
block match {
case block @ Block(List(classDef @ ClassDef(_, _, _, _)), newInst @ Apply(Select(New(_), _), _)) =>
// The block is an anonymous class definitions/instantiation pair
@@ -1851,8 +1858,7 @@ trait Typers { self: Analyzer =>
) {
member.resetFlag(PROTECTED)
member.resetFlag(LOCAL)
- member.setFlag(PRIVATE)
- member.privateWithin = NoSymbol
+ member.privateWithin = classDef.symbol
}
case _ =>
}