summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2009-11-07 15:41:12 +0000
committerMartin Odersky <odersky@gmail.com>2009-11-07 15:41:12 +0000
commit86a6ad44fd66e2b1e9cb1aec6a4bd9266d6fbd91 (patch)
tree79b4d8277267b94bd0aee9696c3adc4aef3f2e3e /src/compiler/scala/tools/nsc/typechecker/Contexts.scala
parent6fbb22661739840cf163f6dfbce18bf2c79b051e (diff)
downloadscala-86a6ad44fd66e2b1e9cb1aec6a4bd9266d6fbd91.tar.gz
scala-86a6ad44fd66e2b1e9cb1aec6a4bd9266d6fbd91.tar.bz2
scala-86a6ad44fd66e2b1e9cb1aec6a4bd9266d6fbd91.zip
Fixed #2236
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Contexts.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index 2be187381f..fd9be9e788 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -111,6 +111,7 @@ trait Contexts { self: Analyzer =>
var inConstructorSuffix = false // are we in a secondary constructor
// after the this constructor call?
var returnsSeen = false // for method context: were returns encountered?
+ var inSelfSuperCall = false // is this a context for a constructor self or super call?
var reportAmbiguousErrors = false
var reportGeneralErrors = false
var diagnostic: List[String] = Nil // these messages are printed when issuing an error
@@ -271,6 +272,7 @@ trait Contexts { self: Analyzer =>
while (baseContext.tree.isInstanceOf[Template])
baseContext = baseContext.outer
val argContext = baseContext.makeNewScope(tree, owner)
+ argContext.inSelfSuperCall = true
argContext.reportGeneralErrors = this.reportGeneralErrors
argContext.reportAmbiguousErrors = this.reportAmbiguousErrors
def enterElems(c: Context) {
@@ -487,14 +489,14 @@ trait Contexts { self: Analyzer =>
val nextOuter =
if (owner.isConstructor) {
if (outer.tree.isInstanceOf[Template]) outer.outer.outer
- else outer.outer
+ else outer.outer.outer
} else outer
// can we can do something smarter to bring back the implicit cache?
if (implicitsRunId != currentRunId) {
implicitsRunId = currentRunId
implicitsCache = List()
val newImplicits: List[ImplicitInfo] =
- if (owner != nextOuter.owner && owner.isClass && !owner.isPackageClass) {
+ if (owner != nextOuter.owner && owner.isClass && !owner.isPackageClass && !inSelfSuperCall) {
if (!owner.isInitialized) return nextOuter.implicitss
if (settings.debug.value)
log("collect member implicits " + owner + ", implicit members = " +