aboutsummaryrefslogtreecommitdiff
path: root/src/dotty
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-11-07 22:49:21 +0100
committerMartin Odersky <odersky@gmail.com>2015-11-09 15:45:39 +0100
commitaf6ffc319cb23c5ade01251a93810f7a33429e58 (patch)
tree99dd27434fcc4fd37aeaae359ea5d0e1f9700767 /src/dotty
parent5398c5a723b0f8b0d35e6c3ad230c5046169e837 (diff)
downloaddotty-af6ffc319cb23c5ade01251a93810f7a33429e58.tar.gz
dotty-af6ffc319cb23c5ade01251a93810f7a33429e58.tar.bz2
dotty-af6ffc319cb23c5ade01251a93810f7a33429e58.zip
Renamings in Definitions
TypeRef becomes Type, thus removing duplicates. Where ...Type was used in an extraction (e.g. ArrayType(...), FunctionType(...)), we now use ...Of.
Diffstat (limited to 'src/dotty')
-rw-r--r--src/dotty/tools/backend/jvm/CollectEntryPoints.scala9
-rw-r--r--src/dotty/tools/backend/jvm/scalaPrimitives.scala2
-rw-r--r--src/dotty/tools/dotc/ast/Desugar.scala4
-rw-r--r--src/dotty/tools/dotc/ast/tpd.scala8
-rw-r--r--src/dotty/tools/dotc/config/JavaPlatform.scala6
-rw-r--r--src/dotty/tools/dotc/core/Definitions.scala230
-rw-r--r--src/dotty/tools/dotc/core/TypeApplications.scala2
-rw-r--r--src/dotty/tools/dotc/core/TypeComparer.scala4
-rw-r--r--src/dotty/tools/dotc/core/TypeErasure.scala6
-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/transform/ClassTags.scala2
-rw-r--r--src/dotty/tools/dotc/transform/ElimByName.scala2
-rw-r--r--src/dotty/tools/dotc/transform/ElimRepeated.scala2
-rw-r--r--src/dotty/tools/dotc/transform/NonLocalReturns.scala6
-rw-r--r--src/dotty/tools/dotc/transform/PatternMatcher.scala4
-rw-r--r--src/dotty/tools/dotc/transform/TypeTestsCasts.scala2
-rw-r--r--src/dotty/tools/dotc/typer/Applications.scala4
-rw-r--r--src/dotty/tools/dotc/typer/ProtoTypes.scala2
-rw-r--r--src/dotty/tools/dotc/typer/TypeAssigner.scala2
20 files changed, 140 insertions, 163 deletions
diff --git a/src/dotty/tools/backend/jvm/CollectEntryPoints.scala b/src/dotty/tools/backend/jvm/CollectEntryPoints.scala
index 80907fb99..3ed232bc7 100644
--- a/src/dotty/tools/backend/jvm/CollectEntryPoints.scala
+++ b/src/dotty/tools/backend/jvm/CollectEntryPoints.scala
@@ -49,13 +49,10 @@ class CollectEntryPoints extends MiniPhaseTransform {
object CollectEntryPoints{
def isJavaMainMethod(sym: Symbol)(implicit ctx: Context) = {
- val d = ctx.definitions
- val StringType = d.StringType
-
(sym.name == nme.main) && (sym.info match {
- case r@MethodType(_, List(d.ArrayType(t))) =>
- (t.widenDealias =:= StringType) && (
- r.resultType.widenDealias =:= d.UnitType)
+ case r@MethodType(_, List(defn.ArrayOf(t))) =>
+ (t.widenDealias =:= defn.StringType) && (
+ r.resultType.widenDealias =:= defn.UnitType)
case _ => false
})
}
diff --git a/src/dotty/tools/backend/jvm/scalaPrimitives.scala b/src/dotty/tools/backend/jvm/scalaPrimitives.scala
index 4eeeb4b01..0027defa7 100644
--- a/src/dotty/tools/backend/jvm/scalaPrimitives.scala
+++ b/src/dotty/tools/backend/jvm/scalaPrimitives.scala
@@ -69,7 +69,7 @@ class DottyPrimitives(ctx: Context) {
}
def elementType: Type = tpe.widenDealias match {
- case defn.ArrayType(el) => el
+ case defn.ArrayOf(el) => el
case JavaArrayType(el) => el
case _ =>
ctx.error(s"expected Array $tpe")
diff --git a/src/dotty/tools/dotc/ast/Desugar.scala b/src/dotty/tools/dotc/ast/Desugar.scala
index ad34533aa..c028f5cf1 100644
--- a/src/dotty/tools/dotc/ast/Desugar.scala
+++ b/src/dotty/tools/dotc/ast/Desugar.scala
@@ -323,7 +323,7 @@ object desugar {
def anyRef = ref(defn.AnyRefAlias.typeRef)
def productConstr(n: Int) = {
- val tycon = ref(defn.ProductNTypeRef(n))
+ val tycon = ref(defn.ProductNType(n))
val targs = constrVparamss.head map (_.tpt)
if (targs.isEmpty) tycon else AppliedTypeTree(tycon, targs)
}
@@ -825,7 +825,7 @@ object desugar {
}
else {
val arity = ts.length
- def tupleTypeRef = defn.TupleTypeRef(arity)
+ def tupleTypeRef = defn.TupleType(arity)
if (arity > Definitions.MaxTupleArity) {
ctx.error(s"tuple too long (max allowed: ${Definitions.MaxTupleArity})", tree.pos)
unitLiteral
diff --git a/src/dotty/tools/dotc/ast/tpd.scala b/src/dotty/tools/dotc/ast/tpd.scala
index a945f8ba9..44372ff9e 100644
--- a/src/dotty/tools/dotc/ast/tpd.scala
+++ b/src/dotty/tools/dotc/ast/tpd.scala
@@ -375,7 +375,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
newArr(elemClass.name.toString)
else
newArr("Ref").appliedToTypeTrees(
- TypeTree(defn.ArrayType(elemType)).withPos(typeArg.pos) :: Nil)
+ TypeTree(defn.ArrayOf(elemType)).withPos(typeArg.pos) :: Nil)
}
// ------ Creating typed equivalents of trees that exist only in untyped form -------
@@ -863,14 +863,14 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
val defn = ctx.definitions
val prefix = args.take(selected.widen.paramTypess.head.size - 1)
expectedType match {
- case defn.ArrayType(el) =>
+ case defn.ArrayOf(el) =>
lastParam.tpe match {
- case defn.ArrayType(el2) if el2 <:< el =>
+ case defn.ArrayOf(el2) if el2 <:< el =>
// we have a JavaSeqLiteral with a more precise type
// we cannot construct a tree as JavaSeqLiteral infered to precise type
// if we add typed than it would be both type-correct and
// will pass Ycheck
- prefix ::: List(tpd.Typed(lastParam, TypeTree(defn.ArrayType(el))))
+ prefix ::: List(tpd.Typed(lastParam, TypeTree(defn.ArrayOf(el))))
case _ =>
???
}
diff --git a/src/dotty/tools/dotc/config/JavaPlatform.scala b/src/dotty/tools/dotc/config/JavaPlatform.scala
index 41a9c7113..432a9a0b7 100644
--- a/src/dotty/tools/dotc/config/JavaPlatform.scala
+++ b/src/dotty/tools/dotc/config/JavaPlatform.scala
@@ -19,13 +19,11 @@ class JavaPlatform extends Platform {
}
// The given symbol is a method with the right name and signature to be a runnable java program.
- def isJavaMainMethod(sym: SymDenotation)(implicit ctx: Context) = {
- val dn = defn
+ def isJavaMainMethod(sym: SymDenotation)(implicit ctx: Context) =
(sym.name == nme.main) && (sym.info match {
- case t@MethodType(_, dn.ArrayType(el) :: Nil) => el =:= defn.StringType && (t.resultType isRef defn.UnitClass)
+ case t@MethodType(_, defn.ArrayOf(el) :: Nil) => el =:= defn.StringType && (t.resultType isRef defn.UnitClass)
case _ => false
})
- }
// The given class has a main method.
def hasJavaMainMethod(sym: Symbol)(implicit ctx: Context): Boolean =
diff --git a/src/dotty/tools/dotc/core/Definitions.scala b/src/dotty/tools/dotc/core/Definitions.scala
index 66e5f062d..40b759018 100644
--- a/src/dotty/tools/dotc/core/Definitions.scala
+++ b/src/dotty/tools/dotc/core/Definitions.scala
@@ -140,7 +140,9 @@ class Definitions {
* }
*/
lazy val AnyClass: ClassSymbol = completeClass(newCompleteClassSymbol(ScalaPackageClass, tpnme.Any, Abstract, Nil))
+ def AnyType = AnyClass.typeRef
lazy val AnyValClass: ClassSymbol = completeClass(newCompleteClassSymbol(ScalaPackageClass, tpnme.AnyVal, Abstract, List(AnyClass.typeRef)))
+ def AnyValType = AnyValClass.typeRef
lazy val Any_== = newMethod(AnyClass, nme.EQ, methOfAny(BooleanType), Final)
lazy val Any_!= = newMethod(AnyClass, nme.NE, methOfAny(BooleanType), Final)
@@ -161,8 +163,10 @@ class Definitions {
cls.info = ClassInfo(cls.owner.thisType, cls, AnyClass.typeRef :: Nil, newScope)
completeClass(cls)
}
+ def ObjectType: Type = ObjectClass.typeRef
lazy val AnyRefAlias: TypeSymbol = newAliasType(tpnme.AnyRef, ObjectType)
+ def AnyRefType = AnyRefAlias.typeRef
lazy val Object_eq = newMethod(ObjectClass, nme.eq, methOfAnyRef(BooleanType), Final)
lazy val Object_ne = newMethod(ObjectClass, nme.ne, methOfAnyRef(BooleanType), Final)
@@ -182,7 +186,7 @@ class Definitions {
/** Dummy method needed by elimByName */
lazy val dummyApply = newPolyMethod(
OpsPackageClass, nme.dummyApply, 1,
- pt => MethodType(List(FunctionType(Nil, PolyParam(pt, 0))), PolyParam(pt, 0)))
+ pt => MethodType(List(FunctionOf(Nil, PolyParam(pt, 0))), PolyParam(pt, 0)))
/** Method representing a throw */
lazy val throwMethod = newMethod(OpsPackageClass, nme.THROWkw,
@@ -190,9 +194,10 @@ class Definitions {
lazy val NothingClass: ClassSymbol = newCompleteClassSymbol(
ScalaPackageClass, tpnme.Nothing, AbstractFinal, List(AnyClass.typeRef))
+ def NothingType = NothingClass.typeRef
lazy val NullClass: ClassSymbol = newCompleteClassSymbol(
ScalaPackageClass, tpnme.Null, AbstractFinal, List(ObjectClass.typeRef))
- lazy val NullTypeRef = NullClass.typeRef
+ def NullType = NullClass.typeRef
lazy val ScalaPredefModuleRef = ctx.requiredModuleRef("scala.Predef")
def ScalaPredefModule = ScalaPredefModuleRef.symbol
@@ -235,15 +240,16 @@ class Definitions {
ScalaPackageClass, tpnme.Singleton, PureInterfaceCreationFlags | Final,
List(AnyClass.typeRef), EmptyScope)
- lazy val SeqTypeRef = ctx.requiredClassRef("scala.collection.Seq")
- def SeqClass = SeqTypeRef.symbol.asClass
+ lazy val SeqType: TypeRef = ctx.requiredClassRef("scala.collection.Seq")
+ def SeqClass = SeqType.symbol.asClass
+
lazy val Seq_applyR = SeqClass.requiredMethodRef(nme.apply)
def Seq_apply = Seq_applyR.symbol
lazy val Seq_headR = SeqClass.requiredMethodRef(nme.head)
def Seq_head = Seq_headR.symbol
- lazy val ArrayTypeRef = ctx.requiredClassRef("scala.Array")
- def ArrayClass = ArrayTypeRef.symbol.asClass
+ lazy val ArrayType: TypeRef = ctx.requiredClassRef("scala.Array")
+ def ArrayClass = ArrayType.symbol.asClass
lazy val Array_applyR = ArrayClass.requiredMethodRef(nme.apply)
def Array_apply = Array_applyR.symbol
lazy val Array_updateR = ArrayClass.requiredMethodRef(nme.update)
@@ -255,10 +261,10 @@ class Definitions {
lazy val ArrayConstructorR = ArrayClass.requiredMethodRef(nme.CONSTRUCTOR)
def ArrayConstructor = ArrayConstructorR.symbol
- lazy val UnitTypeRef = valueTypeRef("scala.Unit", BoxedUnitTypeRef, java.lang.Void.TYPE, UnitEnc)
- def UnitClass = UnitTypeRef.symbol.asClass
- lazy val BooleanTypeRef = valueTypeRef("scala.Boolean", BoxedBooleanTypeRef, java.lang.Boolean.TYPE, BooleanEnc)
- def BooleanClass = BooleanTypeRef.symbol.asClass
+ lazy val UnitType: TypeRef = valueTypeRef("scala.Unit", BoxedUnitType, java.lang.Void.TYPE, UnitEnc)
+ def UnitClass = UnitType.symbol.asClass
+ lazy val BooleanType = valueTypeRef("scala.Boolean", BoxedBooleanType, java.lang.Boolean.TYPE, BooleanEnc)
+ def BooleanClass = BooleanType.symbol.asClass
lazy val Boolean_notR = BooleanClass.requiredMethodRef(nme.UNARY_!)
def Boolean_! = Boolean_notR.symbol
lazy val Boolean_andR = BooleanClass.requiredMethodRef(nme.ZAND) // ### harmonize required... calls
@@ -266,14 +272,14 @@ class Definitions {
lazy val Boolean_orR = BooleanClass.requiredMethodRef(nme.ZOR)
def Boolean_|| = Boolean_orR.symbol
- lazy val ByteTypeRef = valueTypeRef("scala.Byte", BoxedByteTypeRef, java.lang.Byte.TYPE, ByteEnc)
- def ByteClass = ByteTypeRef.symbol.asClass
- lazy val ShortTypeRef = valueTypeRef("scala.Short", BoxedShortTypeRef, java.lang.Short.TYPE, ShortEnc)
- def ShortClass = ShortTypeRef.symbol.asClass
- lazy val CharTypeRef = valueTypeRef("scala.Char", BoxedCharTypeRef, java.lang.Character.TYPE, CharEnc)
- def CharClass = CharTypeRef.symbol.asClass
- lazy val IntTypeRef = valueTypeRef("scala.Int", BoxedIntTypeRef, java.lang.Integer.TYPE, IntEnc)
- def IntClass = IntTypeRef.symbol.asClass
+ lazy val ByteType: TypeRef = valueTypeRef("scala.Byte", BoxedByteType, java.lang.Byte.TYPE, ByteEnc)
+ def ByteClass = ByteType.symbol.asClass
+ lazy val ShortType: TypeRef = valueTypeRef("scala.Short", BoxedShortType, java.lang.Short.TYPE, ShortEnc)
+ def ShortClass = ShortType.symbol.asClass
+ lazy val CharType: TypeRef = valueTypeRef("scala.Char", BoxedCharType, java.lang.Character.TYPE, CharEnc)
+ def CharClass = CharType.symbol.asClass
+ lazy val IntType: TypeRef = valueTypeRef("scala.Int", BoxedIntType, java.lang.Integer.TYPE, IntEnc)
+ def IntClass = IntType.symbol.asClass
lazy val Int_minusR = IntClass.requiredMethodRef(nme.MINUS, List(IntType))
def Int_- = Int_minusR.symbol
lazy val Int_plusR = IntClass.requiredMethodRef(nme.PLUS, List(IntType))
@@ -288,40 +294,40 @@ class Definitions {
def Int_>= = Int_geR.symbol
lazy val Int_leR = IntClass.requiredMethodRef(nme.LE, List(IntType))
def Int_<= = Int_leR.symbol
- lazy val LongTypeRef = valueTypeRef("scala.Long", BoxedLongTypeRef, java.lang.Long.TYPE, LongEnc)
- def LongClass = LongTypeRef.symbol.asClass
- lazy val Long_XOR_Long = LongTypeRef.member(nme.XOR).requiredSymbol(
+ lazy val LongType: TypeRef = valueTypeRef("scala.Long", BoxedLongType, java.lang.Long.TYPE, LongEnc)
+ def LongClass = LongType.symbol.asClass
+ lazy val Long_XOR_Long = LongType.member(nme.XOR).requiredSymbol(
x => (x is Method) && (x.info.firstParamTypes.head isRef defn.LongClass)
)
- lazy val Long_LSR_Int = LongTypeRef.member(nme.LSR).requiredSymbol(
+ lazy val Long_LSR_Int = LongType.member(nme.LSR).requiredSymbol(
x => (x is Method) && (x.info.firstParamTypes.head isRef defn.IntClass)
)
- lazy val FloatTypeRef = valueTypeRef("scala.Float", BoxedFloatTypeRef, java.lang.Float.TYPE, FloatEnc)
- def FloatClass = FloatTypeRef.symbol.asClass
- lazy val DoubleTypeRef = valueTypeRef("scala.Double", BoxedDoubleTypeRef, java.lang.Double.TYPE, DoubleEnc)
- def DoubleClass = DoubleTypeRef.symbol.asClass
+ lazy val FloatType: TypeRef = valueTypeRef("scala.Float", BoxedFloatType, java.lang.Float.TYPE, FloatEnc)
+ def FloatClass = FloatType.symbol.asClass
+ lazy val DoubleType: TypeRef = valueTypeRef("scala.Double", BoxedDoubleType, java.lang.Double.TYPE, DoubleEnc)
+ def DoubleClass = DoubleType.symbol.asClass
- lazy val BoxedUnitTypeRef = ctx.requiredClassRef("scala.runtime.BoxedUnit")
- def BoxedUnitClass = BoxedUnitTypeRef.symbol.asClass
+ lazy val BoxedUnitType: TypeRef = ctx.requiredClassRef("scala.runtime.BoxedUnit")
+ def BoxedUnitClass = BoxedUnitType.symbol.asClass
def BoxedUnit_UNIT = BoxedUnitClass.linkedClass.requiredValue("UNIT")
- lazy val BoxedBooleanTypeRef = ctx.requiredClassRef("java.lang.Boolean")
- def BoxedBooleanClass = BoxedBooleanTypeRef.symbol.asClass
- lazy val BoxedByteTypeRef = ctx.requiredClassRef("java.lang.Byte")
- def BoxedByteClass = BoxedByteTypeRef.symbol.asClass
- lazy val BoxedShortTypeRef = ctx.requiredClassRef("java.lang.Short")
- def BoxedShortClass = BoxedShortTypeRef.symbol.asClass
- lazy val BoxedCharTypeRef = ctx.requiredClassRef("java.lang.Character")
- def BoxedCharClass = BoxedCharTypeRef.symbol.asClass
- lazy val BoxedIntTypeRef = ctx.requiredClassRef("java.lang.Integer")
- def BoxedIntClass = BoxedIntTypeRef.symbol.asClass
- lazy val BoxedLongTypeRef = ctx.requiredClassRef("java.lang.Long")
- def BoxedLongClass = BoxedLongTypeRef.symbol.asClass
- lazy val BoxedFloatTypeRef = ctx.requiredClassRef("java.lang.Float")
- def BoxedFloatClass = BoxedFloatTypeRef.symbol.asClass
- lazy val BoxedDoubleTypeRef = ctx.requiredClassRef("java.lang.Double")
- def BoxedDoubleClass = BoxedDoubleTypeRef.symbol.asClass
+ lazy val BoxedBooleanType: TypeRef = ctx.requiredClassRef("java.lang.Boolean")
+ def BoxedBooleanClass = BoxedBooleanType.symbol.asClass
+ lazy val BoxedByteType: TypeRef = ctx.requiredClassRef("java.lang.Byte")
+ def BoxedByteClass = BoxedByteType.symbol.asClass
+ lazy val BoxedShortType: TypeRef = ctx.requiredClassRef("java.lang.Short")
+ def BoxedShortClass = BoxedShortType.symbol.asClass
+ lazy val BoxedCharType: TypeRef = ctx.requiredClassRef("java.lang.Character")
+ def BoxedCharClass = BoxedCharType.symbol.asClass
+ lazy val BoxedIntType: TypeRef = ctx.requiredClassRef("java.lang.Integer")
+ def BoxedIntClass = BoxedIntType.symbol.asClass
+ lazy val BoxedLongType: TypeRef = ctx.requiredClassRef("java.lang.Long")
+ def BoxedLongClass = BoxedLongType.symbol.asClass
+ lazy val BoxedFloatType: TypeRef = ctx.requiredClassRef("java.lang.Float")
+ def BoxedFloatClass = BoxedFloatType.symbol.asClass
+ lazy val BoxedDoubleType: TypeRef = ctx.requiredClassRef("java.lang.Double")
+ def BoxedDoubleClass = BoxedDoubleType.symbol.asClass
lazy val BoxedBooleanModule = ctx.requiredModule("java.lang.Boolean")
lazy val BoxedByteModule = ctx.requiredModule("java.lang.Byte")
@@ -340,6 +346,7 @@ class Definitions {
// fundamental classes
lazy val StringClass = ctx.requiredClass("java.lang.String")
+ def StringType: Type = StringClass.typeRef
lazy val StringModule = StringClass.linkedClass
lazy val String_+ = newMethod(StringClass, nme.raw.PLUS, methOfAny(StringType), Final)
@@ -359,33 +366,33 @@ class Definitions {
// in scalac modified to have Any as parent
- lazy val SerializableTypeRef = ctx.requiredClassRef("scala.Serializable")
- def SerializableClass = SerializableTypeRef.symbol.asClass
- lazy val StringBuilderTypeRef = ctx.requiredClassRef("scala.collection.mutable.StringBuilder")
- def StringBuilderClass = StringBuilderTypeRef.symbol.asClass
- lazy val MatchErrorTypeRef = ctx.requiredClassRef("scala.MatchError")
- def MatchErrorClass = MatchErrorTypeRef.symbol.asClass
+ lazy val SerializableType: TypeRef = ctx.requiredClassRef("scala.Serializable")
+ def SerializableClass = SerializableType.symbol.asClass
+ lazy val StringBuilderType: TypeRef = ctx.requiredClassRef("scala.collection.mutable.StringBuilder")
+ def StringBuilderClass = StringBuilderType.symbol.asClass
+ lazy val MatchErrorType: TypeRef = ctx.requiredClassRef("scala.MatchError")
+ def MatchErrorClass = MatchErrorType.symbol.asClass
- lazy val StringAddTypeRef = ctx.requiredClassRef("scala.runtime.StringAdd")
- def StringAddClass = StringAddTypeRef.symbol.asClass
+ lazy val StringAddType: TypeRef = ctx.requiredClassRef("scala.runtime.StringAdd")
+ def StringAddClass = StringAddType.symbol.asClass
lazy val StringAdd_plusR = StringAddClass.requiredMethodRef(nme.raw.PLUS)
def StringAdd_+ = StringAdd_plusR.symbol
- lazy val PairTypeRef = ctx.requiredClassRef("dotty.Pair")
- def PairClass = PairTypeRef.symbol.asClass
- lazy val PartialFunctionTypeRef = ctx.requiredClassRef("scala.PartialFunction")
- def PartialFunctionClass = PartialFunctionTypeRef.symbol.asClass
- lazy val AbstractPartialFunctionTypeRef = ctx.requiredClassRef("scala.runtime.AbstractPartialFunction")
- def AbstractPartialFunctionClass = AbstractPartialFunctionTypeRef.symbol.asClass
- lazy val SymbolTypeRef = ctx.requiredClassRef("scala.Symbol")
- def SymbolClass = SymbolTypeRef.symbol.asClass
- lazy val DynamicTypeRef = ctx.requiredClassRef("scala.Dynamic")
- def DynamicClass = DynamicTypeRef.symbol.asClass
- lazy val OptionTypeRef = ctx.requiredClassRef("scala.Option")
- def OptionClass = OptionTypeRef.symbol.asClass
- lazy val ProductTypeRef = ctx.requiredClassRef("scala.Product")
- def ProductClass = ProductTypeRef.symbol.asClass
+ lazy val PairType: TypeRef = ctx.requiredClassRef("dotty.Pair")
+ def PairClass = PairType.symbol.asClass
+ lazy val PartialFunctionType: TypeRef = ctx.requiredClassRef("scala.PartialFunction")
+ def PartialFunctionClass = PartialFunctionType.symbol.asClass
+ lazy val AbstractPartialFunctionType: TypeRef = ctx.requiredClassRef("scala.runtime.AbstractPartialFunction")
+ def AbstractPartialFunctionClass = AbstractPartialFunctionType.symbol.asClass
+ lazy val SymbolType: TypeRef = ctx.requiredClassRef("scala.Symbol")
+ def SymbolClass = SymbolType.symbol.asClass
+ lazy val DynamicType: TypeRef = ctx.requiredClassRef("scala.Dynamic")
+ def DynamicClass = DynamicType.symbol.asClass
+ lazy val OptionType: TypeRef = ctx.requiredClassRef("scala.Option")
+ def OptionClass = OptionType.symbol.asClass
+ lazy val ProductType: TypeRef = ctx.requiredClassRef("scala.Product")
+ def ProductClass = ProductType.symbol.asClass
lazy val Product_canEqualR = ProductClass.requiredMethodRef(nme.canEqual_)
def Product_canEqual = Product_canEqualR.symbol
lazy val Product_productArityR = ProductClass.requiredMethodRef(nme.productArity)
@@ -394,7 +401,7 @@ class Definitions {
def Product_productPrefix = Product_productPrefixR.symbol
lazy val LanguageModuleRef = ctx.requiredModule("dotty.language")
def LanguageModuleClass = LanguageModuleRef.symbol.moduleClass.asClass
- lazy val NonLocalReturnControlTypeRef = ctx.requiredClassRef("scala.runtime.NonLocalReturnControl")
+ lazy val NonLocalReturnControlType: TypeRef = ctx.requiredClassRef("scala.runtime.NonLocalReturnControl")
// Annotation base classes
lazy val AnnotationTypeRef = ctx.requiredClassRef("scala.annotation.Annotation")
@@ -466,28 +473,9 @@ class Definitions {
def methOfAnyRef(tp: Type) = MethodType(List(ObjectType), tp)
// Derived types
- def AnyType: Type = AnyClass.typeRef
- def AnyValType: Type = AnyValClass.typeRef
- def ObjectType: Type = ObjectClass.typeRef
- def AnyRefType: Type = AnyRefAlias.typeRef
- def NothingType: Type = NothingClass.typeRef
- def NullType: Type = NullClass.typeRef
- def SeqType: Type = SeqTypeRef
-
- def UnitType: Type = UnitTypeRef
- def BooleanType: Type = BooleanTypeRef
- def ByteType: Type = ByteTypeRef
- def ShortType: Type = ShortTypeRef
- def CharType: Type = CharTypeRef
- def IntType: Type = IntTypeRef
- def LongType: Type = LongTypeRef
- def FloatType: Type = FloatTypeRef
- def DoubleType: Type = DoubleTypeRef
- def PairType: Type = PairTypeRef
- def StringType: Type = StringClass.typeRef
+
def RepeatedParamType = RepeatedParamClass.typeRef
def ThrowableType = ThrowableClass.typeRef
- def OptionType = OptionTypeRef
def VolatileAnnotType = VolatileAnnotRef
def ClassType(arg: Type)(implicit ctx: Context) = {
@@ -503,9 +491,9 @@ class Definitions {
// - .linkedClass: the ClassSymbol of the enumeration (class E)
sym.owner.linkedClass.typeRef
- object FunctionType {
+ object FunctionOf {
def apply(args: List[Type], resultType: Type)(implicit ctx: Context) =
- FunctionTypeRef(args.length).appliedTo(args ::: resultType :: Nil)
+ FunctionType(args.length).appliedTo(args ::: resultType :: Nil)
def unapply(ft: Type)(implicit ctx: Context)/*: Option[(List[Type], Type)]*/ = {
// -language:keepUnions difference: unapply needs result type because inferred type
// is Some[(List[Type], Type)] | None, which is not a legal unapply type.
@@ -513,28 +501,28 @@ class Definitions {
lazy val targs = ft.argInfos
val numArgs = targs.length - 1
if (numArgs >= 0 && numArgs <= MaxFunctionArity &&
- (FunctionTypeRef(numArgs).symbol == tsym)) Some(targs.init, targs.last)
+ (FunctionType(numArgs).symbol == tsym)) Some(targs.init, targs.last)
else None
}
}
- object ArrayType {
+ object ArrayOf {
def apply(elem: Type)(implicit ctx: Context) =
if (ctx.erasedTypes) JavaArrayType(elem)
- else ArrayTypeRef.appliedTo(elem :: Nil)
+ else ArrayType.appliedTo(elem :: Nil)
def unapply(tp: Type)(implicit ctx: Context): Option[Type] = tp.dealias match {
- case at: RefinedType if (at isRef ArrayTypeRef.symbol) && at.argInfos.length == 1 => Some(at.argInfos.head)
+ case at: RefinedType if (at isRef ArrayType.symbol) && at.argInfos.length == 1 => Some(at.argInfos.head)
case _ => None
}
}
- object MultiArrayType {
+ object MultiArrayOf {
def apply(elem: Type, ndims: Int)(implicit ctx: Context): Type =
- if (ndims == 0) elem else ArrayType(apply(elem, ndims - 1))
+ if (ndims == 0) elem else ArrayOf(apply(elem, ndims - 1))
def unapply(tp: Type)(implicit ctx: Context): Option[(Type, Int)] = tp match {
- case ArrayType(elemtp) =>
+ case ArrayOf(elemtp) =>
elemtp match {
- case MultiArrayType(finalElemTp, n) => Some(finalElemTp, n + 1)
+ case MultiArrayOf(finalElemTp, n) => Some(finalElemTp, n + 1)
case _ => Some(elemtp, 1)
}
case _ =>
@@ -544,19 +532,19 @@ class Definitions {
// ----- Symbol sets ---------------------------------------------------
- lazy val AbstractFunctionTypeRef = mkArityArray("scala.runtime.AbstractFunction", MaxFunctionArity, 0)
- def AbstractFunctionClass = AbstractFunctionTypeRef.map(_.symbol.asClass)
- lazy val FunctionTypeRef = mkArityArray("scala.Function", MaxFunctionArity, 0)
- def FunctionClass = FunctionTypeRef.map(_.symbol.asClass)
- lazy val Function0_applyR = FunctionTypeRef(0).symbol.requiredMethodRef(nme.apply)
+ lazy val AbstractFunctionType = mkArityArray("scala.runtime.AbstractFunction", MaxFunctionArity, 0)
+ def AbstractFunctionClass = AbstractFunctionType.map(_.symbol.asClass)
+ lazy val FunctionType = mkArityArray("scala.Function", MaxFunctionArity, 0)
+ def FunctionClass = FunctionType.map(_.symbol.asClass)
+ lazy val Function0_applyR = FunctionType(0).symbol.requiredMethodRef(nme.apply)
def Function0_apply = Function0_applyR.symbol
- lazy val TupleTypeRef = mkArityArray("scala.Tuple", MaxTupleArity, 2)
- lazy val ProductNTypeRef = mkArityArray("scala.Product", MaxTupleArity, 0)
+ lazy val TupleType = mkArityArray("scala.Tuple", MaxTupleArity, 2)
+ lazy val ProductNType = mkArityArray("scala.Product", MaxTupleArity, 0)
- private lazy val FunctionTypeRefs: Set[TypeRef] = FunctionTypeRef.toSet
- private lazy val TupleTypeRefs: Set[TypeRef] = TupleTypeRef.toSet
- private lazy val ProductTypeRefs: Set[TypeRef] = ProductNTypeRef.toSet
+ private lazy val FunctionTypes: Set[TypeRef] = FunctionType.toSet
+ private lazy val TupleTypes: Set[TypeRef] = TupleType.toSet
+ private lazy val ProductTypes: Set[TypeRef] = ProductNType.toSet
/** If `cls` is a class in the scala package, its name, otherwise EmptyTypeName */
def scalaClassName(cls: Symbol)(implicit ctx: Context): TypeName =
@@ -594,19 +582,19 @@ class Definitions {
def isTupleType(tp: Type)(implicit ctx: Context) = {
val arity = tp.dealias.argInfos.length
- arity <= MaxTupleArity && TupleTypeRef(arity) != null && (tp isRef TupleTypeRef(arity).symbol)
+ arity <= MaxTupleArity && TupleType(arity) != null && (tp isRef TupleType(arity).symbol)
}
def tupleType(elems: List[Type]) = {
- TupleTypeRef(elems.size).appliedTo(elems)
+ TupleType(elems.size).appliedTo(elems)
}
def isProductSubType(tp: Type)(implicit ctx: Context) =
- (tp derivesFrom ProductTypeRef.symbol) && tp.baseClasses.exists(isProductClass)
+ (tp derivesFrom ProductType.symbol) && tp.baseClasses.exists(isProductClass)
def isFunctionType(tp: Type)(implicit ctx: Context) = {
val arity = functionArity(tp)
- 0 <= arity && arity <= MaxFunctionArity && (tp isRef FunctionTypeRef(arity).symbol)
+ 0 <= arity && arity <= MaxFunctionArity && (tp isRef FunctionType(arity).symbol)
}
def functionArity(tp: Type)(implicit ctx: Context) = tp.dealias.argInfos.length - 1
@@ -691,23 +679,17 @@ class Definitions {
}
lazy val ScalaNumericValueTypeList = List(
- ByteTypeRef,
- ShortTypeRef,
- CharTypeRef,
- IntTypeRef,
- LongTypeRef,
- FloatTypeRef,
- DoubleTypeRef)
+ ByteType, ShortType, CharType, IntType, LongType, FloatType, DoubleType)
private lazy val ScalaNumericValueTypes: collection.Set[TypeRef] = ScalaNumericValueTypeList.toSet
- private lazy val ScalaValueTypes: collection.Set[TypeRef] = ScalaNumericValueTypes + UnitTypeRef + BooleanTypeRef
- private lazy val ScalaBoxedTypeRefs = ScalaValueTypes map (t => boxedTypeRef(t.name))
+ private lazy val ScalaValueTypes: collection.Set[TypeRef] = ScalaNumericValueTypes + UnitType + BooleanType
+ private lazy val ScalaBoxedTypes = ScalaValueTypes map (t => boxedType(t.name))
val ScalaNumericValueClasses = new SymbolsPerRun(implicit ctx => ScalaNumericValueTypes.map(_.symbol))
val ScalaValueClasses = new SymbolsPerRun(implicit ctx => ScalaValueTypes.map(_.symbol))
- val ScalaBoxedClasses = new SymbolsPerRun(implicit ctx => ScalaBoxedTypeRefs.map(_.symbol))
+ val ScalaBoxedClasses = new SymbolsPerRun(implicit ctx => ScalaBoxedTypes.map(_.symbol))
- private val boxedTypeRef = mutable.Map[TypeName, TypeRef]()
+ private val boxedType = mutable.Map[TypeName, TypeRef]()
private val valueTypeEnc = mutable.Map[TypeName, PrimitiveClassEnc]()
// private val unboxedTypeRef = mutable.Map[TypeName, TypeRef]()
@@ -716,7 +698,7 @@ class Definitions {
private def valueTypeRef(name: String, boxed: TypeRef, jtype: Class[_], enc: Int): TypeRef = {
val vcls = ctx.requiredClassRef(name)
- boxedTypeRef(vcls.name) = boxed
+ boxedType(vcls.name) = boxed
valueTypeEnc(vcls.name) = enc
// unboxedTypeRef(boxed.name) = vcls
// javaTypeToValueTypeRef(jtype) = vcls
@@ -725,7 +707,7 @@ class Definitions {
}
/** The type of the boxed class corresponding to primitive value type `tp`. */
- def boxedType(tp: Type)(implicit ctx: Context): TypeRef = boxedTypeRef.apply(scalaClassName(tp))
+ def boxedType(tp: Type)(implicit ctx: Context): TypeRef = boxedType(scalaClassName(tp))
def wrapArrayMethodName(elemtp: Type): TermName = {
val cls = elemtp.classSymbol
diff --git a/src/dotty/tools/dotc/core/TypeApplications.scala b/src/dotty/tools/dotc/core/TypeApplications.scala
index 7274c1f70..2631e9964 100644
--- a/src/dotty/tools/dotc/core/TypeApplications.scala
+++ b/src/dotty/tools/dotc/core/TypeApplications.scala
@@ -444,7 +444,7 @@ class TypeApplications(val self: Type) extends AnyVal {
/** The element type of a sequence or array */
def elemType(implicit ctx: Context): Type = self match {
- case defn.ArrayType(elemtp) => elemtp
+ case defn.ArrayOf(elemtp) => elemtp
case JavaArrayType(elemtp) => elemtp
case _ => firstBaseArgInfo(defn.SeqClass)
}
diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala
index 684e9cbfd..2045de3ce 100644
--- a/src/dotty/tools/dotc/core/TypeComparer.scala
+++ b/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -808,7 +808,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
/** The greatest lower bound of a list types */
final def glb(tps: List[Type]): Type =
- (defn.AnyType /: tps)(glb)
+ ((defn.AnyType: Type) /: tps)(glb)
/** The least upper bound of two types
* @note We do not admit singleton types in or-types as lubs.
@@ -837,7 +837,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
/** The least upper bound of a list of types */
final def lub(tps: List[Type]): Type =
- (defn.NothingType /: tps)(lub)
+ ((defn.NothingType: Type) /: tps)(lub)
/** Merge `t1` into `tp2` if t1 is a subtype of some &-summand of tp2.
*/
diff --git a/src/dotty/tools/dotc/core/TypeErasure.scala b/src/dotty/tools/dotc/core/TypeErasure.scala
index 35c24ff5a..b76dd869a 100644
--- a/src/dotty/tools/dotc/core/TypeErasure.scala
+++ b/src/dotty/tools/dotc/core/TypeErasure.scala
@@ -375,7 +375,7 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
}
private def eraseArray(tp: RefinedType)(implicit ctx: Context) = {
- val defn.ArrayType(elemtp) = tp
+ val defn.ArrayOf(elemtp) = tp
def arrayErasure(tpToErase: Type) =
erasureFn(isJava, semiEraseVCs = false, isConstructor, wildcardOK)(tpToErase)
if (elemtp derivesFrom defn.NullClass) JavaArrayType(defn.ObjectType)
@@ -456,14 +456,14 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
if (erasedVCRef.exists) return sigName(erasedVCRef)
}
normalizeClass(sym.asClass).fullName.asTypeName
- case defn.ArrayType(elem) =>
+ case defn.ArrayOf(elem) =>
sigName(this(tp))
case JavaArrayType(elem) =>
sigName(elem) ++ "[]"
case tp: TermRef =>
sigName(tp.widen)
case ExprType(rt) =>
- sigName(defn.FunctionType(Nil, rt))
+ sigName(defn.FunctionOf(Nil, rt))
case tp: TypeProxy =>
sigName(tp.underlying)
case ErrorType | WildcardType =>
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index a9956c433..3bc76a20d 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -1101,7 +1101,7 @@ object Types {
def toFunctionType(dropLast: Int = 0)(implicit ctx: Context): Type = this match {
case mt @ MethodType(_, formals) if !mt.isDependent || ctx.mode.is(Mode.AllowDependentFunctions) =>
val formals1 = if (dropLast == 0) formals else formals dropRight dropLast
- defn.FunctionType(
+ defn.FunctionOf(
formals1 mapConserve (_.underlyingIfRepeated(mt.isJava)), mt.resultType)
}
diff --git a/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala b/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala
index b948efebb..ca805f516 100644
--- a/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala
+++ b/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala
@@ -324,7 +324,7 @@ class ClassfileParser(
if (elemtp.typeSymbol.isAbstractType && !(elemtp.derivesFrom(defn.ObjectClass))) {
elemtp = AndType(elemtp, defn.ObjectType)
}
- defn.ArrayType(elemtp)
+ defn.ArrayOf(elemtp)
case '(' =>
// we need a method symbol. given in line 486 by calling getType(methodSym, ..)
val paramtypes = new ListBuffer[Type]()
@@ -614,7 +614,7 @@ class ClassfileParser(
addConstr(paramTypes)
if (paramTypes.nonEmpty)
paramTypes.last match {
- case defn.ArrayType(elemtp) =>
+ case defn.ArrayOf(elemtp) =>
addConstr(paramTypes.init :+ defn.RepeatedParamType.appliedTo(elemtp))
case _ =>
}
diff --git a/src/dotty/tools/dotc/transform/ClassTags.scala b/src/dotty/tools/dotc/transform/ClassTags.scala
index 2ad348b05..a7c4779c3 100644
--- a/src/dotty/tools/dotc/transform/ClassTags.scala
+++ b/src/dotty/tools/dotc/transform/ClassTags.scala
@@ -44,7 +44,7 @@ class ClassTags extends MiniPhaseTransform with IdentityDenotTransformer { thisT
val tp = tree.args.head.tpe
val defn = ctx.definitions
val (elemType, ndims) = tp match {
- case defn.MultiArrayType(elem, ndims) => (elem, ndims)
+ case defn.MultiArrayOf(elem, ndims) => (elem, ndims)
case _ => (tp, 0)
}
diff --git a/src/dotty/tools/dotc/transform/ElimByName.scala b/src/dotty/tools/dotc/transform/ElimByName.scala
index 2d0ecaf99..b65a46249 100644
--- a/src/dotty/tools/dotc/transform/ElimByName.scala
+++ b/src/dotty/tools/dotc/transform/ElimByName.scala
@@ -120,7 +120,7 @@ class ElimByName extends MiniPhaseTransform with InfoTransformer { thisTransform
else tree
def transformInfo(tp: Type, sym: Symbol)(implicit ctx: Context): Type = tp match {
- case ExprType(rt) if exprBecomesFunction(sym) => defn.FunctionType(Nil, rt)
+ case ExprType(rt) if exprBecomesFunction(sym) => defn.FunctionOf(Nil, rt)
case _ => tp
}
diff --git a/src/dotty/tools/dotc/transform/ElimRepeated.scala b/src/dotty/tools/dotc/transform/ElimRepeated.scala
index 9563a7ed0..98abbb26d 100644
--- a/src/dotty/tools/dotc/transform/ElimRepeated.scala
+++ b/src/dotty/tools/dotc/transform/ElimRepeated.scala
@@ -81,7 +81,7 @@ class ElimRepeated extends MiniPhaseTransform with InfoTransformer with Annotati
.select(nme.seqToArray)
.appliedToType(elemType)
.appliedTo(tree, Literal(Constant(elemClass.typeRef)))
- .ensureConforms(defn.ArrayType(elemType))
+ .ensureConforms(defn.ArrayOf(elemType))
// Because of phantomclasses, the Java array's type might not conform to the return type
}
diff --git a/src/dotty/tools/dotc/transform/NonLocalReturns.scala b/src/dotty/tools/dotc/transform/NonLocalReturns.scala
index a58a0fbda..7680e283e 100644
--- a/src/dotty/tools/dotc/transform/NonLocalReturns.scala
+++ b/src/dotty/tools/dotc/transform/NonLocalReturns.scala
@@ -29,7 +29,7 @@ class NonLocalReturns extends MiniPhaseTransform { thisTransformer =>
/** The type of a non-local return expression with given argument type */
private def nonLocalReturnExceptionType(argtype: Type)(implicit ctx: Context) =
- defn.NonLocalReturnControlTypeRef.appliedTo(argtype)
+ defn.NonLocalReturnControlType.appliedTo(argtype)
/** A hashmap from method symbols to non-local return keys */
private val nonLocalReturnKeys = mutable.Map[Symbol, TermSymbol]()
@@ -50,7 +50,7 @@ class NonLocalReturns extends MiniPhaseTransform { thisTransformer =>
private def nonLocalReturnThrow(expr: Tree, meth: Symbol)(implicit ctx: Context) =
Throw(
New(
- defn.NonLocalReturnControlTypeRef,
+ defn.NonLocalReturnControlType,
ref(nonLocalReturnKey(meth)) :: expr.ensureConforms(defn.ObjectType) :: Nil))
/** Transform (body, key) to:
@@ -68,7 +68,7 @@ class NonLocalReturns extends MiniPhaseTransform { thisTransformer =>
*/
private def nonLocalReturnTry(body: Tree, key: TermSymbol, meth: Symbol)(implicit ctx: Context) = {
val keyDef = ValDef(key, New(defn.ObjectType, Nil))
- val nonLocalReturnControl = defn.NonLocalReturnControlTypeRef
+ val nonLocalReturnControl = defn.NonLocalReturnControlType
val ex = ctx.newSymbol(meth, nme.ex, EmptyFlags, nonLocalReturnControl, coord = body.pos)
val pat = BindTyped(ex, nonLocalReturnControl)
val rhs = If(
diff --git a/src/dotty/tools/dotc/transform/PatternMatcher.scala b/src/dotty/tools/dotc/transform/PatternMatcher.scala
index 4b45f7cc2..5b4d42683 100644
--- a/src/dotty/tools/dotc/transform/PatternMatcher.scala
+++ b/src/dotty/tools/dotc/transform/PatternMatcher.scala
@@ -201,7 +201,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
// catchAll.isEmpty iff no synthetic default case needed (the (last) user-defined case is a default)
// if the last user-defined case is a default, it will never jump to the next case; it will go immediately to matchEnd
val catchAllDef = matchFailGen.map { _(scrutSym)}
- .getOrElse(Throw(New(defn.MatchErrorTypeRef, List(ref(scrutSym)))))
+ .getOrElse(Throw(New(defn.MatchErrorType, List(ref(scrutSym)))))
val matchFail = newSynthCaseLabel(ctx.freshName("matchFail"), MethodType(Nil, restpe))
val catchAllDefBody = DefDef(matchFail, catchAllDef)
@@ -878,7 +878,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
// unlike in scalac SubstOnlyTreeMakers are maintained.
val casesRebindingPropagated = casesRaw map (propagateRebindings(_, NoRebindings))
- def matchFailGen = matchFailGenOverride orElse Some((arg: Symbol) => Throw(New(defn.MatchErrorTypeRef, List(ref(arg)))))
+ def matchFailGen = matchFailGenOverride orElse Some((arg: Symbol) => Throw(New(defn.MatchErrorType, List(ref(arg)))))
ctx.debuglog("combining cases: " + (casesRebindingPropagated.map(_.mkString(" >> ")).mkString("{", "\n", "}")))
diff --git a/src/dotty/tools/dotc/transform/TypeTestsCasts.scala b/src/dotty/tools/dotc/transform/TypeTestsCasts.scala
index 035cbb51b..c57d6fd1a 100644
--- a/src/dotty/tools/dotc/transform/TypeTestsCasts.scala
+++ b/src/dotty/tools/dotc/transform/TypeTestsCasts.scala
@@ -68,7 +68,7 @@ trait TypeTestsCasts {
}
}
}
- case defn.MultiArrayType(elem, ndims) if isUnboundedGeneric(elem) =>
+ case defn.MultiArrayOf(elem, ndims) if isUnboundedGeneric(elem) =>
def isArrayTest(arg: Tree) =
ref(defn.runtimeMethodRef(nme.isArray)).appliedTo(arg, Literal(Constant(ndims)))
if (ndims == 1) isArrayTest(qual)
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala
index 2e945683b..64047cc1e 100644
--- a/src/dotty/tools/dotc/typer/Applications.scala
+++ b/src/dotty/tools/dotc/typer/Applications.scala
@@ -949,7 +949,7 @@ trait Applications extends Compatibility { self: Typer =>
/** The shape of given tree as a type; cannot handle named arguments. */
def typeShape(tree: untpd.Tree): Type = tree match {
case untpd.Function(args, body) =>
- defn.FunctionType(args map Function.const(defn.AnyType), typeShape(body))
+ defn.FunctionOf(args map Function.const(defn.AnyType), typeShape(body))
case _ =>
defn.NothingType
}
@@ -1068,7 +1068,7 @@ trait Applications extends Compatibility { self: Typer =>
val alts1 = alts filter pt.isMatchedBy
resolveOverloaded(alts1, pt1, targs)
- case defn.FunctionType(args, resultType) =>
+ case defn.FunctionOf(args, resultType) =>
narrowByTypes(alts, args, resultType)
case pt =>
diff --git a/src/dotty/tools/dotc/typer/ProtoTypes.scala b/src/dotty/tools/dotc/typer/ProtoTypes.scala
index 2b19d9db3..db196f0c2 100644
--- a/src/dotty/tools/dotc/typer/ProtoTypes.scala
+++ b/src/dotty/tools/dotc/typer/ProtoTypes.scala
@@ -370,7 +370,7 @@ object ProtoTypes {
if (pt.isInstanceOf[ApplyingProto])
mt.derivedMethodType(mt.paramNames, mt.paramTypes, rt)
else {
- val ft = defn.FunctionType(mt.paramTypes, rt)
+ val ft = defn.FunctionOf(mt.paramTypes, rt)
if (mt.paramTypes.nonEmpty || ft <:< pt) ft else rt
}
}
diff --git a/src/dotty/tools/dotc/typer/TypeAssigner.scala b/src/dotty/tools/dotc/typer/TypeAssigner.scala
index 25030012c..af5fdd428 100644
--- a/src/dotty/tools/dotc/typer/TypeAssigner.scala
+++ b/src/dotty/tools/dotc/typer/TypeAssigner.scala
@@ -350,7 +350,7 @@ trait TypeAssigner {
def assignType(tree: untpd.SeqLiteral, elems: List[Tree])(implicit ctx: Context) = tree match {
case tree: JavaSeqLiteral =>
- tree.withType(defn.ArrayType(ctx.typeComparer.lub(elems.tpes).widen))
+ tree.withType(defn.ArrayOf(ctx.typeComparer.lub(elems.tpes).widen))
case _ =>
val ownType =
if (ctx.erasedTypes) defn.SeqType