diff options
author | Martin Odersky <odersky@gmail.com> | 2010-12-18 17:16:30 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2010-12-18 17:16:30 +0000 |
commit | c72713c16f50809a95fa6cc9e121c1c88bbb93ff (patch) | |
tree | 9ae38757e6cca6ab56a68b0fee3d07f9654fa9c3 /src | |
parent | e911fdab94900bea85645201311f5ec2dc758fcd (diff) | |
download | scala-c72713c16f50809a95fa6cc9e121c1c88bbb93ff.tar.gz scala-c72713c16f50809a95fa6cc9e121c1c88bbb93ff.tar.bz2 scala-c72713c16f50809a95fa6cc9e121c1c88bbb93ff.zip |
More fixes to avoid the dreaded "NoSymbol does ...
More fixes to avoid the dreaded "NoSymbol does not have owner" problem
in names defaults.
Diffstat (limited to 'src')
3 files changed, 24 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala index 03f631a7e4..2f8b13537d 100644 --- a/src/compiler/scala/tools/nsc/interactive/Global.scala +++ b/src/compiler/scala/tools/nsc/interactive/Global.scala @@ -395,7 +395,9 @@ self => if (unit.status == NotLoaded || unit.status == PartiallyChecked) reloadSources(sources) moveToFront(sources) val typedTree = currentTyperRun.typedTreeAt(pos) - new Locator(pos) locateIn typedTree + val result = new Locator(pos) locateIn typedTree + reloadSources(sources) + result } /** A fully attributed tree corresponding to the entire compilation unit */ @@ -405,7 +407,9 @@ self => val sources = List(source) if (unit.status == NotLoaded || unit.status == PartiallyChecked || forceReload) reloadSources(sources) moveToFront(sources) - currentTyperRun.typedTree(unitOf(source)) + val result = currentTyperRun.typedTree(unitOf(source)) + reloadSources(sources) + result } /** Set sync var `response` to a fully attributed tree located at position `pos` */ diff --git a/src/compiler/scala/tools/nsc/interactive/REPL.scala b/src/compiler/scala/tools/nsc/interactive/REPL.scala index f4c9a7effe..834747c547 100644 --- a/src/compiler/scala/tools/nsc/interactive/REPL.scala +++ b/src/compiler/scala/tools/nsc/interactive/REPL.scala @@ -112,7 +112,7 @@ object REPL { Thread.sleep(millis.toInt) println("ask type now") comp.askType(toSourceFile(file), false, typedResult) - show(typedResult) + typedResult.get case List("typed", file) => doTypedTree(file) case List("typeat", file, off1, off2) => diff --git a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala index 09544e6ab4..7982617fee 100644 --- a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala +++ b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala @@ -368,7 +368,23 @@ trait NamesDefaults { self: Analyzer => val defaultArgs = missing map (p => { var default1 = qual match { case Some(q) => gen.mkAttributedSelect(q.duplicate, defaultGetter(p, context)) - case None => gen.mkAttributedRef(defaultGetter(p, context)) + case None => + val dgetter = defaultGetter(p, context) + if (dgetter == NoSymbol) { + println("no getter for "+p+" in "+p.owner) + println(p.owner.paramss) + var ctx = context + while (ctx.owner != p.owner.owner) { + println("inner scope: "+ctx.scope+ctx.scope.hashCode+" "+ctx.owner) + ctx = ctx.outer + } + while (ctx.owner == p.owner.owner) { + println("this scope: "+ctx.scope+ctx.scope.hashCode+" "+ctx.owner) + ctx = ctx.outer + } + } + gen.mkAttributedRef(dgetter) + } default1 = if (targs.isEmpty) default1 else TypeApply(default1, targs.map(_.duplicate)) |