diff options
author | Martin Odersky <odersky@gmail.com> | 2013-04-09 15:19:49 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-04-09 15:19:49 +0200 |
commit | 7a6bb3ccba3217bc15e3a1c038a1cce4dbd942e3 (patch) | |
tree | 5ca8c806a1414010a2aa8c62c319528386ea653c /src/dotty/tools/dotc/core/Types.scala | |
parent | 442c361aee87266fe6428f1d9a5da7de934c8cef (diff) | |
download | dotty-7a6bb3ccba3217bc15e3a1c038a1cce4dbd942e3.tar.gz dotty-7a6bb3ccba3217bc15e3a1c038a1cce4dbd942e3.tar.bz2 dotty-7a6bb3ccba3217bc15e3a1c038a1cce4dbd942e3.zip |
Renamed creation methods of NamedTypes
Methods taking a fixed symbol are now called …withSym, methods taking a signature … withSig.
The reason for the change is that we want to liberate the original method names to take optional denotations, thus avoiding to have to go through withDenot each time.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index bcc2da498..22ea23b52 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -1012,7 +1012,7 @@ object Types { override def loadDenot(implicit ctx: Context): Denotation = super.loadDenot.atSignature(sig) override def newLikeThis(prefix: Type)(implicit ctx: Context): TermRefWithSignature = - TermRef(prefix, name, sig) + TermRef.withSig(prefix, name, sig) override def equals(that: Any) = that match { case that: TermRefWithSignature => this.prefix == that.prefix && @@ -1034,27 +1034,25 @@ object Types { def apply(prefix: Type, name: Name)(implicit ctx: Context) = if (name.isTermName) TermRef(prefix, name.asTermName) else TypeRef(prefix, name.asTypeName) - def apply(prefix: Type, sym: Symbol)(implicit ctx: Context) = - if (sym.isTerm) TermRef(prefix, sym.asTerm) - else TypeRef(prefix, sym.asType) + def withSym(prefix: Type, sym: Symbol)(implicit ctx: Context) = + if (sym.isTerm) TermRef.withSym(prefix, sym.asTerm) + else TypeRef.withSym(prefix, sym.asType) } object TermRef { def apply(prefix: Type, name: TermName)(implicit ctx: Context): TermRef = unique(new CachedTermRef(prefix, name)) - def apply(prefix: Type, sym: TermSymbol)(implicit ctx: Context): TermRefBySym = + def withSym(prefix: Type, sym: TermSymbol)(implicit ctx: Context): TermRefBySym = unique(new TermRefBySym(prefix, sym.name, sym)) - def apply(prefix: Type, name: TermName, sig: Signature)(implicit ctx: Context): TermRefWithSignature = + def withSig(prefix: Type, name: TermName, sig: Signature)(implicit ctx: Context): TermRefWithSignature = unique(new TermRefWithSignature(prefix, name, sig)) } object TypeRef { def apply(prefix: Type, name: TypeName)(implicit ctx: Context): TypeRef = unique(new CachedTypeRef(prefix, name)) - def apply(prefix: Type, sym: TypeSymbol)(implicit ctx: Context): TypeRefBySym = - apply(prefix, sym.name, sym) - def apply(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)) } // --- Other SingletonTypes: ThisType/SuperType/ConstantType --------------------------- @@ -1427,7 +1425,7 @@ object Types { else tp.substThis(cls, prefix) def typeConstructor(implicit ctx: Context): Type = - if ((cls is PackageClass) || cls.owner.isTerm) TypeRef(prefix, cls) + if ((cls is PackageClass) || cls.owner.isTerm) TypeRef.withSym(prefix, cls) else TypeRef(prefix, cls.name).withDenot(cls.denot.asSeenFrom(prefix)) // cached because baseType needs parents |