diff options
Diffstat (limited to 'src/dotty')
-rw-r--r-- | src/dotty/tools/dotc/ast/Desugar.scala | 12 | ||||
-rw-r--r-- | src/dotty/tools/dotc/ast/TreeInfo.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/ast/TypedTrees.scala | 8 | ||||
-rw-r--r-- | src/dotty/tools/dotc/ast/UntypedTrees.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Annotations.scala | 8 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Constants.scala | 22 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Definitions.scala | 72 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 8 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Symbols.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/TypeComparer.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/TypeOps.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 12 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/pickling/ClassfileParser.scala | 22 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/pickling/UnPickler.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/transform/Erasure.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/parsing/TreeBuilder.scala.unused | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Namer.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 6 |
18 files changed, 96 insertions, 96 deletions
diff --git a/src/dotty/tools/dotc/ast/Desugar.scala b/src/dotty/tools/dotc/ast/Desugar.scala index cbac66b6b..62f02dc82 100644 --- a/src/dotty/tools/dotc/ast/Desugar.scala +++ b/src/dotty/tools/dotc/ast/Desugar.scala @@ -175,7 +175,7 @@ object desugar { } else Nil - def anyRef = ref(defn.AnyRefAlias.typeConstructor) + def anyRef = ref(defn.AnyRefAlias.typeRef) def parentConstr(tpt: Tree) = Select(New(tpt), nme.CONSTRUCTOR) val parents1 = if (parents.isEmpty) parentConstr(anyRef) :: Nil else parents @@ -314,7 +314,7 @@ object desugar { } def makeAnnotated(cls: Symbol, tree: Tree)(implicit ctx: Context) = - Annotated(TypedSplice(tpd.New(cls.typeConstructor)), tree) + Annotated(TypedSplice(tpd.New(cls.typeRef)), tree) private def derivedValDef(mods: Modifiers, named: NameTree, tpt: Tree, rhs: Tree) = ValDef(mods, named.name.asTermName, tpt, rhs).withPos(named.pos) @@ -509,7 +509,7 @@ object desugar { // begin desugar tree match { case SymbolLit(str) => - New(ref(defn.SymbolClass.typeConstructor), (Literal(Constant(str)) :: Nil) :: Nil) + New(ref(defn.SymbolClass.typeRef), (Literal(Constant(str)) :: Nil) :: Nil) case InterpolatedString(id, strs, elems) => Apply(Select(Apply(Ident(nme.StringContext), strs), id), elems) case InfixOp(l, op, r) => @@ -528,7 +528,7 @@ object desugar { } case PrefixOp(op, t) => if ((ctx.mode is Mode.Type) && op == nme.ARROWkw) - AppliedTypeTree(ref(defn.ByNameParamClass.typeConstructor), t) + AppliedTypeTree(ref(defn.ByNameParamClass.typeRef), t) else Select(t, nme.UNARY_PREFIX ++ op) case Parens(t) => @@ -536,7 +536,7 @@ object desugar { case Tuple(ts) => if (unboxedPairs) { def PairTypeTree(l: Tree, r: Tree) = - AppliedTypeTree(ref(defn.PairClass.typeConstructor), l :: r :: Nil) + AppliedTypeTree(ref(defn.PairClass.typeRef), l :: r :: Nil) if (ctx.mode is Mode.Type) ts.reduceRight(PairTypeTree) else if (ts.isEmpty) unitLiteral else ts.reduceRight(Pair(_, _)) @@ -549,7 +549,7 @@ object desugar { unitLiteral } else if (arity == 1) ts.head - else if (ctx.mode is Mode.Type) AppliedTypeTree(ref(tupleClass.typeConstructor), ts) + else if (ctx.mode is Mode.Type) AppliedTypeTree(ref(tupleClass.typeRef), ts) else if (arity == 0) unitLiteral else Apply(ref(tupleClass.companionModule.symRef), ts) } diff --git a/src/dotty/tools/dotc/ast/TreeInfo.scala b/src/dotty/tools/dotc/ast/TreeInfo.scala index 60344267f..ed9b1b81a 100644 --- a/src/dotty/tools/dotc/ast/TreeInfo.scala +++ b/src/dotty/tools/dotc/ast/TreeInfo.scala @@ -224,7 +224,7 @@ trait TreeInfo[T >: Untyped] { self: Trees.Instance[T] => /** Does this CaseDef catch Throwable? */ def catchesThrowable(cdef: CaseDef)(implicit ctx: Context) = - catchesAllOf(cdef, defn.ThrowableClass.typeConstructor) + catchesAllOf(cdef, defn.ThrowableClass.typeRef) /** 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/TypedTrees.scala b/src/dotty/tools/dotc/ast/TypedTrees.scala index 8a966696f..315796c65 100644 --- a/src/dotty/tools/dotc/ast/TypedTrees.scala +++ b/src/dotty/tools/dotc/ast/TypedTrees.scala @@ -148,7 +148,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { def SeqLiteral(elems: List[Tree])(implicit ctx: Context): SeqLiteral = untpd.SeqLiteral(elems) - .withType(defn.SeqClass.typeConstructor.appliedTo(ctx.typeComparer.lub(elems.tpes))) + .withType(defn.SeqClass.typeRef.appliedTo(ctx.typeComparer.lub(elems.tpes))) .checked def SeqLiteral(tpe: Type, elems: List[Tree])(implicit ctx: Context): SeqLiteral = { @@ -160,7 +160,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { def JavaSeqLiteral(elems: List[Tree])(implicit ctx: Context): SeqLiteral = new untpd.JavaSeqLiteral(elems) - .withType(defn.ArrayClass.typeConstructor.appliedTo(ctx.typeComparer.lub(elems.tpes))) + .withType(defn.ArrayClass.typeRef.appliedTo(ctx.typeComparer.lub(elems.tpes))) .checked def TypeTree(original: Tree)(implicit ctx: Context): TypeTree = @@ -225,7 +225,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { val (tparams, mtp) = sym.info match { case tp: PolyType => val tparams = ctx.newTypeParams(sym, tp.paramNames, EmptyFlags, tp.instantiateBounds) - (tparams, tp.instantiate(tparams map (_.typeConstructor))) + (tparams, tp.instantiate(tparams map (_.typeRef))) case tp => (Nil, tp) } @@ -346,7 +346,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { val modcls = sym.moduleClass.asClass val constr = DefDef(modcls.primaryConstructor.asTerm, EmptyTree) val clsdef = ClassDef(modcls, constr, body) - val valdef = ValDef(sym, New(modcls.typeConstructor)) + val valdef = ValDef(sym, New(modcls.typeRef)) Thicket(valdef, clsdef) } diff --git a/src/dotty/tools/dotc/ast/UntypedTrees.scala b/src/dotty/tools/dotc/ast/UntypedTrees.scala index c5a41661e..774f24394 100644 --- a/src/dotty/tools/dotc/ast/UntypedTrees.scala +++ b/src/dotty/tools/dotc/ast/UntypedTrees.scala @@ -120,7 +120,7 @@ object untpd extends Trees.Instance[Untyped] with TreeInfo[Untyped] { def ref(tp: NamedType)(implicit ctx: Context): Tree = TypedSplice(tpd.ref(tp)) - def scalaUnit(implicit ctx: Context) = ref(defn.UnitClass.typeConstructor) + def scalaUnit(implicit ctx: Context) = ref(defn.UnitClass.typeRef) def makeConstructor(mods: Modifiers, tparams: List[TypeDef], vparamss: List[List[ValDef]], rhs: Tree = EmptyTree)(implicit ctx: Context): DefDef = DefDef(mods, 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 90b916971..6930429b5 100644 --- a/src/dotty/tools/dotc/core/Annotations.scala +++ b/src/dotty/tools/dotc/core/Annotations.scala @@ -37,7 +37,7 @@ object Annotations { apply(cls, arg1 :: arg2 :: Nil) def apply(cls: ClassSymbol, args: List[Tree])(implicit ctx: Context): Annotation = - apply(cls.typeConstructor, args) + apply(cls.typeRef, args) def apply(atp: Type, arg: Tree)(implicit ctx: Context): Annotation = apply(atp, arg :: Nil) @@ -58,11 +58,11 @@ object Annotations { apply(defn.AliasAnnot, List(Ident(TermRef.withSig(sym.owner.thisType, sym.name, sym.signature).withDenot(sym)))) def makeChild(sym: Symbol)(implicit ctx: Context) = - apply(defn.ChildAnnot.typeConstructor.appliedTo(sym.owner.thisType.select(sym.name, sym)), Nil) + apply(defn.ChildAnnot.typeRef.appliedTo(sym.owner.thisType.select(sym.name, sym)), Nil) } def ThrowsAnnotation(cls: ClassSymbol)(implicit ctx: Context) = { - val tref = cls.symTypeRef - Annotation(defn.ThrowsAnnot.typeConstructor.appliedTo(tref), Ident(tref)) + val tref = cls.typeRef + Annotation(defn.ThrowsAnnot.typeRef.appliedTo(tref), Ident(tref)) } }
\ No newline at end of file diff --git a/src/dotty/tools/dotc/core/Constants.scala b/src/dotty/tools/dotc/core/Constants.scala index b2949aae7..50bebefe9 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.typeConstructor - case BooleanTag => defn.BooleanClass.typeConstructor - case ByteTag => defn.ByteClass.typeConstructor - case ShortTag => defn.ShortClass.typeConstructor - case CharTag => defn.CharClass.typeConstructor - case IntTag => defn.IntClass.typeConstructor - case LongTag => defn.LongClass.typeConstructor - case FloatTag => defn.FloatClass.typeConstructor - case DoubleTag => defn.DoubleClass.typeConstructor - case StringTag => defn.StringClass.typeConstructor - case NullTag => defn.NullClass.typeConstructor + 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 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 9d03d001f..f7f3bde87 100644 --- a/src/dotty/tools/dotc/core/Definitions.scala +++ b/src/dotty/tools/dotc/core/Definitions.scala @@ -144,9 +144,9 @@ class Definitions(implicit ctx: Context) { lazy val NotNullClass = requiredClass("scala.NotNull") lazy val NothingClass: ClassSymbol = newCompleteClassSymbol( - ScalaPackageClass, tpnme.Nothing, AbstractFinal, List(AnyClass.typeConstructor)) + ScalaPackageClass, tpnme.Nothing, AbstractFinal, List(AnyClass.typeRef)) lazy val NullClass: ClassSymbol = newCompleteClassSymbol( - ScalaPackageClass, tpnme.Null, AbstractFinal, List(AnyRefAlias.typeConstructor)) + ScalaPackageClass, tpnme.Null, AbstractFinal, List(AnyRefAlias.typeRef)) lazy val PredefModule = requiredModule("scala.Predef") lazy val NilModule = requiredModule("scala.collection.immutable.Nil") @@ -157,7 +157,7 @@ class Definitions(implicit ctx: Context) { // but does not define it as an explicit class. newCompleteClassSymbol( ScalaPackageClass, tpnme.Singleton, Trait | Interface | Final, - List(AnyClass.typeConstructor), EmptyScope) + List(AnyClass.typeRef), EmptyScope) lazy val SeqClass: ClassSymbol = requiredClass("scala.collection.Seq") lazy val ArrayClass: ClassSymbol = requiredClass("scala.Array") lazy val uncheckedStableClass: ClassSymbol = requiredClass("scala.annotation.unchecked.uncheckedStable") @@ -235,35 +235,35 @@ class Definitions(implicit ctx: Context) { def methOfAnyRef(tp: Type) = MethodType(List(AnyRefType), tp) // Derived types - def AnyType: Type = AnyClass.typeConstructor - def AnyValType: Type = AnyValClass.typeConstructor - def ObjectType: Type = ObjectClass.typeConstructor - def AnyRefType: Type = AnyRefAlias.typeConstructor - def NotNullType: Type = NotNullClass.typeConstructor - def NothingType: Type = NothingClass.typeConstructor - def NullType: Type = NullClass.typeConstructor - def SeqType: Type = SeqClass.typeConstructor - def ArrayType: Type = ArrayClass.typeConstructor + def AnyType: Type = AnyClass.typeRef + def AnyValType: Type = AnyValClass.typeRef + def ObjectType: Type = ObjectClass.typeRef + def AnyRefType: Type = AnyRefAlias.typeRef + def NotNullType: Type = NotNullClass.typeRef + def NothingType: Type = NothingClass.typeRef + def NullType: Type = NullClass.typeRef + def SeqType: Type = SeqClass.typeRef + def ArrayType: Type = ArrayClass.typeRef def ObjectArrayType = ArrayType.appliedTo(ObjectType) - def UnitType: Type = UnitClass.typeConstructor - def BooleanType: Type = BooleanClass.typeConstructor - def ByteType: Type = ByteClass.typeConstructor - def ShortType: Type = ShortClass.typeConstructor - def CharType: Type = CharClass.typeConstructor - def IntType: Type = IntClass.typeConstructor - def LongType: Type = LongClass.typeConstructor - def FloatType: Type = FloatClass.typeConstructor - def DoubleType: Type = DoubleClass.typeConstructor - def PairType: Type = PairClass.typeConstructor - def StringType: Type = StringClass.typeConstructor - def RepeatedParamType = RepeatedParamClass.typeConstructor - def JavaRepeatedParamType = JavaRepeatedParamClass.typeConstructor - def ThrowableType = ThrowableClass.typeConstructor - def OptionType = OptionClass.typeConstructor + def UnitType: Type = UnitClass.typeRef + def BooleanType: Type = BooleanClass.typeRef + def ByteType: Type = ByteClass.typeRef + def ShortType: Type = ShortClass.typeRef + def CharType: Type = CharClass.typeRef + def IntType: Type = IntClass.typeRef + def LongType: Type = LongClass.typeRef + def FloatType: Type = FloatClass.typeRef + def DoubleType: Type = DoubleClass.typeRef + def PairType: Type = PairClass.typeRef + def StringType: Type = StringClass.typeRef + def RepeatedParamType = RepeatedParamClass.typeRef + def JavaRepeatedParamType = JavaRepeatedParamClass.typeRef + def ThrowableType = ThrowableClass.typeRef + def OptionType = OptionClass.typeRef def ClassType(arg: Type)(implicit ctx: Context) = { - val ctype = ClassClass.typeConstructor + val ctype = ClassClass.typeRef if (ctx.phase.erasedTypes) ctype else ctype.appliedTo(arg) } @@ -273,11 +273,11 @@ class Definitions(implicit ctx: Context) { // - sym: the symbol of the actual enumeration value (VAL1) // - .owner: the ModuleClassSymbol of the enumeration (object E) // - .linkedClass: the ClassSymbol of the enumeration (class E) - sym.owner.linkedClass.typeConstructor + sym.owner.linkedClass.typeRef object FunctionType { def apply(args: List[Type], resultType: Type) = - FunctionClass(args.length).typeConstructor.appliedTo(args :+ resultType) + FunctionClass(args.length).typeRef.appliedTo(args :+ resultType) def unapply(ft: Type) = { val tsym = ft.typeSymbol lazy val targs = ft.typeArgs @@ -362,7 +362,7 @@ class Definitions(implicit ctx: Context) { val paramDecls = newScope for ((v, i) <- vcs.zipWithIndex) newTypeParam(cls, tpnme.higherKindedParamName(i), varianceFlags(v), paramDecls) - denot.info = ClassInfo(ScalaPackageClass.thisType, cls, List(ObjectClass.typeConstructor), paramDecls) + denot.info = ClassInfo(ScalaPackageClass.thisType, cls, List(ObjectClass.typeRef), paramDecls) } } @@ -657,8 +657,8 @@ class Definitions(implicit ctx: Context) { // convenient one-argument parameter lists lazy val anyparam = List(AnyClass.tpe) - lazy val anyvalparam = List(AnyValClass.typeConstructor) - lazy val anyrefparam = List(AnyRefClass.typeConstructor) + lazy val anyvalparam = List(AnyValClass.typeRef) + lazy val anyrefparam = List(AnyRefClass.typeRef) // private parameter conveniences private def booltype = BooleanClass.tpe @@ -1205,7 +1205,7 @@ class Definitions(implicit ctx: Context) { /** Given type U, creates a Type representing Class[_ <: U]. */ def boundedClassType(upperBound: Type) = - appliedTypeAsUpperBounds(ClassClass.typeConstructor, List(upperBound)) + appliedTypeAsUpperBounds(ClassClass.typeRef, List(upperBound)) /** To avoid unchecked warnings on polymorphic classes, translate * a Foo[T] into a Foo[_] for use in the pattern matcher. @@ -1262,7 +1262,7 @@ class Definitions(implicit ctx: Context) { // java.lang.Object. Java also special cases the return type. lazy val Any_getClass = enterNewMethod(AnyClass, nme.getClass_, Nil, requiredMethod(ObjectClass, nme.getClass_).tpe.resultType, DEFERRED) lazy val Any_isInstanceOf = newT1NullaryMethod(AnyClass, nme.isInstanceOf_, Final)(_ => BooleanType) - lazy val Any_asInstanceOf = newT1NullaryMethod(AnyClass, nme.asInstanceOf_, Final)(_.typeConstructor) + lazy val Any_asInstanceOf = newT1NullaryMethod(AnyClass, nme.asInstanceOf_, Final)(_.typeRef) // A type function from T => Class[U], used to determine the return // type of getClass calls. The returned type is: @@ -1692,7 +1692,7 @@ class Definitions(implicit ctx: Context) { // TODO: set type bounds manually (-> MulticastDelegate), see newTypeParam val newCaller = enterNewMethod(DelegateClass, name, paramTypes, delegateType, Final | STATIC) // val newCaller = newPolyMethod(DelegateClass, name, - // tparam => MethodType(paramTypes, tparam.typeConstructor)) setFlag (Final | STATIC) + // tparam => MethodType(paramTypes, tparam.typeRef)) setFlag (Final | STATIC) Delegate_scalaCallers = Delegate_scalaCallers ::: List(newCaller) nbScalaCallers += 1 newCaller diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index de4a1d8e3..2e90f3170 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -634,7 +634,7 @@ object SymDenotations { /** The named typeref representing the type constructor for this type. * @throws ClassCastException is this is not a type */ - def typeConstructor(implicit ctx: Context): TypeRef = + def typeRef(implicit ctx: Context): TypeRef = if ((this is PackageClass) || owner.isTerm) symTypeRef else TypeRef(owner.thisType, name.asTypeName).withDenot(this) @@ -779,8 +779,8 @@ object SymDenotations { private[this] var myTypeConstructor: TypeRef = null - override def typeConstructor(implicit ctx: Context): TypeRef = { - if (myTypeConstructor == null) myTypeConstructor = super.typeConstructor + override def typeRef(implicit ctx: Context): TypeRef = { + if (myTypeConstructor == null) myTypeConstructor = super.typeRef myTypeConstructor } @@ -1003,7 +1003,7 @@ object SymDenotations { ctx.debugTraceIndented(s"$tp.baseType($this)") { if (symbol.isStatic && tp.derivesFrom(symbol)) - symbol.typeConstructor + symbol.typeRef else tp match { case tp: CachedType => if (baseTypeValid != ctx.runId) { diff --git a/src/dotty/tools/dotc/core/Symbols.scala b/src/dotty/tools/dotc/core/Symbols.scala index 7869f75b9..e18286426 100644 --- a/src/dotty/tools/dotc/core/Symbols.scala +++ b/src/dotty/tools/dotc/core/Symbols.scala @@ -206,7 +206,7 @@ trait Symbols { this: Context => /** Create a class constructor symbol for given class `cls`. */ def newConstructor(cls: ClassSymbol, flags: FlagSet, paramNames: List[TermName], paramTypes: List[Type], privateWithin: Symbol = NoSymbol, coord: Coord = NoCoord) = - newSymbol(cls, nme.CONSTRUCTOR, flags | Method, MethodType(paramNames, paramTypes)(_ => cls.typeConstructor), privateWithin, coord) + newSymbol(cls, nme.CONSTRUCTOR, flags | Method, MethodType(paramNames, paramTypes)(_ => cls.typeRef), privateWithin, coord) /** Create an empty default constructor symbol for given class `cls`. */ def newDefaultConstructor(cls: ClassSymbol) = @@ -463,7 +463,7 @@ object Symbols { override def superId(implicit ctx: Context): Int = { val hint = superIdHint - val key = this.typeConstructor + val key = this.typeRef if (hint >= 0 && hint <= ctx.lastSuperId && (ctx.classOfId(hint) eq key)) hint else { diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala index b1081e433..b554e0bea 100644 --- a/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/src/dotty/tools/dotc/core/TypeComparer.scala @@ -333,7 +333,7 @@ class TypeComparer(initctx: Context) extends DotClass { ((v > 0) || (lo2 isRef NothingClass) || isSubType(lo2, lo1)) && ((v < 0) || (hi2 isRef AnyClass) || isSubType(hi1, hi2)) case tp1: ClassInfo => - val tt = tp1.typeConstructor // was typeTemplate + val tt = tp1.typeRef isSubType(lo2, tt) && isSubType(tt, hi2) case _ => false diff --git a/src/dotty/tools/dotc/core/TypeOps.scala b/src/dotty/tools/dotc/core/TypeOps.scala index c48a8e715..cdc695ebd 100644 --- a/src/dotty/tools/dotc/core/TypeOps.scala +++ b/src/dotty/tools/dotc/core/TypeOps.scala @@ -146,7 +146,7 @@ trait TypeOps { this: Context => case tp: TypeRef => tp case ErrorType => - defn.AnyClass.typeConstructor + defn.AnyClass.typeRef case _ => throw new TypeError(s"unexpected parent type: $tp") } diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 916f2cdc6..5617fa6cc 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -731,7 +731,7 @@ object Types { /** This type seen as a TypeBounds */ final def bounds(implicit ctx: Context): TypeBounds = this match { case tp: TypeBounds => tp - case ci: ClassInfo => TypeAlias(ci.typeConstructor) + case ci: ClassInfo => TypeAlias(ci.typeRef) case wc: WildcardType => wc.optBounds match { case bounds: TypeBounds => bounds @@ -961,7 +961,7 @@ object Types { */ def translateParameterized(from: ClassSymbol, to: ClassSymbol)(implicit ctx: Context): Type = if (this derivesFrom from) - RefinedType(to.typeConstructor, to.typeParams.head.name, member(from.typeParams.head.name).info) + RefinedType(to.typeRef, to.typeParams.head.name, member(from.typeParams.head.name).info) else this /** If this is an encoding of a (partially) applied type, return its arguments, @@ -2080,7 +2080,7 @@ object Types { selfInfo: DotClass /* should be: Type | Symbol */) extends CachedGroundType with TypeType { def selfType(implicit ctx: Context): Type = selfInfo match { - case NoType => cls.typeConstructor + case NoType => cls.typeRef case self: Symbol => self.info case tp: Type => tp } @@ -2091,7 +2091,7 @@ object Types { private var tyconCache: Type = null - def typeConstructor(implicit ctx: Context): Type = { + def typeRef(implicit ctx: Context): Type = { def clsDenot = if (prefix eq cls.owner.thisType) cls.denot else cls.denot.copySymDenotation(info = this) if (tyconCache == null) tyconCache = @@ -2195,7 +2195,7 @@ object Types { * @see Definitions.hkTrait */ def higherKinded(boundSyms: List[Symbol])(implicit ctx: Context) = { - val parent = defn.hkTrait(boundSyms map (_.variance)).typeConstructor + val parent = defn.hkTrait(boundSyms map (_.variance)).typeRef val hkParamNames = boundSyms.indices.toList map tpnme.higherKindedParamName def substBoundSyms(tp: Type)(rt: RefinedType): Type = tp.subst(boundSyms, hkParamNames map (TypeRef(RefinedThis(rt), _))) @@ -2311,7 +2311,7 @@ object Types { case _ => false } val noParamsNeeded = (tp.cls is Trait) || zeroParams(tp.cls.primaryConstructor.info) - val selfTypeFeasible = tp.typeConstructor <:< tp.selfType + val selfTypeFeasible = tp.typeRef <:< tp.selfType noParamsNeeded && selfTypeFeasible case tp: RefinedType => isInstantiatable(tp.underlying) diff --git a/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala b/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala index a641e10cc..b68f9eb6f 100644 --- a/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala +++ b/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala @@ -101,11 +101,11 @@ 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.typeConstructor } - else pool.getSuperClass(in.nextChar).typeConstructor + val superType = if (isAnnotation) { in.nextChar; defn.AnnotationClass.typeRef } + else pool.getSuperClass(in.nextChar).typeRef val ifaceCount = in.nextChar - var ifaces = for (i <- List.range(0, ifaceCount)) yield pool.getSuperClass(in.nextChar).typeConstructor - if (isAnnotation) ifaces = defn.ClassfileAnnotationClass.typeConstructor :: ifaces + var ifaces = for (i <- List.range(0, ifaceCount)) yield pool.getSuperClass(in.nextChar).typeRef + if (isAnnotation) ifaces = defn.ClassfileAnnotationClass.typeRef :: ifaces superType :: ifaces } @@ -190,7 +190,7 @@ class ClassfileParser( */ def normalizeConstructorInfo() = { val mt @ MethodType(paramnames, paramtypes) = denot.info - val rt = classRoot.typeConstructor appliedTo (classRoot.typeParams map (_.symRef)) + val rt = classRoot.typeRef appliedTo (classRoot.typeParams map (_.symRef)) denot.info = mt.derivedMethodType(paramnames, paramtypes, rt) addConstructorTypeParams(denot) } @@ -283,12 +283,12 @@ class ClassfileParser( } val classSym = classNameToSymbol(subName(c => c == ';' || c == '<')) - var tpe = processClassType(processInner(classSym.typeConstructor)) + var tpe = processClassType(processInner(classSym.typeRef)) while (sig(index) == '.') { accept('.') val name = subName(c => c == ';' || c == '<' || c == '.').toTypeName val clazz = tpe.member(name).symbol - tpe = processClassType(processInner(clazz.typeConstructor)) + tpe = processClassType(processInner(clazz.typeRef)) } accept(';') tpe @@ -321,7 +321,7 @@ class ClassfileParser( val n = subName(';'.==).toTypeName index += 1 //assert(tparams contains n, s"classTparams = $classTParams, tparams = $tparams, key = $n") - if (skiptvs) defn.AnyType else tparams(n).typeConstructor + if (skiptvs) defn.AnyType else tparams(n).typeRef } } // sig2type(tparams, skiptvs) @@ -867,11 +867,11 @@ class ClassfileParser( } else { val sym = classNameToSymbol(name) values(index) = sym - c = sym.typeConstructor + c = sym.typeRef } } else c = value match { case tp: Type => tp - case cls: Symbol => cls.typeConstructor + case cls: Symbol => cls.typeRef } c } @@ -907,7 +907,7 @@ class ClassfileParser( } value match { case ct: Constant => ct - case cls: Symbol => Constant(cls.typeConstructor) + case cls: Symbol => Constant(cls.typeRef) case arr: Type => Constant(arr) } } diff --git a/src/dotty/tools/dotc/core/pickling/UnPickler.scala b/src/dotty/tools/dotc/core/pickling/UnPickler.scala index 386ea3d85..02db4b0b0 100644 --- a/src/dotty/tools/dotc/core/pickling/UnPickler.scala +++ b/src/dotty/tools/dotc/core/pickling/UnPickler.scala @@ -781,7 +781,7 @@ class UnPickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClassRoot: val end = readNat() + readIndex // array elements are trees representing instances of scala.annotation.Annotation SeqLiteral( - defn.SeqType.appliedTo(defn.AnnotationClass.typeConstructor :: Nil), + defn.SeqType.appliedTo(defn.AnnotationClass.typeRef :: Nil), until(end, () => readClassfileAnnotArg(readNat()))) } diff --git a/src/dotty/tools/dotc/core/transform/Erasure.scala b/src/dotty/tools/dotc/core/transform/Erasure.scala index 119400fdb..03726e4f5 100644 --- a/src/dotty/tools/dotc/core/transform/Erasure.scala +++ b/src/dotty/tools/dotc/core/transform/Erasure.scala @@ -37,7 +37,7 @@ object Erasure { val sym = tp.symbol if (sym.isClass) /*if (sym.isDerivedValueClass) eraseDerivedValueClassRef(tref) - else */if (sym.owner is Package) normalizeClass(sym.asClass).typeConstructor + else */if (sym.owner is Package) normalizeClass(sym.asClass).typeRef else tp.derivedSelect(erasure(tp.prefix)) else erasure(tp.info) case tp: RefinedType => @@ -60,7 +60,7 @@ object Erasure { case tp @ ClassInfo(pre, cls, classParents, decls, _) => val parents: List[TypeRef] = if (cls == defn.ObjectClass || cls.isPrimitiveValueClass) Nil - else if (cls == defn.ArrayClass) defn.ObjectClass.typeConstructor :: Nil + else if (cls == defn.ArrayClass) defn.ObjectClass.typeRef :: Nil else removeLaterObjects(classParents mapConserve (erasure(_).asInstanceOf[TypeRef])) tp.derivedClassInfo(erasure(pre), parents, NoType) case ErrorType => diff --git a/src/dotty/tools/dotc/parsing/TreeBuilder.scala.unused b/src/dotty/tools/dotc/parsing/TreeBuilder.scala.unused index 12377ca94..672c85179 100644 --- a/src/dotty/tools/dotc/parsing/TreeBuilder.scala.unused +++ b/src/dotty/tools/dotc/parsing/TreeBuilder.scala.unused @@ -434,7 +434,7 @@ class TreeBuilder(implicit ctx: Context) { } def mkAnnotated(cls: Symbol, tree: Tree) = - Annotated(TypedSplice(tpd.New(cls.typeConstructor)), tree) + Annotated(TypedSplice(tpd.New(cls.typeRef)), tree) /** Create visitor <x => x match cases> */ def makeVisitor(cases: List[CaseDef], checkExhaustive: Boolean, canDrop: Boolean = false): Tree = { diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala index 62405abd9..c8cc7452c 100644 --- a/src/dotty/tools/dotc/typer/Namer.scala +++ b/src/dotty/tools/dotc/typer/Namer.scala @@ -423,7 +423,7 @@ class Namer { typer: Typer => if (isConstructor) { // set result type tree to unit, but set the current class as result type of the symbol typedAheadType(ddef.tpt, defn.UnitType) - wrapMethType(sym.owner.typeConstructor.appliedTo(typeParams map (_.symRef))) + wrapMethType(sym.owner.typeRef.appliedTo(typeParams map (_.symRef))) } else valOrDefDefSig(ddef, sym, wrapMethType) } diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 4242b5c99..54e105238 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -472,7 +472,7 @@ class Typer extends Namer with Applications with Implicits { val untpd.Function(args, body) = tree if (ctx.mode is Mode.Type) typed(cpy.AppliedTypeTree(tree, - ref(defn.FunctionClass(args.length).typeConstructor), args :+ body), pt) + ref(defn.FunctionClass(args.length).typeRef), args :+ body), pt) else { val params = args.asInstanceOf[List[ValDef]] val protoFormals: List[Type] = pt match { @@ -710,7 +710,7 @@ class Typer extends Namer with Applications with Implicits { } def typedAnnotation(annot: untpd.Tree)(implicit ctx: Context): Tree = track("typedAnnotation") { - typed(annot, defn.AnnotationClass.typeConstructor) + typed(annot, defn.AnnotationClass.typeRef) } def typedValDef(vdef: untpd.ValDef, sym: Symbol)(implicit ctx: Context) = track("typedValDef") { @@ -768,7 +768,7 @@ class Typer extends Namer with Applications with Implicits { } def typedAnnotated(tree: untpd.Annotated, pt: Type)(implicit ctx: Context): Tree = track("typedAnnotated") { - val annot1 = typed(tree.annot, defn.AnnotationClass.typeConstructor) + val annot1 = typed(tree.annot, defn.AnnotationClass.typeRef) val arg1 = typed(tree.arg, pt) val ownType = AnnotatedType(Annotation(annot1), arg1.tpe) if (ctx.mode is Mode.Type) |