aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-03-12 16:27:03 +0100
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2014-03-12 21:14:17 +0100
commit912b4bcb7aa3c10e756a62d60a8f33ae0f60c01a (patch)
treec0fbbfcd385cec5de65e9a3f1edd2be61e2a4533 /src/dotty/tools
parentdb950e5e168f6fd71a367da343e352139e8d653e (diff)
downloaddotty-912b4bcb7aa3c10e756a62d60a8f33ae0f60c01a.tar.gz
dotty-912b4bcb7aa3c10e756a62d60a8f33ae0f60c01a.tar.bz2
dotty-912b4bcb7aa3c10e756a62d60a8f33ae0f60c01a.zip
Fix of #56 - newModuleSymbol & newCompleteModuleSymbol
Needs new TypeRef creation method that works for NoPrefix and at the same time does not need a denotation. This is provided by method TermRef.withNakedSymbol.
Diffstat (limited to 'src/dotty/tools')
-rw-r--r--src/dotty/tools/dotc/core/Symbols.scala4
-rw-r--r--src/dotty/tools/dotc/core/Types.scala12
2 files changed, 10 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/core/Symbols.scala b/src/dotty/tools/dotc/core/Symbols.scala
index ea96b3023..aa0cbb5a9 100644
--- a/src/dotty/tools/dotc/core/Symbols.scala
+++ b/src/dotty/tools/dotc/core/Symbols.scala
@@ -132,7 +132,7 @@ trait Symbols { this: Context =>
infoFn(module, modcls), privateWithin)
val mdenot = SymDenotation(
module, owner, name, modFlags | ModuleCreationFlags,
- if (cdenot.isCompleted) TypeRef(owner.thisType, modclsName) withSym modcls
+ if (cdenot.isCompleted) TypeRef.withSymAndName(owner.thisType, modcls, modclsName)
else new ModuleCompleter(modcls))
module.denot = mdenot
modcls.denot = cdenot
@@ -157,7 +157,7 @@ trait Symbols { this: Context =>
newModuleSymbol(
owner, name, modFlags, clsFlags,
(module, modcls) => ClassInfo(
- owner.thisType, modcls, parents, decls, TermRef(owner.thisType, name) withSym module),
+ owner.thisType, modcls, parents, decls, TermRef.withSymAndName(owner.thisType, module, name)),
privateWithin, coord, assocFile)
/** Create a package symbol with associated package class
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 67dc13775..9714f7eae 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -1167,8 +1167,10 @@ object Types {
def apply(prefix: Type, name: TermName)(implicit ctx: Context): TermRef =
ctx.uniqueNamedTypes.enterIfNew(prefix, name).asInstanceOf[TermRef]
def apply(prefix: Type, sym: TermSymbol)(implicit ctx: Context): TermRef =
- if (prefix eq NoPrefix) unique(new NoPrefixTermRef(sym.name, sym))
- else apply(prefix, sym.name) withSym sym
+ withSymAndName(prefix, sym, sym.name)
+ def withSymAndName(prefix: Type, sym: TermSymbol, name: TermName)(implicit ctx: Context): TermRef =
+ if (prefix eq NoPrefix) unique(new NoPrefixTermRef(name, sym))
+ else apply(prefix, name) withSym sym
def apply(prefix: Type, name: TermName, denot: Denotation)(implicit ctx: Context): TermRef =
(if (prefix eq NoPrefix) apply(prefix, denot.symbol.asTerm) else apply(prefix, name)) withDenot denot
def withSig(prefix: Type, name: TermName, sig: Signature)(implicit ctx: Context): TermRef =
@@ -1182,8 +1184,10 @@ object Types {
def apply(prefix: Type, name: TypeName)(implicit ctx: Context): TypeRef =
ctx.uniqueNamedTypes.enterIfNew(prefix, name).asInstanceOf[TypeRef]
def apply(prefix: Type, sym: TypeSymbol)(implicit ctx: Context): TypeRef =
- if (prefix eq NoPrefix) unique(new NoPrefixTypeRef(sym.name, sym))
- else apply(prefix, sym.name) withSym sym
+ withSymAndName(prefix, sym, sym.name)
+ def withSymAndName(prefix: Type, sym: TypeSymbol, name: TypeName)(implicit ctx: Context): TypeRef =
+ if (prefix eq NoPrefix) unique(new NoPrefixTypeRef(name, sym))
+ else apply(prefix, name) withSym sym
def apply(prefix: Type, name: TypeName, denot: Denotation)(implicit ctx: Context): TypeRef =
(if (prefix eq NoPrefix) apply(prefix, denot.symbol.asType) else apply(prefix, name)) withDenot denot
}