aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-11-08 10:33:58 +0100
committerMartin Odersky <odersky@gmail.com>2015-11-09 15:45:40 +0100
commit4f01f62ac216fa9034d343828aa6f4be626d9b36 (patch)
tree9a0dbba0554183199aa3f1389e7e166851073bb8 /src
parent2d7a05fa46016ea54e10a80735e04b33fd0938d1 (diff)
downloaddotty-4f01f62ac216fa9034d343828aa6f4be626d9b36.tar.gz
dotty-4f01f62ac216fa9034d343828aa6f4be626d9b36.tar.bz2
dotty-4f01f62ac216fa9034d343828aa6f4be626d9b36.zip
Shorten ..Class.typeRef to ..Type
Since we now have two forms of (almost) everything in Definitions, might as well profit from it.
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/ast/Desugar.scala8
-rw-r--r--src/dotty/tools/dotc/ast/TreeInfo.scala2
-rw-r--r--src/dotty/tools/dotc/ast/tpd.scala2
-rw-r--r--src/dotty/tools/dotc/ast/untpd.scala2
-rw-r--r--src/dotty/tools/dotc/core/Annotations.scala4
-rw-r--r--src/dotty/tools/dotc/core/Constants.scala22
-rw-r--r--src/dotty/tools/dotc/core/Definitions.scala14
-rw-r--r--src/dotty/tools/dotc/core/TypeErasure.scala4
-rw-r--r--src/dotty/tools/dotc/core/TypeOps.scala2
-rw-r--r--src/dotty/tools/dotc/core/Types.scala2
-rw-r--r--src/dotty/tools/dotc/core/classfile/ClassfileParser.scala4
-rw-r--r--src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala4
-rw-r--r--src/dotty/tools/dotc/transform/AugmentScala2Traits.scala2
-rw-r--r--src/dotty/tools/dotc/transform/FirstTransform.scala2
-rw-r--r--src/dotty/tools/dotc/typer/Checking.scala4
-rw-r--r--src/dotty/tools/dotc/typer/Namer.scala2
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala6
17 files changed, 43 insertions, 43 deletions
diff --git a/src/dotty/tools/dotc/ast/Desugar.scala b/src/dotty/tools/dotc/ast/Desugar.scala
index c028f5cf1..e51510cdf 100644
--- a/src/dotty/tools/dotc/ast/Desugar.scala
+++ b/src/dotty/tools/dotc/ast/Desugar.scala
@@ -803,10 +803,10 @@ object desugar {
makeBinop(l, op, r)
case PostfixOp(t, op) =>
if ((ctx.mode is Mode.Type) && op == nme.raw.STAR) {
- val seqClass = if (ctx.compilationUnit.isJava) defn.ArrayClass else defn.SeqClass
+ val seqType = if (ctx.compilationUnit.isJava) defn.ArrayType else defn.SeqType
Annotated(
- New(ref(defn.RepeatedAnnot.typeRef), Nil :: Nil),
- AppliedTypeTree(ref(seqClass.typeRef), t))
+ New(ref(defn.RepeatedAnnotRef), Nil :: Nil),
+ AppliedTypeTree(ref(seqType), t))
} else {
assert(ctx.mode.isExpr || ctx.reporter.hasErrors, ctx.mode)
Select(t, op)
@@ -818,7 +818,7 @@ object desugar {
case Tuple(ts) =>
if (unboxedPairs) {
def PairTypeTree(l: Tree, r: Tree) =
- AppliedTypeTree(ref(defn.PairClass.typeRef), l :: r :: Nil)
+ AppliedTypeTree(ref(defn.PairType), l :: r :: Nil)
if (ctx.mode is Mode.Type) ts.reduceRight(PairTypeTree)
else if (ts.isEmpty) unitLiteral
else ts.reduceRight(Pair(_, _))
diff --git a/src/dotty/tools/dotc/ast/TreeInfo.scala b/src/dotty/tools/dotc/ast/TreeInfo.scala
index 1266ebbd9..2b0f0aee3 100644
--- a/src/dotty/tools/dotc/ast/TreeInfo.scala
+++ b/src/dotty/tools/dotc/ast/TreeInfo.scala
@@ -230,7 +230,7 @@ trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] =>
/** Does this CaseDef catch Throwable? */
def catchesThrowable(cdef: CaseDef)(implicit ctx: Context) =
- catchesAllOf(cdef, defn.ThrowableClass.typeRef)
+ catchesAllOf(cdef, defn.ThrowableType)
/** Does this CaseDef catch everything of a certain Type? */
def catchesAllOf(cdef: CaseDef, threshold: Type)(implicit ctx: Context) =
diff --git a/src/dotty/tools/dotc/ast/tpd.scala b/src/dotty/tools/dotc/ast/tpd.scala
index 44372ff9e..feeaad49d 100644
--- a/src/dotty/tools/dotc/ast/tpd.scala
+++ b/src/dotty/tools/dotc/ast/tpd.scala
@@ -267,7 +267,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
def AnonClass(parents: List[Type], fns: List[TermSymbol], methNames: List[TermName])(implicit ctx: Context): Block = {
val owner = fns.head.owner
val parents1 =
- if (parents.head.classSymbol.is(Trait)) defn.ObjectClass.typeRef :: parents
+ if (parents.head.classSymbol.is(Trait)) defn.ObjectType :: parents
else parents
val cls = ctx.newNormalizedClassSymbol(owner, tpnme.ANON_FUN, Synthetic, parents1,
coord = fns.map(_.pos).reduceLeft(_ union _))
diff --git a/src/dotty/tools/dotc/ast/untpd.scala b/src/dotty/tools/dotc/ast/untpd.scala
index 5db893ff2..3f3e1bf37 100644
--- a/src/dotty/tools/dotc/ast/untpd.scala
+++ b/src/dotty/tools/dotc/ast/untpd.scala
@@ -201,7 +201,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
def ref(tp: NamedType)(implicit ctx: Context): Tree =
TypedSplice(tpd.ref(tp))
- def scalaUnit(implicit ctx: Context) = ref(defn.UnitClass.typeRef)
+ def scalaUnit(implicit ctx: Context) = ref(defn.UnitType)
def makeConstructor(tparams: List[TypeDef], vparamss: List[List[ValDef]], rhs: Tree = EmptyTree)(implicit ctx: Context): DefDef =
DefDef(nme.CONSTRUCTOR, tparams, vparamss, TypeTree(), rhs)
diff --git a/src/dotty/tools/dotc/core/Annotations.scala b/src/dotty/tools/dotc/core/Annotations.scala
index 6d0fba337..0aedb16a0 100644
--- a/src/dotty/tools/dotc/core/Annotations.scala
+++ b/src/dotty/tools/dotc/core/Annotations.scala
@@ -91,12 +91,12 @@ object Annotations {
def makeChild(sym: Symbol)(implicit ctx: Context) =
deferred(defn.ChildAnnot,
- implicit ctx => New(defn.ChildAnnot.typeRef.appliedTo(sym.owner.thisType.select(sym.name, sym)), Nil))
+ implicit ctx => New(defn.ChildAnnotRef.appliedTo(sym.owner.thisType.select(sym.name, sym)), Nil))
}
def ThrowsAnnotation(cls: ClassSymbol)(implicit ctx: Context) = {
val tref = cls.typeRef
- Annotation(defn.ThrowsAnnot.typeRef.appliedTo(tref), Ident(tref))
+ Annotation(defn.ThrowsAnnotRef.appliedTo(tref), Ident(tref))
}
/** A decorator that provides queries for specific annotations
diff --git a/src/dotty/tools/dotc/core/Constants.scala b/src/dotty/tools/dotc/core/Constants.scala
index 61a23bb9e..e13e07f58 100644
--- a/src/dotty/tools/dotc/core/Constants.scala
+++ b/src/dotty/tools/dotc/core/Constants.scala
@@ -54,17 +54,17 @@ object Constants {
def isAnyVal = UnitTag <= tag && tag <= DoubleTag
def tpe(implicit ctx: Context): Type = tag match {
- case UnitTag => defn.UnitClass.typeRef
- case BooleanTag => defn.BooleanClass.typeRef
- case ByteTag => defn.ByteClass.typeRef
- case ShortTag => defn.ShortClass.typeRef
- case CharTag => defn.CharClass.typeRef
- case IntTag => defn.IntClass.typeRef
- case LongTag => defn.LongClass.typeRef
- case FloatTag => defn.FloatClass.typeRef
- case DoubleTag => defn.DoubleClass.typeRef
- case StringTag => defn.StringClass.typeRef
- case NullTag => defn.NullClass.typeRef
+ case UnitTag => defn.UnitType
+ case BooleanTag => defn.BooleanType
+ case ByteTag => defn.ByteType
+ case ShortTag => defn.ShortType
+ case CharTag => defn.CharType
+ case IntTag => defn.IntType
+ case LongTag => defn.LongType
+ case FloatTag => defn.FloatType
+ case DoubleTag => defn.DoubleType
+ case StringTag => defn.StringType
+ case NullTag => defn.NullType
case ClazzTag => defn.ClassType(typeValue)
case EnumTag => defn.EnumType(symbolValue)
}
diff --git a/src/dotty/tools/dotc/core/Definitions.scala b/src/dotty/tools/dotc/core/Definitions.scala
index bec558d76..d8060c827 100644
--- a/src/dotty/tools/dotc/core/Definitions.scala
+++ b/src/dotty/tools/dotc/core/Definitions.scala
@@ -163,7 +163,7 @@ class Definitions {
cls.info = ClassInfo(cls.owner.thisType, cls, AnyClass.typeRef :: Nil, newScope)
completeClass(cls)
}
- def ObjectType: Type = ObjectClass.typeRef
+ def ObjectType = ObjectClass.typeRef
lazy val AnyRefAlias: TypeSymbol = newAliasType(tpnme.AnyRef, ObjectType)
def AnyRefType = AnyRefAlias.typeRef
@@ -404,12 +404,12 @@ class Definitions {
lazy val NonLocalReturnControlType: TypeRef = ctx.requiredClassRef("scala.runtime.NonLocalReturnControl")
// Annotation base classes
- lazy val AnnotationTypeRef = ctx.requiredClassRef("scala.annotation.Annotation")
- def AnnotationClass = AnnotationTypeRef.symbol.asClass
- lazy val ClassfileAnnotationTypeRef = ctx.requiredClassRef("scala.annotation.ClassfileAnnotation")
- def ClassfileAnnotationClass = ClassfileAnnotationTypeRef.symbol.asClass
- lazy val StaticAnnotationTypeRef = ctx.requiredClassRef("scala.annotation.StaticAnnotation")
- def StaticAnnotationClass = StaticAnnotationTypeRef.symbol.asClass
+ lazy val AnnotationType = ctx.requiredClassRef("scala.annotation.Annotation")
+ def AnnotationClass = AnnotationType.symbol.asClass
+ lazy val ClassfileAnnotationType = ctx.requiredClassRef("scala.annotation.ClassfileAnnotation")
+ def ClassfileAnnotationClass = ClassfileAnnotationType.symbol.asClass
+ lazy val StaticAnnotationType = ctx.requiredClassRef("scala.annotation.StaticAnnotation")
+ def StaticAnnotationClass = StaticAnnotationType.symbol.asClass
// Annotation classes
lazy val AliasAnnotRef = ctx.requiredClassRef("dotty.annotation.internal.Alias")
diff --git a/src/dotty/tools/dotc/core/TypeErasure.scala b/src/dotty/tools/dotc/core/TypeErasure.scala
index b76dd869a..8f116c85f 100644
--- a/src/dotty/tools/dotc/core/TypeErasure.scala
+++ b/src/dotty/tools/dotc/core/TypeErasure.scala
@@ -176,7 +176,7 @@ object TypeErasure {
else if (sym.isConstructor) outer.addParam(sym.owner.asClass, erase(tp)(erasureCtx))
else erase.eraseInfo(tp, sym)(erasureCtx) match {
case einfo: MethodType if sym.isGetter && einfo.resultType.isRef(defn.UnitClass) =>
- MethodType(Nil, defn.BoxedUnitClass.typeRef)
+ MethodType(Nil, defn.BoxedUnitType)
case einfo =>
einfo
}
@@ -360,7 +360,7 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
else classParents.mapConserve(eraseTypeRef) match {
case tr :: trs1 =>
assert(!tr.classSymbol.is(Trait), cls)
- val tr1 = if (cls is Trait) defn.ObjectClass.typeRef else tr
+ val tr1 = if (cls is Trait) defn.ObjectType else tr
tr1 :: trs1.filterNot(_ isRef defn.ObjectClass)
case nil => nil
}
diff --git a/src/dotty/tools/dotc/core/TypeOps.scala b/src/dotty/tools/dotc/core/TypeOps.scala
index aa643256c..4cfc52909 100644
--- a/src/dotty/tools/dotc/core/TypeOps.scala
+++ b/src/dotty/tools/dotc/core/TypeOps.scala
@@ -481,7 +481,7 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
formals = formals.updated(name, tp1.typeParamNamed(name))
normalizeToRef(tp1)
case ErrorType =>
- defn.AnyClass.typeRef
+ defn.AnyType
case AnnotatedType(_, tpe) =>
normalizeToRef(tpe)
case _ =>
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 3bc76a20d..4cae047a9 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -964,7 +964,7 @@ object Types {
/** The first parent of this type, AnyRef if list of parents is empty */
def firstParent(implicit ctx: Context): TypeRef = parents match {
case p :: _ => p
- case _ => defn.AnyClass.typeRef
+ case _ => defn.AnyType
}
/** the self type of the underlying classtype */
diff --git a/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala b/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala
index ca805f516..9ea24324b 100644
--- a/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala
+++ b/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala
@@ -104,7 +104,7 @@ class ClassfileParser(
/** Parse parents for Java classes. For Scala, return AnyRef, since the real type will be unpickled.
* Updates the read pointer of 'in'. */
def parseParents: List[Type] = {
- val superType = if (isAnnotation) { in.nextChar; defn.AnnotationClass.typeRef }
+ val superType = if (isAnnotation) { in.nextChar; defn.AnnotationType }
else pool.getSuperClass(in.nextChar).typeRef
val ifaceCount = in.nextChar
var ifaces = for (i <- (0 until ifaceCount).toList) yield pool.getSuperClass(in.nextChar).typeRef
@@ -115,7 +115,7 @@ class ClassfileParser(
// is found. If we treat constant subtyping specially, we might be able
// to do something there. But in any case, the until should be more efficient.
- if (isAnnotation) ifaces = defn.ClassfileAnnotationClass.typeRef :: ifaces
+ if (isAnnotation) ifaces = defn.ClassfileAnnotationType :: ifaces
superType :: ifaces
}
diff --git a/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala b/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
index 9269109ad..f42169029 100644
--- a/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
+++ b/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
@@ -100,7 +100,7 @@ object Scala2Unpickler {
case cinfo => (Nil, cinfo)
}
var parentRefs = ctx.normalizeToClassRefs(parents, cls, decls)
- if (parentRefs.isEmpty) parentRefs = defn.ObjectClass.typeRef :: Nil
+ if (parentRefs.isEmpty) parentRefs = defn.ObjectType :: Nil
for (tparam <- tparams) {
val tsym = decls.lookup(tparam.name)
if (tsym.exists) tsym.setFlag(TypeParam)
@@ -852,7 +852,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
val end = readNat() + readIndex
// array elements are trees representing instances of scala.annotation.Annotation
SeqLiteral(
- defn.SeqType.appliedTo(defn.AnnotationClass.typeRef :: Nil),
+ defn.SeqType.appliedTo(defn.AnnotationType :: Nil),
until(end, () => readClassfileAnnotArg(readNat())))
}
diff --git a/src/dotty/tools/dotc/transform/AugmentScala2Traits.scala b/src/dotty/tools/dotc/transform/AugmentScala2Traits.scala
index 779f0d647..9c01aaa9a 100644
--- a/src/dotty/tools/dotc/transform/AugmentScala2Traits.scala
+++ b/src/dotty/tools/dotc/transform/AugmentScala2Traits.scala
@@ -53,7 +53,7 @@ class AugmentScala2Traits extends MiniPhaseTransform with IdentityDenotTransform
owner = mixin.owner,
name = mixin.name.implClassName,
flags = Abstract | Scala2x,
- parents = defn.ObjectClass.typeRef :: Nil,
+ parents = defn.ObjectType :: Nil,
assocFile = mixin.assocFile).enteredAfter(thisTransform)
def implMethod(meth: TermSymbol): Symbol = {
diff --git a/src/dotty/tools/dotc/transform/FirstTransform.scala b/src/dotty/tools/dotc/transform/FirstTransform.scala
index 4b27c9efe..3b629f9b6 100644
--- a/src/dotty/tools/dotc/transform/FirstTransform.scala
+++ b/src/dotty/tools/dotc/transform/FirstTransform.scala
@@ -71,7 +71,7 @@ class FirstTransform extends MiniPhaseTransform with IdentityDenotTransformer wi
def newCompanion(name: TermName, forClass: Symbol): Thicket = {
val modul = ctx.newCompleteModuleSymbol(ctx.owner, name, Synthetic, Synthetic,
- defn.ObjectClass.typeRef :: Nil, Scopes.newScope)
+ defn.ObjectType :: Nil, Scopes.newScope)
val mc = modul.moduleClass
if (ctx.owner.isClass) modul.enteredAfter(thisTransformer)
ctx.synthesizeCompanionMethod(nme.COMPANION_CLASS_METHOD, forClass, mc).enteredAfter(thisTransformer)
diff --git a/src/dotty/tools/dotc/typer/Checking.scala b/src/dotty/tools/dotc/typer/Checking.scala
index 3dc7b67df..9dfe46232 100644
--- a/src/dotty/tools/dotc/typer/Checking.scala
+++ b/src/dotty/tools/dotc/typer/Checking.scala
@@ -310,7 +310,7 @@ trait Checking {
/** Check that `tp` is a class type with a stable prefix. Also, if `traitReq` is
* true check that `tp` is a trait.
* Stability checking is disabled in phases after RefChecks.
- * @return `tp` itself if it is a class or trait ref, ObjectClass.typeRef if not.
+ * @return `tp` itself if it is a class or trait ref, ObjectType if not.
*/
def checkClassTypeWithStablePrefix(tp: Type, pos: Position, traitReq: Boolean)(implicit ctx: Context): Type =
tp.underlyingClassRef(refinementOK = false) match {
@@ -320,7 +320,7 @@ trait Checking {
tp
case _ =>
ctx.error(d"$tp is not a class type", pos)
- defn.ObjectClass.typeRef
+ defn.ObjectType
}
/** Check that a non-implicit parameter making up the first parameter section of an
diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala
index 3c491fa7a..999efff09 100644
--- a/src/dotty/tools/dotc/typer/Namer.scala
+++ b/src/dotty/tools/dotc/typer/Namer.scala
@@ -579,7 +579,7 @@ class Namer { typer: Typer =>
val pt = checkClassTypeWithStablePrefix(ptype, parent.pos, traitReq = parent ne parents.head)
if (pt.derivesFrom(cls)) {
ctx.error(i"cyclic inheritance: $cls extends itself", parent.pos)
- defn.ObjectClass.typeRef
+ defn.ObjectType
}
else pt
}
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index c621d96c4..10bca44bf 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -373,7 +373,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
def regularTyped(isWildcard: Boolean) = {
val tpt1 =
if (untpd.isWildcardStarArg(tree))
- TypeTree(defn.SeqClass.typeRef.appliedTo(pt :: Nil))
+ TypeTree(defn.SeqType.appliedTo(pt :: Nil))
else
checkSimpleKinded(typedType(tree.tpt))
val expr1 =
@@ -891,7 +891,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
}
def typedAnnotation(annot: untpd.Tree)(implicit ctx: Context): Tree = track("typedAnnotation") {
- typed(annot, defn.AnnotationClass.typeRef)
+ typed(annot, defn.AnnotationType)
}
def typedValDef(vdef: untpd.ValDef, sym: Symbol)(implicit ctx: Context) = track("typedValDef") {
@@ -1034,7 +1034,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
}
def typedAnnotated(tree: untpd.Annotated, pt: Type)(implicit ctx: Context): Tree = track("typedAnnotated") {
- val annot1 = typedExpr(tree.annot, defn.AnnotationClass.typeRef)
+ val annot1 = typedExpr(tree.annot, defn.AnnotationType)
val arg1 = typed(tree.arg, pt)
if (ctx.mode is Mode.Type)
assignType(cpy.Annotated(tree)(annot1, arg1), annot1, arg1)