diff options
author | Martin Odersky <odersky@gmail.com> | 2009-02-23 19:21:05 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2009-02-23 19:21:05 +0000 |
commit | bf35b888e49afb245883571cc00cbb5ec7341f24 (patch) | |
tree | 8c060484dde8c122f1d65fceedf0dd962a4ad90c /src/compiler/scala/tools/nsc/typechecker/Namers.scala | |
parent | a4baf48a5fb38f29d462accc57f93032955efa0e (diff) | |
download | scala-bf35b888e49afb245883571cc00cbb5ec7341f24.tar.gz scala-bf35b888e49afb245883571cc00cbb5ec7341f24.tar.bz2 scala-bf35b888e49afb245883571cc00cbb5ec7341f24.zip |
fixed several problems with cyclic references u...
fixed several problems with cyclic references uncovered by experimenting
with collections. Added early type definitions.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Namers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Namers.scala | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index cd51fbce5f..e43ddddea9 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -547,9 +547,46 @@ trait Namers { self: Analyzer => self.symbol = context.scope enter self.symbol } } + + /* experimental code for allowiong early types as type parameters + val earlyTypes = templ.body filter (treeInfo.isEarlyTypeDef) + + val parentTyper = + if (earlyTypes.isEmpty) typer + else { + val earlyContext = context.outer.makeNewScope(context.tree, context.outer.owner.newLocalDummy(templ.pos))(InnerScopeKind) + newNamer(earlyContext).enterSyms(earlyTypes) + newTyper(earlyContext).typedStats(earlyTypes, context.owner) + + val parentContext = context.makeNewScope(context.tree, context.owner)(InnerScopeKind) + for (etdef <- earlyTypes) parentContext.scope enter etdef.symbol + newTyper(parentContext) + } + var parents = parentTyper.parentTypes(templ) map checkParent + if (!earlyTypes.isEmpty) { + val earlyMap = new EarlyMap(context.owner) + for (etdef <- earlyTypes) { + val esym = etdef.symbol + esym.owner = context.owner + esym.asInstanceOf[TypeSymbol].refreshType() + esym setInfo earlyMap(esym.info) + } + +/* + println("earlies: "+(earlyTypes map (_.symbol))) + println("earlies: "+(earlyTypes map (_.symbol.tpe))) + println("earlies: "+(earlyTypes map (_.symbol.info))) + println("parents: "+parents) + println(templ) + +*/ + + } +*/ var parents = typer.parentTypes(templ) map checkParent enterSelf(templ.self) val decls = newClassScope(clazz) +// for (etdef <- earlyTypes) decls enter etdef.symbol val templateNamer = newNamer(context.make(templ, clazz, decls)) .enterSyms(templ.body) |