diff options
author | Martin Odersky <odersky@gmail.com> | 2013-07-11 10:08:05 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-07-11 10:08:05 +0200 |
commit | 62ac6eb04b32ad9795754143d8934343ed3d9a8f (patch) | |
tree | 49610f5d49bf00be0194ac9e5e1629b9a5f8df78 | |
parent | c9679f6c0f3c8200e1b1f537e89488094cfc2576 (diff) | |
download | dotty-62ac6eb04b32ad9795754143d8934343ed3d9a8f.tar.gz dotty-62ac6eb04b32ad9795754143d8934343ed3d9a8f.tar.bz2 dotty-62ac6eb04b32ad9795754143d8934343ed3d9a8f.zip |
Avoided cycle in newCompletePackageSymbol by passing name explicity.
-rw-r--r-- | src/dotty/tools/dotc/core/Symbols.scala | 18 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 8 |
2 files changed, 15 insertions, 11 deletions
diff --git a/src/dotty/tools/dotc/core/Symbols.scala b/src/dotty/tools/dotc/core/Symbols.scala index f45e3e140..9025a7df9 100644 --- a/src/dotty/tools/dotc/core/Symbols.scala +++ b/src/dotty/tools/dotc/core/Symbols.scala @@ -125,7 +125,7 @@ trait Symbols { this: Context => infoFn(module, modcls), privateWithin) val mdenot = SymDenotation( module, owner, name, modFlags | ModuleCreationFlags, - if (cdenot.isCompleted) TypeRef.withSym(owner.thisType, modcls) + if (cdenot.isCompleted) TypeRef.withSym(owner.thisType, modclsName, modcls) else new ModuleCompleter(modcls)(condensed)) module.denot = mdenot modcls.denot = cdenot @@ -150,7 +150,7 @@ trait Symbols { this: Context => newModuleSymbol( owner, name, modFlags, clsFlags, (module, modcls) => ClassInfo( - owner.thisType, modcls, parents, decls, TermRef.withSym(owner.thisType, module)), + owner.thisType, modcls, parents, decls, TermRef.withSym(owner.thisType, name, module)), privateWithin, coord, assocFile) /** Create a package symbol with associated package class @@ -185,14 +185,14 @@ trait Symbols { this: Context => val normalizedOwner = if (owner is ModuleVal) owner.moduleClass else owner println(s"creating stub for ${name.show}, owner = ${normalizedOwner.denot.debugString}, file = $file") println(s"decls = ${normalizedOwner.decls.toList.map(_.debugString).mkString("\n ")}") // !!! DEBUG - throw new Error() + if (base.settings.debug.value) throw new Error() val stub = name match { case name: TermName => newModuleSymbol(normalizedOwner, name, EmptyFlags, EmptyFlags, stubCompleter, assocFile = file) case name: TypeName => newClassSymbol(normalizedOwner, name, EmptyFlags, stubCompleter, assocFile = file) } - stub.info //!!! DEBUG, force the error for now + //stub.info //!!! DEBUG, force the error for now stub } @@ -293,13 +293,13 @@ object Symbols { type ThisName <: Name - private[this] var _id: Int = _ + private[this] var _id: Int = { + //assert(id != 144972) + nextId + } /** The unique id of this symbol */ - def id/*(implicit ctx: Context)*/ = { // !!! DEBUG - if (_id == 0) _id = /*ctx.*/nextId // !!! DEBUG - _id - } + def id = _id /** The last denotation of this symbol */ private[this] var lastDenot: SymDenotation = _ diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 924517e09..71b15f98a 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -1167,8 +1167,10 @@ object Types { object TermRef { def apply(prefix: Type, name: TermName)(implicit ctx: Context): TermRef = unique(new CachedTermRef(prefix, name)) + def withSym(prefix: Type, name: TermName, sym: TermSymbol)(implicit ctx: Context): TermRefBySym = + unique(new TermRefBySym(prefix, name, sym)) def withSym(prefix: Type, sym: TermSymbol)(implicit ctx: Context): TermRefBySym = - unique(new TermRefBySym(prefix, sym.name, sym)) + withSym(prefix, sym.name, sym) def withSig(prefix: Type, name: TermName, sig: Signature)(implicit ctx: Context): TermRefWithSignature = unique(new TermRefWithSignature(prefix, name, sig)) } @@ -1176,8 +1178,10 @@ object Types { object TypeRef { def apply(prefix: Type, name: TypeName)(implicit ctx: Context): TypeRef = unique(new CachedTypeRef(prefix, name)) + def withSym(prefix: Type, name: TypeName, sym: TypeSymbol)(implicit ctx: Context): TypeRefBySym = + unique(new TypeRefBySym(prefix, name, sym)) def withSym(prefix: Type, sym: TypeSymbol)(implicit ctx: Context): TypeRefBySym = - unique(new TypeRefBySym(prefix, sym.name, sym)) + withSym(prefix, sym.name, sym) } // --- Other SingletonTypes: ThisType/SuperType/ConstantType --------------------------- |