diff options
author | Martin Odersky <odersky@gmail.com> | 2014-03-12 16:27:03 +0100 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-03-12 21:14:17 +0100 |
commit | 912b4bcb7aa3c10e756a62d60a8f33ae0f60c01a (patch) | |
tree | c0fbbfcd385cec5de65e9a3f1edd2be61e2a4533 /src/dotty/tools/dotc/core/Types.scala | |
parent | db950e5e168f6fd71a367da343e352139e8d653e (diff) | |
download | dotty-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/dotc/core/Types.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 12 |
1 files changed, 8 insertions, 4 deletions
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 } |