aboutsummaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-03-16 17:07:10 +0100
committerMartin Odersky <odersky@gmail.com>2017-04-06 13:15:28 +0200
commit31ab8804d611343eb3cf35e2c1b929d5b65a946e (patch)
tree886cce4d249fdcca4de5d9b5e10c627d23c346b4 /compiler
parentc024a6037f3dd7e7458d936566cd4b653b8b7545 (diff)
downloaddotty-31ab8804d611343eb3cf35e2c1b929d5b65a946e.tar.gz
dotty-31ab8804d611343eb3cf35e2c1b929d5b65a946e.tar.bz2
dotty-31ab8804d611343eb3cf35e2c1b929d5b65a946e.zip
Harmonize paramTypes and paramBounds
MethodTypes have paramTypes whereas PolyTypes have paramBounds. We now harmonize by alling both paramInfos, and parameterizing types that will become common to both.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/src/dotty/tools/backend/jvm/scalaPrimitives.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/ast/tpd.scala10
-rw-r--r--compiler/src/dotty/tools/dotc/core/Constants.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala4
-rw-r--r--compiler/src/dotty/tools/dotc/core/Definitions.scala4
-rw-r--r--compiler/src/dotty/tools/dotc/core/Denotations.scala14
-rw-r--r--compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/core/ParamInfo.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/core/SymDenotations.scala4
-rw-r--r--compiler/src/dotty/tools/dotc/core/TypeApplications.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/core/TypeComparer.scala12
-rw-r--r--compiler/src/dotty/tools/dotc/core/TypeErasure.scala8
-rw-r--r--compiler/src/dotty/tools/dotc/core/Types.scala203
-rw-r--r--compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala4
-rw-r--r--compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala6
-rw-r--r--compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala6
-rw-r--r--compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala4
-rw-r--r--compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/transform/CollectEntryPoints.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/transform/ElimByName.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/transform/ElimErasedValueType.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala6
-rw-r--r--compiler/src/dotty/tools/dotc/transform/Erasure.scala12
-rw-r--r--compiler/src/dotty/tools/dotc/transform/FullParameterization.scala4
-rw-r--r--compiler/src/dotty/tools/dotc/transform/FunctionalInterfaces.scala6
-rw-r--r--compiler/src/dotty/tools/dotc/transform/MixinOps.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/transform/SuperAccessors.scala4
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Applications.scala20
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Checking.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Dynamic.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala8
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Implicits.scala8
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Inferencing.scala4
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Inliner.scala4
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Namer.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala14
-rw-r--r--compiler/src/dotty/tools/dotc/typer/ReTyper.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala6
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Typer.scala16
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Variances.scala4
43 files changed, 216 insertions, 213 deletions
diff --git a/compiler/src/dotty/tools/backend/jvm/scalaPrimitives.scala b/compiler/src/dotty/tools/backend/jvm/scalaPrimitives.scala
index 89831e56b..7beae90c4 100644
--- a/compiler/src/dotty/tools/backend/jvm/scalaPrimitives.scala
+++ b/compiler/src/dotty/tools/backend/jvm/scalaPrimitives.scala
@@ -142,7 +142,7 @@ class DottyPrimitives(ctx: Context) {
ctx.error(s"Unknown primitive method $cls.$method")
else alts foreach (s =>
addPrimitive(s,
- s.info.paramTypess match {
+ s.info.paramInfoss match {
case List(tp :: _) if code == ADD && tp =:= ctx.definitions.StringType => CONCAT
case _ => code
}
diff --git a/compiler/src/dotty/tools/dotc/ast/tpd.scala b/compiler/src/dotty/tools/dotc/ast/tpd.scala
index cbb256dd0..8e76d981d 100644
--- a/compiler/src/dotty/tools/dotc/ast/tpd.scala
+++ b/compiler/src/dotty/tools/dotc/ast/tpd.scala
@@ -190,7 +190,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
val maybeImplicit = if (tp.isInstanceOf[ImplicitMethodType]) Implicit else EmptyFlags
ctx.newSymbol(sym, name, TermParam | maybeImplicit, info)
}
- val params = (tp.paramNames, tp.paramTypes).zipped.map(valueParam)
+ val params = (tp.paramNames, tp.paramInfos).zipped.map(valueParam)
val (paramss, rtp) = valueParamss(tp.instantiate(params map (_.termRef)))
(params :: paramss, rtp)
case tp => (Nil, tp.widenExpr)
@@ -221,7 +221,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
case ctpe: PolyType =>
isApplicable(ctpe.instantiate(firstParent.argTypes))
case ctpe: MethodType =>
- (superArgs corresponds ctpe.paramTypes)(_.tpe <:< _)
+ (superArgs corresponds ctpe.paramInfos)(_.tpe <:< _)
case _ =>
false
}
@@ -836,7 +836,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
val selected =
if (denot.isOverloaded) {
def typeParamCount(tp: Type) = tp.widen match {
- case tp: PolyType => tp.paramBounds.length
+ case tp: PolyType => tp.paramInfos.length
case _ => 0
}
var allAlts = denot.alternatives
@@ -859,7 +859,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
def adaptLastArg(lastParam: Tree, expectedType: Type) = {
if (isAnnotConstructor && !(lastParam.tpe <:< expectedType)) {
val defn = ctx.definitions
- val prefix = args.take(selected.widen.paramTypess.head.size - 1)
+ val prefix = args.take(selected.widen.paramInfoss.head.size - 1)
expectedType match {
case defn.ArrayOf(el) =>
lastParam.tpe match {
@@ -878,7 +878,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
}
val callArgs: List[Tree] = if (args.isEmpty) Nil else {
- val expectedType = selected.widen.paramTypess.head.last
+ val expectedType = selected.widen.paramInfoss.head.last
val lastParam = args.last
adaptLastArg(lastParam, expectedType)
}
diff --git a/compiler/src/dotty/tools/dotc/core/Constants.scala b/compiler/src/dotty/tools/dotc/core/Constants.scala
index 1892e4bdc..e8b27c0ba 100644
--- a/compiler/src/dotty/tools/dotc/core/Constants.scala
+++ b/compiler/src/dotty/tools/dotc/core/Constants.scala
@@ -174,7 +174,7 @@ object Constants {
case TypeBounds(lo, hi) =>
if (hi.classSymbol.isPrimitiveValueClass) hi //constrain further with high bound
else classBound(lo)
- case NoType => classBound(param.binder.paramBounds(param.paramNum).lo)
+ case NoType => classBound(param.binder.paramInfos(param.paramNum).lo)
case inst => classBound(inst)
}
case pt => pt
diff --git a/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala b/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala
index a12936c58..34662cbff 100644
--- a/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala
+++ b/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala
@@ -303,7 +303,7 @@ trait ConstraintHandling {
/** The current bounds of type parameter `param` */
final def bounds(param: PolyParam): TypeBounds = {
val e = constraint.entry(param)
- if (e.exists) e.bounds else param.binder.paramBounds(param.paramNum)
+ if (e.exists) e.bounds else param.binder.paramInfos(param.paramNum)
}
/** Add polytype `pt`, possibly with type variables `tvars`, to current constraint
@@ -362,7 +362,7 @@ trait ConstraintHandling {
def apply(t: Type): Type = t match {
case t @ PolyParam(pt: PolyType, n) if comparedPolyTypes contains pt =>
val effectiveVariance = if (fromBelow) -variance else variance
- val bounds = pt.paramBounds(n)
+ val bounds = pt.paramInfos(n)
if (effectiveVariance > 0) bounds.lo
else if (effectiveVariance < 0) bounds.hi
else NoType
diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala
index c48016b67..0c1d6521d 100644
--- a/compiler/src/dotty/tools/dotc/core/Definitions.scala
+++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala
@@ -151,8 +151,8 @@ class Definitions {
private def enterPolyMethod(cls: ClassSymbol, name: TermName, typeParamCount: Int,
resultTypeFn: PolyType => Type, flags: FlagSet = EmptyFlags) = {
val tparamNames = tpnme.syntheticTypeParamNames(typeParamCount)
- val tparamBounds = tparamNames map (_ => TypeBounds.empty)
- val ptype = PolyType(tparamNames)(_ => tparamBounds, resultTypeFn)
+ val tparamInfos = tparamNames map (_ => TypeBounds.empty)
+ val ptype = PolyType(tparamNames)(_ => tparamInfos, resultTypeFn)
enterMethod(cls, name, ptype, flags)
}
diff --git a/compiler/src/dotty/tools/dotc/core/Denotations.scala b/compiler/src/dotty/tools/dotc/core/Denotations.scala
index f726cd0d1..1d7b3c94c 100644
--- a/compiler/src/dotty/tools/dotc/core/Denotations.scala
+++ b/compiler/src/dotty/tools/dotc/core/Denotations.scala
@@ -213,7 +213,7 @@ object Denotations {
def requiredMethod(name: PreName, argTypes: List[Type])(implicit ctx: Context): TermSymbol =
info.member(name.toTermName).requiredSymbol(x=>
- (x is Method) && x.info.paramTypess == List(argTypes)
+ (x is Method) && x.info.paramInfoss == List(argTypes)
).asTerm
def requiredMethodRef(name: PreName, argTypes: List[Type])(implicit ctx: Context): TermRef =
requiredMethod(name, argTypes).termRef
@@ -310,11 +310,11 @@ object Denotations {
}
case tp1: MethodType if isTerm =>
tp2 match {
- case tp2: MethodType if ctx.typeComparer.matchingParams(tp1.paramTypes, tp2.paramTypes, tp1.isJava, tp2.isJava) &&
+ case tp2: MethodType if ctx.typeComparer.matchingParams(tp1.paramInfos, tp2.paramInfos, tp1.isJava, tp2.isJava) &&
tp1.isImplicit == tp2.isImplicit =>
tp1.derivedMethodType(
mergeNames(tp1.paramNames, tp2.paramNames, nme.syntheticParamName),
- tp1.paramTypes,
+ tp1.paramInfos,
infoMeet(tp1.resultType, tp2.resultType.subst(tp2, tp1)))
case _ =>
mergeConflict(tp1, tp2)
@@ -324,7 +324,7 @@ object Denotations {
case tp2: PolyType if ctx.typeComparer.matchingTypeParams(tp1, tp2) =>
tp1.derivedPolyType(
mergeNames(tp1.paramNames, tp2.paramNames, tpnme.syntheticTypeParamName),
- tp1.paramBounds,
+ tp1.paramInfos,
infoMeet(tp1.resultType, tp2.resultType.subst(tp2, tp1)))
case _: MethodicType =>
mergeConflict(tp1, tp2)
@@ -474,11 +474,11 @@ object Denotations {
case tp1: MethodType =>
tp2 match {
case tp2: MethodType
- if ctx.typeComparer.matchingParams(tp1.paramTypes, tp2.paramTypes, tp1.isJava, tp2.isJava) &&
+ if ctx.typeComparer.matchingParams(tp1.paramInfos, tp2.paramInfos, tp1.isJava, tp2.isJava) &&
tp1.isImplicit == tp2.isImplicit =>
tp1.derivedMethodType(
mergeNames(tp1.paramNames, tp2.paramNames, nme.syntheticParamName),
- tp1.paramTypes, tp1.resultType | tp2.resultType.subst(tp2, tp1))
+ tp1.paramInfos, tp1.resultType | tp2.resultType.subst(tp2, tp1))
case _ =>
mergeConflict(tp1, tp2)
}
@@ -487,7 +487,7 @@ object Denotations {
case tp2: PolyType if ctx.typeComparer.matchingTypeParams(tp1, tp2) =>
tp1.derivedPolyType(
mergeNames(tp1.paramNames, tp2.paramNames, tpnme.syntheticTypeParamName),
- tp1.paramBounds, tp1.resultType | tp2.resultType.subst(tp2, tp1))
+ tp1.paramInfos, tp1.resultType | tp2.resultType.subst(tp2, tp1))
case _ =>
mergeConflict(tp1, tp2)
}
diff --git a/compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala b/compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala
index 61dd5a445..3387f20e3 100644
--- a/compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala
+++ b/compiler/src/dotty/tools/dotc/core/OrderingConstraint.scala
@@ -284,7 +284,7 @@ class OrderingConstraint(private val boundsMap: ParamBounds,
assert(!contains(poly))
val nparams = poly.paramNames.length
val entries1 = new Array[Type](nparams * 2)
- poly.paramBounds.copyToArray(entries1, 0)
+ poly.paramInfos.copyToArray(entries1, 0)
tvars.copyToArray(entries1, nparams)
newConstraint(boundsMap.updated(poly, entries1), lowerMap, upperMap).init(poly)
}
diff --git a/compiler/src/dotty/tools/dotc/core/ParamInfo.scala b/compiler/src/dotty/tools/dotc/core/ParamInfo.scala
index efae24916..f824c3e9c 100644
--- a/compiler/src/dotty/tools/dotc/core/ParamInfo.scala
+++ b/compiler/src/dotty/tools/dotc/core/ParamInfo.scala
@@ -22,7 +22,7 @@ trait ParamInfo {
/** The info of the type parameter as seen from a prefix type.
* For type parameter symbols, this is the `memberInfo` as seen from `prefix`.
- * For type lambda parameters, it's the same as `paramBounds` as
+ * For type lambda parameters, it's the same as `paramInfos` as
* `asSeenFrom` has already been applied to the whole type lambda.
*/
def paramInfoAsSeenFrom(pre: Type)(implicit ctx: Context): Type
diff --git a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala
index 27782698d..c126b5500 100644
--- a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -1146,8 +1146,8 @@ object SymDenotations {
case tp: NamedType => hasSkolems(tp.prefix)
case tp: RefinedType => hasSkolems(tp.parent) || hasSkolems(tp.refinedInfo)
case tp: RecType => hasSkolems(tp.parent)
- case tp: PolyType => tp.paramBounds.exists(hasSkolems) || hasSkolems(tp.resType)
- case tp: MethodType => tp.paramTypes.exists(hasSkolems) || hasSkolems(tp.resType)
+ case tp: PolyType => tp.paramInfos.exists(hasSkolems) || hasSkolems(tp.resType)
+ case tp: MethodType => tp.paramInfos.exists(hasSkolems) || hasSkolems(tp.resType)
case tp: ExprType => hasSkolems(tp.resType)
case tp: HKApply => hasSkolems(tp.tycon) || tp.args.exists(hasSkolems)
case tp: AndOrType => hasSkolems(tp.tp1) || hasSkolems(tp.tp2)
diff --git a/compiler/src/dotty/tools/dotc/core/TypeApplications.scala b/compiler/src/dotty/tools/dotc/core/TypeApplications.scala
index 9a1a3359e..931f0dc74 100644
--- a/compiler/src/dotty/tools/dotc/core/TypeApplications.scala
+++ b/compiler/src/dotty/tools/dotc/core/TypeApplications.scala
@@ -369,7 +369,7 @@ class TypeApplications(val self: Type) extends AnyVal {
PolyType(
(tparams, hkParams).zipped.map((tparam, hkparam) =>
tparam.paramName.withVariance(hkparam.paramVariance)))(
- tl => arg.paramBounds.map(_.subst(arg, tl).bounds),
+ tl => arg.paramInfos.map(_.subst(arg, tl).bounds),
tl => arg.resultType.subst(arg, tl)
)
case arg @ TypeAlias(alias) =>
diff --git a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala
index fb16a6772..9f4db5edd 100644
--- a/compiler/src/dotty/tools/dotc/core/TypeComparer.scala
+++ b/compiler/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -488,7 +488,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
def compareMethod = tp1 match {
case tp1: MethodType =>
(tp1.signature consistentParams tp2.signature) &&
- matchingParams(tp1.paramTypes, tp2.paramTypes, tp1.isJava, tp2.isJava) &&
+ matchingParams(tp1.paramInfos, tp2.paramInfos, tp1.isJava, tp2.isJava) &&
(tp1.isImplicit == tp2.isImplicit) &&
isSubType(tp1.resultType, tp2.resultType.subst(tp2, tp1))
case _ =>
@@ -1021,7 +1021,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
tp2.widen match {
case tp2: MethodType =>
// implicitness is ignored when matching
- matchingParams(tp1.paramTypes, tp2.paramTypes, tp1.isJava, tp2.isJava) &&
+ matchingParams(tp1.paramInfos, tp2.paramInfos, tp1.isJava, tp2.isJava) &&
matchesType(tp1.resultType, tp2.resultType.subst(tp2, tp1), relaxed)
case tp2 =>
relaxed && tp1.paramNames.isEmpty &&
@@ -1067,7 +1067,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
* have the same bounds (after renaming one set to the other)?
*/
def matchingTypeParams(poly1: PolyType, poly2: PolyType): Boolean =
- (poly1.paramBounds corresponds poly2.paramBounds)((b1, b2) =>
+ (poly1.paramInfos corresponds poly2.paramInfos)((b1, b2) =>
isSameType(b1, b2.subst(poly2, poly1)))
// Type equality =:=
@@ -1284,7 +1284,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
paramNames = (tpnme.syntheticTypeParamNames(tparams1.length), tparams1, tparams2)
.zipped.map((pname, tparam1, tparam2) =>
pname.withVariance((tparam1.paramVariance + tparam2.paramVariance) / 2)))(
- paramBoundsExp = tl => (tparams1, tparams2).zipped.map((tparam1, tparam2) =>
+ paramInfosExp = tl => (tparams1, tparams2).zipped.map((tparam1, tparam2) =>
tl.lifted(tparams1, tparam1.paramInfoAsSeenFrom(tp1)).bounds &
tl.lifted(tparams2, tparam2.paramInfoAsSeenFrom(tp2)).bounds),
resultTypeExp = tl =>
@@ -1392,8 +1392,8 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
case tp2: MethodType =>
def asGoodParams(formals1: List[Type], formals2: List[Type]) =
(formals2 corresponds formals1)(isSubTypeWhenFrozen)
- asGoodParams(tp1.paramTypes, tp2.paramTypes) &&
- (!asGoodParams(tp2.paramTypes, tp1.paramTypes) ||
+ asGoodParams(tp1.paramInfos, tp2.paramInfos) &&
+ (!asGoodParams(tp2.paramInfos, tp1.paramInfos) ||
isAsGood(tp1.resultType, tp2.resultType))
case _ =>
false
diff --git a/compiler/src/dotty/tools/dotc/core/TypeErasure.scala b/compiler/src/dotty/tools/dotc/core/TypeErasure.scala
index fe3396fcb..b716318c1 100644
--- a/compiler/src/dotty/tools/dotc/core/TypeErasure.scala
+++ b/compiler/src/dotty/tools/dotc/core/TypeErasure.scala
@@ -55,7 +55,7 @@ object TypeErasure {
case ThisType(tref) =>
isErasedType(tref)
case tp: MethodType =>
- tp.paramTypes.forall(isErasedType) && isErasedType(tp.resultType)
+ tp.paramInfos.forall(isErasedType) && isErasedType(tp.resultType)
case tp @ ClassInfo(pre, _, parents, decls, _) =>
isErasedType(pre) && parents.forall(isErasedType) //&& decls.forall(sym => isErasedType(sym.info)) && isErasedType(tp.selfType)
case NoType | NoPrefix | WildcardType | _: ErrorType | SuperType(_, _) =>
@@ -186,7 +186,7 @@ object TypeErasure {
case einfo: MethodType =>
if (sym.isGetter && einfo.resultType.isRef(defn.UnitClass))
MethodType(Nil, defn.BoxedUnitType)
- else if (sym.isAnonymousFunction && einfo.paramTypes.length > MaxImplementedFunctionArity)
+ else if (sym.isAnonymousFunction && einfo.paramInfos.length > MaxImplementedFunctionArity)
MethodType(nme.ALLARGS :: Nil, JavaArrayType(defn.ObjectType) :: Nil, einfo.resultType)
else
einfo
@@ -382,10 +382,10 @@ class TypeErasure(isJava: Boolean, semiEraseVCs: Boolean, isConstructor: Boolean
case tp: MethodType =>
def paramErasure(tpToErase: Type) =
erasureFn(tp.isJava, semiEraseVCs, isConstructor, wildcardOK)(tpToErase)
- val formals = tp.paramTypes.mapConserve(paramErasure)
+ val formals = tp.paramInfos.mapConserve(paramErasure)
eraseResult(tp.resultType) match {
case rt: MethodType =>
- tp.derivedMethodType(tp.paramNames ++ rt.paramNames, formals ++ rt.paramTypes, rt.resultType)
+ tp.derivedMethodType(tp.paramNames ++ rt.paramNames, formals ++ rt.paramInfos, rt.resultType)
case rt =>
tp.derivedMethodType(tp.paramNames, formals, rt)
}
diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala
index 17879f168..60d77446d 100644
--- a/compiler/src/dotty/tools/dotc/core/Types.scala
+++ b/compiler/src/dotty/tools/dotc/core/Types.scala
@@ -217,7 +217,7 @@ object Types {
*/
def isVarArgsMethod(implicit ctx: Context): Boolean = this match {
case tp: PolyType => tp.resultType.isVarArgsMethod
- case mt: MethodType => mt.paramTypes.nonEmpty && mt.paramTypes.last.isRepeatedParam
+ case mt: MethodType => mt.paramInfos.nonEmpty && mt.paramInfos.last.isRepeatedParam
case _ => false
}
@@ -443,7 +443,7 @@ object Types {
case tp: TermRef =>
go (tp.underlying match {
case mt: MethodType
- if mt.paramTypes.isEmpty && (tp.symbol is Stable) => mt.resultType
+ if mt.paramInfos.isEmpty && (tp.symbol is Stable) => mt.resultType
case tp1 => tp1
})
case tp: PolyParam =>
@@ -543,7 +543,7 @@ object Types {
def goApply(tp: HKApply) = tp.tycon match {
case tl: PolyType =>
go(tl.resType).mapInfo(info =>
- tl.derivedLambdaAbstraction(tl.paramNames, tl.paramBounds, info).appliedTo(tp.args))
+ tl.derivedLambdaAbstraction(tl.paramNames, tl.paramInfos, info).appliedTo(tp.args))
case _ =>
go(tp.superType)
}
@@ -1088,9 +1088,9 @@ object Types {
}
/** The parameter types of a PolyType or MethodType, Empty list for others */
- final def paramTypess(implicit ctx: Context): List[List[Type]] = this match {
- case mt: MethodType => mt.paramTypes :: mt.resultType.paramTypess
- case pt: PolyType => pt.resultType.paramTypess
+ final def paramInfoss(implicit ctx: Context): List[List[Type]] = this match {
+ case mt: MethodType => mt.paramInfos :: mt.resultType.paramInfoss
+ case pt: PolyType => pt.resultType.paramInfoss
case _ => Nil
}
@@ -1103,14 +1103,14 @@ object Types {
/** The parameter types in the first parameter section of a generic type or MethodType, Empty list for others */
- @tailrec final def firstParamTypes(implicit ctx: Context): List[Type] = this match {
- case mt: MethodType => mt.paramTypes
+ final def firstParamTypes(implicit ctx: Context): List[Type] = this match {
+ case mt: MethodType => mt.paramInfos
case pt: PolyType => pt.resultType.firstParamTypes
case _ => Nil
}
/** Is this either not a method at all, or a parameterless method? */
- @tailrec final def isParameterless(implicit ctx: Context): Boolean = this match {
+ final def isParameterless(implicit ctx: Context): Boolean = this match {
case mt: MethodType => false
case pt: PolyType => pt.resultType.isParameterless
case _ => true
@@ -1220,7 +1220,7 @@ object Types {
*/
def toFunctionType(dropLast: Int = 0)(implicit ctx: Context): Type = this match {
case mt: MethodType if !mt.isDependent || ctx.mode.is(Mode.AllowDependentFunctions) =>
- val formals1 = if (dropLast == 0) mt.paramTypes else mt.paramTypes dropRight dropLast
+ val formals1 = if (dropLast == 0) mt.paramInfos else mt.paramInfos dropRight dropLast
defn.FunctionOf(
formals1 mapConserve (_.underlyingIfRepeated(mt.isJava)), mt.resultType, mt.isImplicit && !ctx.erasedTypes)
}
@@ -2324,12 +2324,12 @@ object Types {
* Proxy (hk) | HKTermLambda | HKTypeLambda
* Ground (*) | MethodType | PolyType
*/
- trait LambdaType extends BindingType with MethodOrPoly {
+ trait LambdaType[PInfo <: Type] extends BindingType with MethodOrPoly {
def paramNames: List[TermName]
- def paramTypes: List[Type]
+ def paramInfos: List[PInfo]
def resType: Type
- def newLikeThis(paramNames: List[Name], paramBounds: List[Type], resType: Type)(implicit ctx: Context): LambdaType
- def newParamRef(n: Int): ParamRef
+ def newLikeThis(paramNames: List[Name], paramInfos: List[PInfo], resType: Type)(implicit ctx: Context): LambdaType[PInfo]
+ def newParamRef(n: Int): ParamRef[PInfo]
override def resultType(implicit ctx: Context) = resType
@@ -2339,29 +2339,29 @@ object Types {
final def isTypeLambda = paramNames.head.isTypeName
final def isHigherKinded = isInstanceOf[TypeProxy]
- lazy val paramRefs: List[ParamRef] = paramNames.indices.toList.map(newParamRef)
+ lazy val paramRefs: List[ParamRef[PInfo]] = paramNames.indices.toList.map(newParamRef)
def instantiate(argTypes: => List[Type])(implicit ctx: Context): Type =
if (isDependent) resultType.substParams(this, argTypes)
else resultType
def derivedLambdaType(paramNames: List[Name] = this.paramNames,
- paramTypes: List[Type] = this.paramTypes,
+ paramInfos: List[PInfo] = this.paramInfos,
resType: Type = this.resType)(implicit ctx: Context) =
- if ((paramNames eq this.paramNames) && (paramTypes eq this.paramTypes) && (resType eq this.resType)) this
- else newLikeThis(paramNames, paramTypes, resType)
+ if ((paramNames eq this.paramNames) && (paramInfos eq this.paramInfos) && (resType eq this.resType)) this
+ else newLikeThis(paramNames, paramInfos, resType)
override def equals(that: Any) = that match {
- case that: LambdaType =>
+ case that: LambdaType[_] =>
this.paramNames == that.paramNames &&
- this.paramTypes == that.paramTypes &&
+ this.paramInfos == that.paramInfos &&
this.resType == that.resType
case _ =>
false
}
}
- trait LambdaOverTerms extends LambdaType { thisLambdaType =>
+ trait LambdaOverTerms extends LambdaType[Type] { thisLambdaType =>
import LambdaOverTerms._
override def resultType(implicit ctx: Context): Type =
@@ -2435,8 +2435,8 @@ object Types {
if (myParamDependencyStatus != Unknown) myParamDependencyStatus
else {
val result =
- if (paramTypes.isEmpty) NoDeps
- else (NoDeps /: paramTypes.tail)(depStatus(_, _))
+ if (paramInfos.isEmpty) NoDeps
+ else (NoDeps /: paramInfos.tail)(depStatus(_, _))
if ((result & Provisional) == 0) myParamDependencyStatus = result
(result & StatusMask).toByte
}
@@ -2452,10 +2452,10 @@ object Types {
*/
def isParamDependent(implicit ctx: Context): Boolean = paramDependencyStatus == TrueDeps
- def newParamRef(n: Int): ParamRef = new TermParamRef(this, n)
+ def newParamRef(n: Int): ParamRef[Type] = new TermParamRef(this, n)
}
- trait LambdaOverTypes extends LambdaType { thisLambdaType =>
+ trait LambdaOverTypes extends LambdaType[TypeBounds] { thisLambdaType =>
}
object LambdaOverTerms {
@@ -2469,47 +2469,47 @@ object Types {
}
abstract case class MethodType(paramNames: List[TermName])(
- paramTypesExp: MethodType => List[Type],
+ paramInfosExp: MethodType => List[Type],
resultTypeExp: MethodType => Type)
extends CachedGroundType with TermType with LambdaOverTerms with NarrowCached { thisMethodType =>
import MethodType._
- protected def companion: LambdaTypeCompanion[MethodType]
+ protected def companion: MethodTypeCompanion
def isJava = false
def isImplicit = false
- val paramTypes = paramTypesExp(this)
+ val paramInfos = paramInfosExp(this)
val resType = resultTypeExp(this)
assert(resType.exists)
protected def computeSignature(implicit ctx: Context): Signature =
- resultSignature.prepend(paramTypes, isJava)
+ resultSignature.prepend(paramInfos, isJava)
def derivedMethodType(paramNames: List[TermName] = this.paramNames,
- paramTypes: List[Type] = this.paramTypes,
+ paramInfos: List[Type] = this.paramInfos,
resType: Type = this.resType)(implicit ctx: Context) =
- derivedLambdaType(paramNames, paramTypes, resType)
+ derivedLambdaType(paramNames, paramInfos, resType)
- def newLikeThis(paramNames: List[Name], paramTypes: List[Type], resType: Type)(implicit ctx: Context): MethodType =
+ def newLikeThis(paramNames: List[Name], paramInfos: List[Type], resType: Type)(implicit ctx: Context): MethodType =
companion(paramNames.asInstanceOf[List[TermName]])(
- x => paramTypes.mapConserve(_.subst(this, x)),
+ x => paramInfos.mapConserve(_.subst(this, x)),
x => resType.subst(this, x))
- override def computeHash = doHash(paramNames, resType, paramTypes)
+ override def computeHash = doHash(paramNames, resType, paramInfos)
protected def prefixString = "MethodType"
- override def toString = s"$prefixString($paramNames, $paramTypes, $resType)"
+ override def toString = s"$prefixString($paramNames, $paramInfos, $resType)"
}
- final class CachedMethodType(paramNames: List[TermName])(paramTypesExp: MethodType => List[Type], resultTypeExp: MethodType => Type)
- extends MethodType(paramNames)(paramTypesExp, resultTypeExp) {
+ final class CachedMethodType(paramNames: List[TermName])(paramInfosExp: MethodType => List[Type], resultTypeExp: MethodType => Type)
+ extends MethodType(paramNames)(paramInfosExp, resultTypeExp) {
def companion = MethodType
override def equals(that: Any) = super.equals(that) && that.isInstanceOf[CachedMethodType]
}
- final class JavaMethodType(paramNames: List[TermName])(paramTypesExp: MethodType => List[Type], resultTypeExp: MethodType => Type)
- extends MethodType(paramNames)(paramTypesExp, resultTypeExp) {
+ final class JavaMethodType(paramNames: List[TermName])(paramInfosExp: MethodType => List[Type], resultTypeExp: MethodType => Type)
+ extends MethodType(paramNames)(paramInfosExp, resultTypeExp) {
def companion = JavaMethodType
override def isJava = true
override def equals(that: Any) = super.equals(that) && that.isInstanceOf[JavaMethodType]
@@ -2517,8 +2517,8 @@ object Types {
override protected def prefixString = "JavaMethodType"
}
- final class ImplicitMethodType(paramNames: List[TermName])(paramTypesExp: MethodType => List[Type], resultTypeExp: MethodType => Type)
- extends MethodType(paramNames)(paramTypesExp, resultTypeExp) {
+ final class ImplicitMethodType(paramNames: List[TermName])(paramInfosExp: MethodType => List[Type], resultTypeExp: MethodType => Type)
+ extends MethodType(paramNames)(paramInfosExp, resultTypeExp) {
def companion = ImplicitMethodType
override def isImplicit = true
override def equals(that: Any) = super.equals(that) && that.isInstanceOf[ImplicitMethodType]
@@ -2526,15 +2526,17 @@ object Types {
override protected def prefixString = "ImplicitMethodType"
}
- abstract class LambdaTypeCompanion[LT <: LambdaType] {
- def apply(paramNames: List[TermName])(paramTypesExp: LT => List[Type], resultTypeExp: LT => Type)(implicit ctx: Context): LT
- def apply(paramNames: List[TermName], paramTypes: List[Type], resultType: Type)(implicit ctx: Context): LT =
- apply(paramNames)(_ => paramTypes, _ => resultType)
- def apply(paramTypes: List[Type])(resultTypeExp: LT => Type)(implicit ctx: Context): LT =
- apply(nme.syntheticParamNames(paramTypes.length))(_ => paramTypes, resultTypeExp)
- def apply(paramTypes: List[Type], resultType: Type)(implicit ctx: Context): LT =
- apply(nme.syntheticParamNames(paramTypes.length), paramTypes, resultType)
+ abstract class LambdaTypeCompanion[PInfo <: Type, LT <: LambdaType[PInfo]] {
+ def apply(paramNames: List[TermName])(paramInfosExp: LT => List[PInfo], resultTypeExp: LT => Type)(implicit ctx: Context): LT
+ def apply(paramNames: List[TermName], paramInfos: List[PInfo], resultType: Type)(implicit ctx: Context): LT =
+ apply(paramNames)(_ => paramInfos, _ => resultType)
+ def apply(paramInfos: List[PInfo])(resultTypeExp: LT => Type)(implicit ctx: Context): LT =
+ apply(nme.syntheticParamNames(paramInfos.length))(_ => paramInfos, resultTypeExp)
+ def apply(paramInfos: List[PInfo], resultType: Type)(implicit ctx: Context): LT =
+ apply(nme.syntheticParamNames(paramInfos.length), paramInfos, resultType)
+ }
+ abstract class MethodTypeCompanion extends LambdaTypeCompanion[Type, MethodType] {
/** Produce method type from parameter symbols, with special mappings for repeated
* and inline parameters.
*/
@@ -2554,8 +2556,9 @@ object Types {
case _: ExprType => tp
case _ => AnnotatedType(tp, Annotation(defn.InlineParamAnnot))
}
- def integrate(tp: Type, mt: LT) =
+ def integrate(tp: Type, mt: MethodType): Type =
tp.subst(params, params.indices.toList.map(mt.newParamRef))
+
def paramInfo(param: Symbol): Type = {
val paramType = translateRepeated(param.info)
if (param.is(Inline)) translateInline(paramType) else paramType
@@ -2565,10 +2568,10 @@ object Types {
mt => integrate(resultType, mt))
}
- def checkValid(mt: LT)(implicit ctx: Context): mt.type = {
- if (Config.checkMethodTypes && mt.isTermLambda)
- for ((paramType, idx) <- mt.paramTypes.zipWithIndex)
- paramType.foreachPart {
+ def checkValid(mt: MethodType)(implicit ctx: Context): mt.type = {
+ if (Config.checkMethodTypes)
+ for ((paramInfo, idx) <- mt.paramInfos.zipWithIndex)
+ paramInfo.foreachPart {
case ParamRef(`mt`, j) => assert(j < idx, mt)
case _ =>
}
@@ -2576,25 +2579,25 @@ object Types {
}
}
- object MethodType extends LambdaTypeCompanion[MethodType] {
- def apply(paramNames: List[TermName])(paramTypesExp: MethodType => List[Type], resultTypeExp: MethodType => Type)(implicit ctx: Context): MethodType =
- checkValid(unique(new CachedMethodType(paramNames)(paramTypesExp, resultTypeExp)))
+ object MethodType extends MethodTypeCompanion {
+ def apply(paramNames: List[TermName])(paramInfosExp: MethodType => List[Type], resultTypeExp: MethodType => Type)(implicit ctx: Context): MethodType =
+ checkValid(unique(new CachedMethodType(paramNames)(paramInfosExp, resultTypeExp)))
}
- object JavaMethodType extends LambdaTypeCompanion[MethodType] {
- def apply(paramNames: List[TermName])(paramTypesExp: MethodType => List[Type], resultTypeExp: MethodType => Type)(implicit ctx: Context): MethodType =
- unique(new JavaMethodType(paramNames)(paramTypesExp, resultTypeExp))
+ object JavaMethodType extends MethodTypeCompanion {
+ def apply(paramNames: List[TermName])(paramInfosExp: MethodType => List[Type], resultTypeExp: MethodType => Type)(implicit ctx: Context): MethodType =
+ unique(new JavaMethodType(paramNames)(paramInfosExp, resultTypeExp))
}
- object ImplicitMethodType extends LambdaTypeCompanion[MethodType] {
- def apply(paramNames: List[TermName])(paramTypesExp: MethodType => List[Type], resultTypeExp: MethodType => Type)(implicit ctx: Context): MethodType =
- checkValid(unique(new ImplicitMethodType(paramNames)(paramTypesExp, resultTypeExp)))
+ object ImplicitMethodType extends MethodTypeCompanion {
+ def apply(paramNames: List[TermName])(paramInfosExp: MethodType => List[Type], resultTypeExp: MethodType => Type)(implicit ctx: Context): MethodType =
+ checkValid(unique(new ImplicitMethodType(paramNames)(paramInfosExp, resultTypeExp)))
}
/** A ternary extractor for MethodType */
object MethodTpe {
def unapply(mt: MethodType)(implicit ctx: Context) =
- Some((mt.paramNames, mt.paramTypes, mt.resultType))
+ Some((mt.paramNames, mt.paramInfos, mt.resultType))
}
/** A by-name parameter type of the form `=> T`, or the type of a method with no parameter list. */
@@ -2625,17 +2628,17 @@ object Types {
* and every other name designates a non-variant parameter.
*
* @param paramNames The names `X_0`, ..., `X_n`
- * @param paramBoundsExp A function that, given the polytype itself, returns the
+ * @param paramInfosExp A function that, given the polytype itself, returns the
* parameter bounds `B_1`, ..., `B_n`
* @param resultTypeExp A function that, given the polytype itself, returns the
* result type `T`.
*/
class PolyType(val paramNames: List[TypeName])(
- paramBoundsExp: PolyType => List[TypeBounds], resultTypeExp: PolyType => Type)
+ paramInfosExp: PolyType => List[TypeBounds], resultTypeExp: PolyType => Type)
extends CachedProxyType with BindingType with MethodOrPoly {
/** The bounds of the type parameters */
- val paramTypes: List[Type] = paramBoundsExp(this)
+ val paramInfos: List[TypeBounds] = paramInfosExp(this)
/** The result type of a PolyType / body of a type lambda */
val resType: Type = resultTypeExp(this)
@@ -2660,29 +2663,29 @@ object Types {
/** Instantiate parameter bounds by substituting parameters with given arguments */
final def instantiateBounds(argTypes: List[Type])(implicit ctx: Context): List[Type] =
- paramTypes.mapConserve(_.substParams(this, argTypes))
+ paramInfos.mapConserve(_.substParams(this, argTypes))
- def newLikeThis(paramNames: List[TypeName], paramBounds: List[TypeBounds], resType: Type)(implicit ctx: Context): PolyType =
+ def newLikeThis(paramNames: List[TypeName], paramInfos: List[TypeBounds], resType: Type)(implicit ctx: Context): PolyType =
PolyType.apply(paramNames)(
- x => paramBounds mapConserve (_.subst(this, x).bounds),
+ x => paramInfos.mapConserve(_.subst(this, x).bounds),
x => resType.subst(this, x))
def derivedPolyType(paramNames: List[TypeName] = this.paramNames,
- paramBounds: List[TypeBounds] = this.paramBounds,
+ paramInfos: List[TypeBounds] = this.paramInfos,
resType: Type = this.resType)(implicit ctx: Context) =
- if ((paramNames eq this.paramNames) && (paramBounds eq this.paramBounds) && (resType eq this.resType)) this
- else newLikeThis(paramNames, paramBounds, resType)
+ if ((paramNames eq this.paramNames) && (paramInfos eq this.paramInfos) && (resType eq this.resType)) this
+ else newLikeThis(paramNames, paramInfos, resType)
- def derivedLambdaAbstraction(paramNames: List[TypeName], paramBounds: List[TypeBounds], resType: Type)(implicit ctx: Context): Type =
+ def derivedLambdaAbstraction(paramNames: List[TypeName], paramInfos: List[TypeBounds], resType: Type)(implicit ctx: Context): Type =
resType match {
case resType @ TypeAlias(alias) =>
- resType.derivedTypeAlias(newLikeThis(paramNames, paramBounds, alias))
+ resType.derivedTypeAlias(newLikeThis(paramNames, paramInfos, alias))
case resType @ TypeBounds(lo, hi) =>
resType.derivedTypeBounds(
- if (lo.isRef(defn.NothingClass)) lo else newLikeThis(paramNames, paramBounds, lo),
- newLikeThis(paramNames, paramBounds, hi))
+ if (lo.isRef(defn.NothingClass)) lo else newLikeThis(paramNames, paramInfos, lo),
+ newLikeThis(paramNames, paramInfos, hi))
case _ =>
- derivedPolyType(paramNames, paramBounds, resType)
+ derivedPolyType(paramNames, paramInfos, resType)
}
/** Merge nested polytypes into one polytype. nested polytypes are normally not supported
@@ -2697,8 +2700,8 @@ object Types {
}
}
PolyType(paramNames ++ that.paramNames)(
- x => this.paramBounds.mapConserve(_.subst(this, x).bounds) ++
- that.paramBounds.mapConserve(shift(_).subst(that, x).bounds),
+ x => this.paramInfos.mapConserve(_.subst(this, x).bounds) ++
+ that.paramInfos.mapConserve(shift(_).subst(that, x).bounds),
x => shift(that.resultType).subst(that, x).subst(this, x))
case _ => this
}
@@ -2715,21 +2718,21 @@ object Types {
override def equals(other: Any) = other match {
case other: PolyType =>
other.paramNames == this.paramNames &&
- other.paramBounds == this.paramBounds &&
+ other.paramInfos == this.paramInfos &&
other.resType == this.resType
case _ => false
}
- override def toString = s"PolyType($paramNames, $paramTypes, $resType)"
+ override def toString = s"PolyType($paramNames, $paramInfos, $resType)"
- override def computeHash = doHash(paramNames, resType, paramTypes)
+ override def computeHash = doHash(paramNames, resType, paramInfos)
}
object PolyType {
def apply(paramNames: List[TypeName])(
- paramBoundsExp: PolyType => List[TypeBounds],
+ paramInfosExp: PolyType => List[TypeBounds],
resultTypeExp: PolyType => Type)(implicit ctx: Context): PolyType = {
- unique(new PolyType(paramNames)(paramBoundsExp, resultTypeExp))
+ unique(new PolyType(paramNames)(paramInfosExp, resultTypeExp))
}
def unapply(tl: PolyType): Some[(List[LambdaParam], Type)] =
@@ -2746,7 +2749,7 @@ object Types {
case class LambdaParam(tl: PolyType, n: Int) extends ParamInfo {
def isTypeParam(implicit ctx: Context) = tl.paramNames.head.isTypeName
def paramName(implicit ctx: Context): TypeName = tl.paramNames(n)
- def paramInfo(implicit ctx: Context): Type = tl.paramBounds(n)
+ def paramInfo(implicit ctx: Context): Type = tl.paramInfos(n)
def paramInfoAsSeenFrom(pre: Type)(implicit ctx: Context): Type = paramInfo
def paramInfoOrCompleter(implicit ctx: Context): Type = paramInfo
def paramVariance(implicit ctx: Context): Int = tl.paramNames(n).variance
@@ -2841,17 +2844,17 @@ object Types {
def paramName: Name
}
- abstract case class ParamRef(binder: LambdaType, paramNum: Int) extends ParamType {
- type BT = LambdaType
+ abstract case class ParamRef[PInfo <: Type](binder: LambdaType[PInfo], paramNum: Int) extends ParamType {
+ type BT = LambdaType[PInfo]
def paramName = binder.paramNames(paramNum)
- override def underlying(implicit ctx: Context): Type = binder.paramTypes(paramNum)
+ override def underlying(implicit ctx: Context): Type = binder.paramInfos(paramNum)
// need to customize hashCode and equals to prevent infinite recursion for dep meth types.
override def computeHash = addDelta(binder.identityHash, paramNum)
override def equals(that: Any) = that match {
- case that: ParamRef =>
+ case that: ParamRef[_] =>
(this.binder eq that.binder) && this.paramNum == that.paramNum
case _ =>
false
@@ -2860,13 +2863,13 @@ object Types {
override def toString = s"ParamRef($paramName)"
}
- class TermParamRef(binder: LambdaType, paramNum: Int)
- extends ParamRef(binder, paramNum) with SingletonType {
+ class TermParamRef(binder: LambdaType[Type], paramNum: Int)
+ extends ParamRef[Type](binder, paramNum) with SingletonType {
def copyBoundType(bt: BT) = new TermParamRef(bt, paramNum)
}
object TermParamRef {
- def apply(binder: LambdaType, paramNum: Int)(implicit ctx: Context): TermParamRef = {
+ def apply(binder: LambdaType[Type], paramNum: Int)(implicit ctx: Context): TermParamRef = {
assertUnerased()
new TermParamRef(binder, paramNum)
}
@@ -2893,7 +2896,7 @@ object Types {
def paramName = binder.paramNames(paramNum)
override def underlying(implicit ctx: Context): Type = {
- val bounds = binder.paramBounds
+ val bounds = binder.paramInfos
if (bounds == null) NoType // this can happen if the referenced generic type is not initialized yet
else bounds(paramNum)
}
@@ -3396,7 +3399,7 @@ object Types {
case tp: ClassInfo =>
def zeroParams(tp: Type): Boolean = tp match {
case pt: PolyType => zeroParams(pt.resultType)
- case mt: MethodType => mt.paramTypes.isEmpty && !mt.resultType.isInstanceOf[MethodType]
+ case mt: MethodType => mt.paramInfos.isEmpty && !mt.resultType.isInstanceOf[MethodType]
case et: ExprType => true
case _ => false
}
@@ -3517,7 +3520,7 @@ object Types {
case tp: MethodType =>
def mapOverMethod = {
variance = -variance
- val ptypes1 = tp.paramTypes mapConserve this
+ val ptypes1 = tp.paramInfos mapConserve this
variance = -variance
derivedMethodType(tp, ptypes1, this(tp.resultType))
}
@@ -3529,7 +3532,7 @@ object Types {
case tp: PolyType =>
def mapOverPoly = {
variance = -variance
- val bounds1 = tp.paramBounds.mapConserve(this).asInstanceOf[List[TypeBounds]]
+ val bounds1 = tp.paramInfos.mapConserve(this).asInstanceOf[List[TypeBounds]]
variance = -variance
derivedPolyType(tp, bounds1, this(tp.resultType))
}
@@ -3744,7 +3747,7 @@ object Types {
case tp: MethodType =>
variance = -variance
- val y = foldOver(x, tp.paramTypes)
+ val y = foldOver(x, tp.paramInfos)
variance = -variance
this(y, tp.resultType)
@@ -3753,7 +3756,7 @@ object Types {
case tp: PolyType =>
variance = -variance
- val y = foldOver(x, tp.paramBounds)
+ val y = foldOver(x, tp.paramInfos)
variance = -variance
this(y, tp.resultType)
@@ -3857,7 +3860,7 @@ object Types {
apply(x, tp.tref)
case tp: ConstantType =>
apply(x, tp.underlying)
- case tp: ParamRef =>
+ case tp: ParamRef[_] =>
apply(x, tp.underlying)
case tp: PolyParam =>
apply(x, tp.underlying)
diff --git a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala
index e0b233ce8..2bb929bf3 100644
--- a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala
+++ b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala
@@ -209,7 +209,7 @@ class ClassfileParser(
def normalizeConstructorInfo() = {
val mt @ MethodType(paramNames) = denot.info
val rt = classRoot.typeRef appliedTo (classRoot.typeParams map (_.typeRef))
- denot.info = mt.derivedMethodType(paramNames, mt.paramTypes, rt)
+ denot.info = mt.derivedMethodType(paramNames, mt.paramInfos, rt)
addConstructorTypeParams(denot)
}
@@ -975,7 +975,7 @@ class ClassfileParser(
if (name == nme.CONSTRUCTOR)
tpe match {
case tp: MethodType =>
- tp.derivedMethodType(tp.paramNames, tp.paramTypes, ownerTpe)
+ tp.derivedMethodType(tp.paramNames, tp.paramInfos, ownerTpe)
}
p = (name, tpe)
values(index) = p
diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala
index d0d0e1863..8801eb19b 100644
--- a/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala
+++ b/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala
@@ -255,10 +255,10 @@ class TreePickler(pickler: TastyPickler) {
pickleType(tpe.underlying)
case tpe: PolyType =>
writeByte(POLYtype)
- pickleMethodic(tpe.resultType, tpe.paramNames, tpe.paramBounds)
+ pickleMethodic(tpe.resultType, tpe.paramNames, tpe.paramInfos)
case tpe: MethodType if richTypes =>
writeByte(METHODtype)
- pickleMethodic(tpe.resultType, tpe.paramNames, tpe.paramTypes)
+ pickleMethodic(tpe.resultType, tpe.paramNames, tpe.paramInfos)
case tpe: PolyParam =>
if (!pickleParamType(tpe))
// TODO figure out why this case arises in e.g. pickling AbstractFileReader.
@@ -266,7 +266,7 @@ class TreePickler(pickler: TastyPickler) {
case TypeBounds(lo, hi) if lo eq hi => pickleNewType(lo, richTypes)
case _ => assert(false, s"orphan poly parameter: $tpe")
}
- case tpe: ParamRef =>
+ case tpe: ParamRef[_] =>
assert(pickleParamType(tpe), s"orphan method parameter: $tpe")
case tpe: LazyRef =>
pickleType(tpe.ref)
diff --git a/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala b/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
index 688a2d007..fad516da7 100644
--- a/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
+++ b/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
@@ -56,7 +56,7 @@ object Scala2Unpickler {
*/
def arrayToRepeated(tp: Type)(implicit ctx: Context): Type = tp match {
case tp: MethodType =>
- val lastArg = tp.paramTypes.last
+ val lastArg = tp.paramInfos.last
assert(lastArg isRef defn.ArrayClass)
val elemtp0 :: Nil = lastArg.baseArgInfos(defn.ArrayClass)
val elemtp = elemtp0 match {
@@ -67,10 +67,10 @@ object Scala2Unpickler {
}
tp.derivedMethodType(
tp.paramNames,
- tp.paramTypes.init :+ defn.RepeatedParamType.appliedTo(elemtp),
+ tp.paramInfos.init :+ defn.RepeatedParamType.appliedTo(elemtp),
tp.resultType)
case tp: PolyType =>
- tp.derivedPolyType(tp.paramNames, tp.paramBounds, arrayToRepeated(tp.resultType))
+ tp.derivedPolyType(tp.paramNames, tp.paramInfos, arrayToRepeated(tp.resultType))
}
def ensureConstructor(cls: ClassSymbol, scope: Scope)(implicit ctx: Context) =
diff --git a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala
index bc6897c12..d6b7adffe 100644
--- a/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala
+++ b/compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala
@@ -170,7 +170,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
def paramText(name: TermName, tp: Type) = toText(name) ~ ": " ~ toText(tp)
changePrec(GlobalPrec) {
(if (tp.isImplicit) "(implicit " else "(") ~
- Text((tp.paramNames, tp.paramTypes).zipped map paramText, ", ") ~
+ Text((tp.paramNames, tp.paramInfos).zipped map paramText, ", ") ~
")" ~ toText(tp.resultType)
}
case tp: ExprType =>
@@ -178,7 +178,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
case tp: PolyType =>
def paramText(name: Name, bounds: TypeBounds): Text = name.toString ~ toText(bounds)
changePrec(GlobalPrec) {
- "[" ~ Text((tp.paramNames, tp.paramBounds).zipped.map(paramText), ", ") ~
+ "[" ~ Text((tp.paramNames, tp.paramInfos).zipped.map(paramText), ", ") ~
"]" ~ (" => " provided !tp.resultType.isInstanceOf[MethodType]) ~
toTextGlobal(tp.resultType)
}
diff --git a/compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala b/compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala
index 158ba4185..89e935bd5 100644
--- a/compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala
+++ b/compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala
@@ -312,7 +312,7 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
val tparams = sym.info match {
case pt: PolyType =>
- (pt.paramNames, pt.paramBounds).zipped.map((pname, pbounds) =>
+ (pt.paramNames, pt.paramInfos).zipped.map((pname, pbounds) =>
apiTypeParameter(pname.toString, 0, pbounds.lo, pbounds.hi))
case _ =>
Nil
diff --git a/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala b/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala
index a02235163..2d5b1ff16 100644
--- a/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala
+++ b/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala
@@ -256,7 +256,7 @@ private class ExtractDependenciesCollector(implicit val ctx: Context) extends tp
traverse(tp.underlying)
case tp: ConstantType =>
traverse(tp.underlying)
- case tp: ParamRef =>
+ case tp: ParamRef[_] =>
traverse(tp.underlying)
case tp: PolyParam =>
traverse(tp.underlying)
diff --git a/compiler/src/dotty/tools/dotc/transform/CollectEntryPoints.scala b/compiler/src/dotty/tools/dotc/transform/CollectEntryPoints.scala
index 9f1e42e31..e82be4378 100644
--- a/compiler/src/dotty/tools/dotc/transform/CollectEntryPoints.scala
+++ b/compiler/src/dotty/tools/dotc/transform/CollectEntryPoints.scala
@@ -88,7 +88,7 @@ class CollectEntryPoints extends MiniPhaseTransform {
case t: PolyType =>
fail("main methods cannot be generic.")
case t: MethodType =>
- if (t.resultType :: t.paramTypes exists (_.typeSymbol.isAbstractType))
+ if (t.resultType :: t.paramInfos exists (_.typeSymbol.isAbstractType))
fail("main methods cannot refer to type parameters or abstract types.", m.symbol.pos)
else
javaPlatform.isJavaMainMethod(m.symbol) || fail("main method must have exact signature (Array[String])Unit", m.symbol.pos)
diff --git a/compiler/src/dotty/tools/dotc/transform/ElimByName.scala b/compiler/src/dotty/tools/dotc/transform/ElimByName.scala
index 59da78590..839552799 100644
--- a/compiler/src/dotty/tools/dotc/transform/ElimByName.scala
+++ b/compiler/src/dotty/tools/dotc/transform/ElimByName.scala
@@ -93,7 +93,7 @@ class ElimByName extends MiniPhaseTransform with InfoTransformer { thisTransform
}
val mt @ MethodType(_) = tree.fun.tpe.widen
- val args1 = tree.args.zipWithConserve(mt.paramTypes)(transformArg)
+ val args1 = tree.args.zipWithConserve(mt.paramInfos)(transformArg)
cpy.Apply(tree)(tree.fun, args1)
}
diff --git a/compiler/src/dotty/tools/dotc/transform/ElimErasedValueType.scala b/compiler/src/dotty/tools/dotc/transform/ElimErasedValueType.scala
index 24c8cdc8d..25c01c1f7 100644
--- a/compiler/src/dotty/tools/dotc/transform/ElimErasedValueType.scala
+++ b/compiler/src/dotty/tools/dotc/transform/ElimErasedValueType.scala
@@ -44,7 +44,7 @@ class ElimErasedValueType extends MiniPhaseTransform with InfoTransformer {
case ErasedValueType(_, underlying) =>
elimEVT(underlying)
case tp: MethodType =>
- val paramTypes = tp.paramTypes.mapConserve(elimEVT)
+ val paramTypes = tp.paramInfos.mapConserve(elimEVT)
val retType = elimEVT(tp.resultType)
tp.derivedMethodType(tp.paramNames, paramTypes, retType)
case _ =>
diff --git a/compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala b/compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala
index ae3259509..bc2674a77 100644
--- a/compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala
+++ b/compiler/src/dotty/tools/dotc/transform/ElimRepeated.scala
@@ -57,7 +57,7 @@ class ElimRepeated extends MiniPhaseTransform with InfoTransformer with Annotati
} else paramTypes
tp.derivedMethodType(paramNames, paramTypes1, resultType1)
case tp: PolyType =>
- tp.derivedPolyType(tp.paramNames, tp.paramBounds, elimRepeated(tp.resultType))
+ tp.derivedPolyType(tp.paramNames, tp.paramInfos, elimRepeated(tp.resultType))
case tp =>
tp
}
@@ -139,9 +139,9 @@ class ElimRepeated extends MiniPhaseTransform with InfoTransformer with Annotati
/** Convert type from Scala to Java varargs method */
private def toJavaVarArgs(tp: Type)(implicit ctx: Context): Type = tp match {
case tp: PolyType =>
- tp.derivedPolyType(tp.paramNames, tp.paramBounds, toJavaVarArgs(tp.resultType))
+ tp.derivedPolyType(tp.paramNames, tp.paramInfos, toJavaVarArgs(tp.resultType))
case tp: MethodType =>
- val inits :+ last = tp.paramTypes
+ val inits :+ last = tp.paramInfos
val last1 = last.underlyingIfRepeated(isJava = true)
tp.derivedMethodType(tp.paramNames, inits :+ last1, tp.resultType)
}
diff --git a/compiler/src/dotty/tools/dotc/transform/Erasure.scala b/compiler/src/dotty/tools/dotc/transform/Erasure.scala
index f9c7a8e1e..d64120085 100644
--- a/compiler/src/dotty/tools/dotc/transform/Erasure.scala
+++ b/compiler/src/dotty/tools/dotc/transform/Erasure.scala
@@ -461,12 +461,12 @@ object Erasure extends TypeTestsCasts{
case mt: MethodType =>
val outers = outer.args(fun.asInstanceOf[tpd.Tree]) // can't use fun1 here because its type is already erased
var args0 = outers ::: args ++ protoArgs(pt)
- if (args0.length > MaxImplementedFunctionArity && mt.paramTypes.length == 1) {
+ if (args0.length > MaxImplementedFunctionArity && mt.paramInfos.length == 1) {
val bunchedArgs = untpd.JavaSeqLiteral(args0, TypeTree(defn.ObjectType))
.withType(defn.ArrayOf(defn.ObjectType))
args0 = bunchedArgs :: Nil
}
- val args1 = args0.zipWithConserve(mt.paramTypes)(typedExpr)
+ val args1 = args0.zipWithConserve(mt.paramInfos)(typedExpr)
untpd.cpy.Apply(tree)(fun1, args1) withType mt.resultType
case _ =>
throw new MatchError(i"tree $tree has unexpected type of function ${fun1.tpe.widen}, was ${fun.typeOpt.widen}")
@@ -547,8 +547,8 @@ object Erasure extends TypeTestsCasts{
case SAMType(sam) =>
val implType = meth.tpe.widen
- val List(implParamTypes) = implType.paramTypess
- val List(samParamTypes) = sam.info.paramTypess
+ val List(implParamTypes) = implType.paramInfoss
+ val List(samParamTypes) = sam.info.paramInfoss
val implResultType = implType.resultType
val samResultType = sam.info.resultType
@@ -698,8 +698,8 @@ object Erasure extends TypeTestsCasts{
val rhs = paramss.foldLeft(sel)((fun, vparams) =>
fun.tpe.widen match {
case mt: MethodType =>
- Apply(fun, (vparams, mt.paramTypes).zipped.map(adapt(_, _, untpd.EmptyTree)))
- case a =>
+ Apply(fun, (vparams, mt.paramInfos).zipped.map(adapt(_, _, untpd.EmptyTree)))
+ case a =>
error(s"can not resolve apply type $a")
})
adapt(rhs, resultType)
diff --git a/compiler/src/dotty/tools/dotc/transform/FullParameterization.scala b/compiler/src/dotty/tools/dotc/transform/FullParameterization.scala
index 7fb9ba302..dd318861a 100644
--- a/compiler/src/dotty/tools/dotc/transform/FullParameterization.scala
+++ b/compiler/src/dotty/tools/dotc/transform/FullParameterization.scala
@@ -124,7 +124,7 @@ trait FullParameterization {
case info: PolyType =>
PolyType(info.paramNames ++ ctnames)(
pt =>
- (info.paramBounds.map(mapClassParams(_, pt).bounds) ++
+ (info.paramInfos.map(mapClassParams(_, pt).bounds) ++
mappedClassBounds(pt)).mapConserve(_.subst(info, pt).bounds),
pt => resultType(mapClassParams(_, pt)).subst(info, pt))
case _ =>
@@ -233,7 +233,7 @@ trait FullParameterization {
fun.appliedToArgss(originalDef.vparamss.nestedMap(vparam => ref(vparam.symbol)))
else {
// this type could have changed on forwarding. Need to insert a cast.
- val args = (originalDef.vparamss, fun.tpe.paramTypess).zipped.map((vparams, paramTypes) =>
+ val args = (originalDef.vparamss, fun.tpe.paramInfoss).zipped.map((vparams, paramTypes) =>
(vparams, paramTypes).zipped.map((vparam, paramType) => {
assert(vparam.tpe <:< paramType.widen) // type should still conform to widened type
ref(vparam.symbol).ensureConforms(paramType)
diff --git a/compiler/src/dotty/tools/dotc/transform/FunctionalInterfaces.scala b/compiler/src/dotty/tools/dotc/transform/FunctionalInterfaces.scala
index 5fd89314a..bde902152 100644
--- a/compiler/src/dotty/tools/dotc/transform/FunctionalInterfaces.scala
+++ b/compiler/src/dotty/tools/dotc/transform/FunctionalInterfaces.scala
@@ -31,8 +31,8 @@ class FunctionalInterfaces extends MiniPhaseTransform {
val maxArgsCount = 2
def shouldSpecialize(m: MethodType)(implicit ctx: Context) =
- (m.paramTypes.size <= maxArgsCount) &&
- m.paramTypes.forall(x => allowedArgumentTypes.contains(x.typeSymbol)) &&
+ (m.paramInfos.size <= maxArgsCount) &&
+ m.paramInfos.forall(x => allowedArgumentTypes.contains(x.typeSymbol)) &&
allowedReturnTypes.contains(m.resultType.typeSymbol)
val functionName = "JFunction".toTermName
@@ -67,7 +67,7 @@ class FunctionalInterfaces extends MiniPhaseTransform {
val names = ctx.atPhase(ctx.erasurePhase) {
implicit ctx => functionSymbol.typeParams.map(_.name)
}
- val interfaceName = (functionName ++ m.paramTypes.length.toString).specializedFor(m.paramTypes ::: m.resultType :: Nil, names, Nil, Nil)
+ val interfaceName = (functionName ++ m.paramInfos.length.toString).specializedFor(m.paramInfos ::: m.resultType :: Nil, names, Nil, Nil)
// symbols loaded from classpath aren't defined in periods earlier than when they where loaded
val interface = ctx.withPhase(ctx.typerPhase).getClassIfDefined(functionPackage ++ interfaceName)
diff --git a/compiler/src/dotty/tools/dotc/transform/MixinOps.scala b/compiler/src/dotty/tools/dotc/transform/MixinOps.scala
index 9f7ceeaed..d91522c25 100644
--- a/compiler/src/dotty/tools/dotc/transform/MixinOps.scala
+++ b/compiler/src/dotty/tools/dotc/transform/MixinOps.scala
@@ -72,7 +72,7 @@ class MixinOps(cls: ClassSymbol, thisTransform: DenotTransformer)(implicit ctx:
def hasPrimitiveMissMatch(tp1: Type, tp2: Type): Boolean = (tp1, tp2) match {
case (tp1: MethodicType, tp2: MethodicType) =>
hasPrimitiveMissMatch(tp1.resultType, tp2.resultType) ||
- tp1.paramTypess.flatten.zip(tp1.paramTypess.flatten).exists(args => hasPrimitiveMissMatch(args._1, args._2))
+ tp1.paramInfoss.flatten.zip(tp1.paramInfoss.flatten).exists(args => hasPrimitiveMissMatch(args._1, args._2))
case _ =>
def isPrimitiveOrValueClass(sym: Symbol): Boolean = sym.isPrimitiveValueClass || sym.isValueClass
isPrimitiveOrValueClass(tp1.typeSymbol) ^ isPrimitiveOrValueClass(tp2.typeSymbol)
diff --git a/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala b/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala
index 197d18374..dbc7666f7 100644
--- a/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala
+++ b/compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala
@@ -1766,7 +1766,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {
def applyMethodTypes(method: Type): Extractor = {
val whole = method.finalResultType
- method.paramTypess.head match {
+ method.paramInfoss.head match {
case init :+ last if last.isRepeatedParam => newExtractor(whole, init, repeatedFromVarargs(last))
case tps => newExtractor(whole, tps, NoRepeated)
}
diff --git a/compiler/src/dotty/tools/dotc/transform/SuperAccessors.scala b/compiler/src/dotty/tools/dotc/transform/SuperAccessors.scala
index 8907cc4dd..102b492a8 100644
--- a/compiler/src/dotty/tools/dotc/transform/SuperAccessors.scala
+++ b/compiler/src/dotty/tools/dotc/transform/SuperAccessors.scala
@@ -178,7 +178,7 @@ class SuperAccessors(thisTransformer: DenotTransformer) {
val accType = {
def accTypeOf(tpe: Type): Type = tpe match {
case tpe: PolyType =>
- tpe.derivedPolyType(tpe.paramNames, tpe.paramBounds, accTypeOf(tpe.resultType))
+ tpe.derivedPolyType(tpe.paramNames, tpe.paramInfos, accTypeOf(tpe.resultType))
case _ =>
MethodType(receiverType :: Nil)(mt => tpe.substThis(sym.owner.asClass, mt.newParamRef(0)))
}
@@ -230,7 +230,7 @@ class SuperAccessors(thisTransformer: DenotTransformer) {
else clazz.classInfo.selfType
def accTypeOf(tpe: Type): Type = tpe match {
case tpe: PolyType =>
- tpe.derivedPolyType(tpe.paramNames, tpe.paramBounds, accTypeOf(tpe.resultType))
+ tpe.derivedPolyType(tpe.paramNames, tpe.paramInfos, accTypeOf(tpe.resultType))
case _ =>
MethodType(receiverType :: Nil)(mt => tpe.substThis(sym.owner.asClass, mt.newParamRef(0)))
}
diff --git a/compiler/src/dotty/tools/dotc/typer/Applications.scala b/compiler/src/dotty/tools/dotc/typer/Applications.scala
index f506abce8..d1a73fd65 100644
--- a/compiler/src/dotty/tools/dotc/typer/Applications.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Applications.scala
@@ -232,7 +232,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
else
fail(err.typeMismatchMsg(methType.resultType, resultType))
// match all arguments with corresponding formal parameters
- matchArgs(orderedArgs, methType.paramTypes, 0)
+ matchArgs(orderedArgs, methType.paramInfos, 0)
case _ =>
if (methType.isError) ok = false
else fail(s"$methString does not take parameters")
@@ -763,7 +763,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
val typedFn = typedExpr(tree.fun, PolyProto(typedArgs.tpes, pt))
typedFn.tpe.widen match {
case pt: PolyType =>
- if (typedArgs.length <= pt.paramBounds.length && !isNamed)
+ if (typedArgs.length <= pt.paramInfos.length && !isNamed)
if (typedFn.symbol == defn.Predef_classOf && typedArgs.nonEmpty) {
val arg = typedArgs.head
checkClassType(arg.tpe, arg.pos, traitReq = false, stablePrefixReq = false)
@@ -883,8 +883,8 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
}
unapplyFn.tpe.widen match {
- case mt: MethodType if mt.paramTypes.length == 1 =>
- val unapplyArgType = mt.paramTypes.head
+ case mt: MethodType if mt.paramInfos.length == 1 =>
+ val unapplyArgType = mt.paramInfos.head
unapp.println(i"unapp arg tpe = $unapplyArgType, pt = $selType")
val ownType =
if (selType <:< unapplyArgType) {
@@ -1056,10 +1056,10 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
case _ => if (tp.isRepeatedParam) tp.argTypesHi.head else tp
}
val formals1 =
- if (tp1.isVarArgsMethod && tp2.isVarArgsMethod) tp1.paramTypes map repeatedToSingle
- else tp1.paramTypes
+ if (tp1.isVarArgsMethod && tp2.isVarArgsMethod) tp1.paramInfos map repeatedToSingle
+ else tp1.paramInfos
isApplicable(alt2, formals1, WildcardType) ||
- tp1.paramTypes.isEmpty && tp2.isInstanceOf[MethodOrPoly]
+ tp1.paramInfos.isEmpty && tp2.isInstanceOf[MethodOrPoly]
case tp1: PolyType => // (2)
val tparams = ctx.newTypeParams(alt1.symbol, tp1.paramNames, EmptyFlags, tp1.instantiateBounds)
isAsSpecific(alt1, tp1.instantiate(tparams map (_.typeRef)), alt2, tp2)
@@ -1125,7 +1125,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
case mt: ImplicitMethodType =>
resultTypeApprox(mt)
case pt: PolyType =>
- pt.derivedPolyType(pt.paramNames, pt.paramBounds, stripImplicit(pt.resultType))
+ pt.derivedPolyType(pt.paramNames, pt.paramInfos, stripImplicit(pt.resultType))
case _ =>
tp
}
@@ -1287,7 +1287,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
def sizeFits(alt: TermRef, tp: Type): Boolean = tp match {
case tp: PolyType => sizeFits(alt, tp.resultType)
case tp: MethodType =>
- val ptypes = tp.paramTypes
+ val ptypes = tp.paramInfos
val numParams = ptypes.length
def isVarArgs = ptypes.nonEmpty && ptypes.last.isRepeatedParam
def hasDefault = alt.symbol.hasDefaultParams
@@ -1413,7 +1413,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
case _ =>
}
def paramTypes(alt: Type): List[Type] = alt match {
- case mt: MethodType => mt.paramTypes
+ case mt: MethodType => mt.paramInfos
case mt: PolyType => paramTypes(mt.resultType)
case _ => Nil
}
diff --git a/compiler/src/dotty/tools/dotc/typer/Checking.scala b/compiler/src/dotty/tools/dotc/typer/Checking.scala
index 76cbbdc6d..e959e6984 100644
--- a/compiler/src/dotty/tools/dotc/typer/Checking.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Checking.scala
@@ -55,7 +55,7 @@ object Checking {
* are handled by method checkBounds in FirstTransform
*/
def checkBounds(args: List[tpd.Tree], poly: PolyType)(implicit ctx: Context): Unit =
- checkBounds(args, poly.paramBounds, _.substParams(poly, _))
+ checkBounds(args, poly.paramInfos, _.substParams(poly, _))
/** Check applied type trees for well-formedness. This means
* - all arguments are within their corresponding bounds
diff --git a/compiler/src/dotty/tools/dotc/typer/Dynamic.scala b/compiler/src/dotty/tools/dotc/typer/Dynamic.scala
index 000cfd026..25fca546e 100644
--- a/compiler/src/dotty/tools/dotc/typer/Dynamic.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Dynamic.scala
@@ -150,7 +150,7 @@ trait Dynamic { self: Typer with Applications =>
|Structural types only support methods taking up to ${Definitions.MaxStructuralMethodArity} arguments""")
else {
def issueError(msgFn: String => String): Unit = ctx.error(msgFn(""), tree.pos)
- val ctags = tpe.paramTypes.map(pt =>
+ val ctags = tpe.paramInfos.map(pt =>
inferImplicitArg(defn.ClassTagType.appliedTo(pt :: Nil), issueError, tree.pos.endPos))
structuralCall(nme.selectDynamicMethod, ctags).asInstance(tpe.toFunctionType())
}
diff --git a/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala b/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala
index 00e393f7b..ff998e233 100644
--- a/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala
+++ b/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala
@@ -107,7 +107,7 @@ object ErrorReporting {
case tp: PolyType =>
tp.derivedPolyType(resType = dropJavaMethod(tp.resultType))
case tp: JavaMethodType =>
- MethodType(tp.paramNames, tp.paramTypes, dropJavaMethod(tp.resultType))
+ MethodType(tp.paramNames, tp.paramInfos, dropJavaMethod(tp.resultType))
case tp => tp
}
val found1 = dropJavaMethod(found)
diff --git a/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala b/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala
index 57c1808c9..5aee0fd54 100644
--- a/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala
+++ b/compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala
@@ -60,7 +60,7 @@ object EtaExpansion {
def liftArgs(defs: mutable.ListBuffer[Tree], methRef: Type, args: List[Tree])(implicit ctx: Context) =
methRef.widen match {
case mt: MethodType =>
- (args, mt.paramNames, mt.paramTypes).zipped map { (arg, name, tp) =>
+ (args, mt.paramNames, mt.paramInfos).zipped map { (arg, name, tp) =>
if (tp.isInstanceOf[ExprType]) arg
else liftArg(defs, arg, if (name contains '$') "" else name.toString + "$")
}
@@ -135,12 +135,12 @@ object EtaExpansion {
val defs = new mutable.ListBuffer[tpd.Tree]
val lifted: Tree = TypedSplice(liftApp(defs, tree))
val paramTypes: List[Tree] =
- if (mt.paramTypes.length == xarity) mt.paramTypes map (_ => TypeTree())
- else mt.paramTypes map TypeTree
+ if (mt.paramInfos.length == xarity) mt.paramInfos map (_ => TypeTree())
+ else mt.paramInfos map TypeTree
val params = (mt.paramNames, paramTypes).zipped.map((name, tpe) =>
ValDef(name, tpe, EmptyTree).withFlags(Synthetic | Param).withPos(tree.pos))
var ids: List[Tree] = mt.paramNames map (name => Ident(name).withPos(tree.pos))
- if (mt.paramTypes.nonEmpty && mt.paramTypes.last.isRepeatedParam)
+ if (mt.paramInfos.nonEmpty && mt.paramInfos.last.isRepeatedParam)
ids = ids.init :+ repeated(ids.last)
var body: Tree = Apply(lifted, ids)
mt.resultType match {
diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala
index 681045cc4..af2145376 100644
--- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala
@@ -66,16 +66,16 @@ object Implicits {
def discardForView(tpw: Type, argType: Type): Boolean = tpw match {
case mt: MethodType =>
mt.isImplicit ||
- mt.paramTypes.length != 1 ||
- !(argType relaxed_<:< mt.paramTypes.head)(ctx.fresh.setExploreTyperState)
+ mt.paramInfos.length != 1 ||
+ !(argType relaxed_<:< mt.paramInfos.head)(ctx.fresh.setExploreTyperState)
case poly: PolyType =>
// We do not need to call ProtoTypes#constrained on `poly` because
// `refMatches` is always called with mode TypevarsMissContext enabled.
poly.resultType match {
case mt: MethodType =>
mt.isImplicit ||
- mt.paramTypes.length != 1 ||
- !(argType relaxed_<:< wildApprox(mt.paramTypes.head, null, Set.empty)(ctx.fresh.setExploreTyperState))
+ mt.paramInfos.length != 1 ||
+ !(argType relaxed_<:< wildApprox(mt.paramInfos.head, null, Set.empty)(ctx.fresh.setExploreTyperState))
case rtp =>
discardForView(wildApprox(rtp, null, Set.empty), argType)
}
diff --git a/compiler/src/dotty/tools/dotc/typer/Inferencing.scala b/compiler/src/dotty/tools/dotc/typer/Inferencing.scala
index 86649d78e..20efd4083 100644
--- a/compiler/src/dotty/tools/dotc/typer/Inferencing.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Inferencing.scala
@@ -157,7 +157,7 @@ object Inferencing {
case Apply(fn, _) =>
fn.tpe.widen match {
case mtp: MethodType =>
- val (occ, nocc) = toTest.partition(tvar => mtp.paramTypes.exists(tvar.occursIn))
+ val (occ, nocc) = toTest.partition(tvar => mtp.paramInfos.exists(tvar.occursIn))
occurring(fn, nocc, occ ::: acc)
case _ =>
occurring(fn, toTest, acc)
@@ -178,7 +178,7 @@ object Inferencing {
*/
private def instDirection(param: PolyParam)(implicit ctx: Context): Int = {
val constrained = ctx.typerState.constraint.fullBounds(param)
- val original = param.binder.paramBounds(param.paramNum)
+ val original = param.binder.paramInfos(param.paramNum)
val cmp = ctx.typeComparer
val approxBelow =
if (!cmp.isSubTypeWhenFrozen(constrained.lo, original.lo)) 1 else 0
diff --git a/compiler/src/dotty/tools/dotc/typer/Inliner.scala b/compiler/src/dotty/tools/dotc/typer/Inliner.scala
index 6e90367c8..8520dcdfc 100644
--- a/compiler/src/dotty/tools/dotc/typer/Inliner.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Inliner.scala
@@ -108,7 +108,7 @@ object Inliner {
// Add qualifier type as leading method argument to argument `tp`
def addQualType(tp: Type): Type = tp match {
- case tp: PolyType => tp.derivedPolyType(tp.paramNames, tp.paramBounds, addQualType(tp.resultType))
+ case tp: PolyType => tp.derivedPolyType(tp.paramNames, tp.paramInfos, addQualType(tp.resultType))
case tp: ExprType => addQualType(tp.resultType)
case tp => MethodType(qualType :: Nil, tp)
}
@@ -327,7 +327,7 @@ class Inliner(call: tpd.Tree, rhs: tpd.Tree)(implicit ctx: Context) {
}
computeParamBindings(tp.resultType, Nil, argss)
case tp: MethodType =>
- (tp.paramNames, tp.paramTypes, argss.head).zipped.foreach { (name, paramtp, arg) =>
+ (tp.paramNames, tp.paramInfos, argss.head).zipped.foreach { (name, paramtp, arg) =>
def isByName = paramtp.dealias.isInstanceOf[ExprType]
paramBinding(name) = arg.tpe.stripAnnots.stripTypeVar match {
case argtpe: SingletonType if isIdempotentExpr(arg) => argtpe
diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala
index ed580c631..3c00d6598 100644
--- a/compiler/src/dotty/tools/dotc/typer/Namer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala
@@ -1032,7 +1032,7 @@ class Namer { typer: Typer =>
}
val defaultAlts = meth.altsWith(_.hasDefaultParams)
if (defaultAlts.length == 1)
- paramProto(defaultAlts.head.info.widen.paramTypess, idx)
+ paramProto(defaultAlts.head.info.widen.paramInfoss, idx)
else
WildcardType
}
diff --git a/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala b/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala
index 3f935a8dc..7406d1786 100644
--- a/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala
+++ b/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala
@@ -389,7 +389,7 @@ object ProtoTypes {
}
val added =
- if (state.constraint contains pt) pt.newLikeThis(pt.paramNames, pt.paramBounds, pt.resultType)
+ if (state.constraint contains pt) pt.newLikeThis(pt.paramNames, pt.paramInfos, pt.resultType)
else pt
val tvars = if (owningTree.isEmpty) Nil else newTypeVars(added)
ctx.typeComparer.addToConstraint(added, tvars.tpes.asInstanceOf[List[TypeVar]])
@@ -415,7 +415,7 @@ object ProtoTypes {
if (mt.isDependent) {
def replacement(tp: Type) =
if (ctx.mode.is(Mode.TypevarsMissContext)) WildcardType else newDepPolyParam(tp)
- mt.resultType.substParams(mt, mt.paramTypes.map(replacement))
+ mt.resultType.substParams(mt, mt.paramInfos.map(replacement))
}
else mt.resultType
@@ -444,10 +444,10 @@ object ProtoTypes {
val rt = normalize(mt.resultType, pt)
pt match {
case pt: IgnoredProto => mt
- case pt: ApplyingProto => mt.derivedMethodType(mt.paramNames, mt.paramTypes, rt)
+ case pt: ApplyingProto => mt.derivedMethodType(mt.paramNames, mt.paramInfos, rt)
case _ =>
- val ft = defn.FunctionOf(mt.paramTypes, rt)
- if (mt.paramTypes.nonEmpty || ft <:< pt) ft else rt
+ val ft = defn.FunctionOf(mt.paramInfos, rt)
+ if (mt.paramInfos.nonEmpty || ft <:< pt) ft else rt
}
}
case et: ExprType => et.resultType
@@ -475,7 +475,7 @@ object ProtoTypes {
WildcardType(wildApprox(bounds, theMap, seen).bounds)
else if (seen.contains(tp)) WildcardType
else WildcardType(wildApprox(bounds, theMap, seen + tp).bounds)
- def unconstrainedApprox = wildApproxBounds(poly.paramBounds(pnum))
+ def unconstrainedApprox = wildApproxBounds(poly.paramInfos(pnum))
def approxPoly =
if (ctx.mode.is(Mode.TypevarsMissContext)) unconstrainedApprox
else
@@ -486,7 +486,7 @@ object ProtoTypes {
}
approxPoly
case ParamRef(mt, pnum) =>
- WildcardType(TypeBounds.upper(wildApprox(mt.paramTypes(pnum), theMap, seen)))
+ WildcardType(TypeBounds.upper(wildApprox(mt.paramInfos(pnum), theMap, seen)))
case tp: TypeVar =>
wildApprox(tp.underlying, theMap, seen)
case tp @ HKApply(tycon, args) =>
diff --git a/compiler/src/dotty/tools/dotc/typer/ReTyper.scala b/compiler/src/dotty/tools/dotc/typer/ReTyper.scala
index 6080c6644..73e676b57 100644
--- a/compiler/src/dotty/tools/dotc/typer/ReTyper.scala
+++ b/compiler/src/dotty/tools/dotc/typer/ReTyper.scala
@@ -86,7 +86,7 @@ class ReTyper extends Typer {
override def handleUnexpectedFunType(tree: untpd.Apply, fun: Tree)(implicit ctx: Context): Tree = fun.tpe match {
case mt: MethodType =>
- val args: List[Tree] = tree.args.zipWithConserve(mt.paramTypes)(typedExpr(_, _)).asInstanceOf[List[Tree]]
+ val args: List[Tree] = tree.args.zipWithConserve(mt.paramInfos)(typedExpr(_, _)).asInstanceOf[List[Tree]]
assignType(untpd.cpy.Apply(tree)(fun, args), fun, args)
case _ =>
super.handleUnexpectedFunType(tree, fun)
diff --git a/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala b/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala
index 93a534f6b..717429848 100644
--- a/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala
+++ b/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala
@@ -318,9 +318,9 @@ trait TypeAssigner {
def assignType(tree: untpd.Apply, fn: Tree, args: List[Tree])(implicit ctx: Context) = {
val ownType = fn.tpe.widen match {
case fntpe: MethodType =>
- if (sameLength(fntpe.paramTypes, args) || ctx.phase.prev.relaxedTyping) fntpe.instantiate(args.tpes)
+ if (sameLength(fntpe.paramInfos, args) || ctx.phase.prev.relaxedTyping) fntpe.instantiate(args.tpes)
else
- errorType(i"wrong number of arguments for $fntpe: ${fn.tpe}, expected: ${fntpe.paramTypes.length}, found: ${args.length}", tree.pos)
+ errorType(i"wrong number of arguments for $fntpe: ${fn.tpe}, expected: ${fntpe.paramInfos.length}, found: ${args.length}", tree.pos)
case t =>
errorType(i"${err.exprStr(fn)} does not take parameters", tree.pos)
}
@@ -368,7 +368,7 @@ trait TypeAssigner {
val gaps = gapBuf.toList
pt.derivedPolyType(
gaps.map(paramNames),
- gaps.map(idx => transform(pt.paramBounds(idx)).bounds),
+ gaps.map(idx => transform(pt.paramInfos(idx)).bounds),
resultType1)
}
}
diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala
index 68ff7579f..5e845a807 100644
--- a/compiler/src/dotty/tools/dotc/typer/Typer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala
@@ -741,8 +741,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
calleeType.widen match {
case mtpe: MethodType =>
val pos = params indexWhere (_.name == param.name)
- if (pos < mtpe.paramTypes.length) {
- val ptype = mtpe.paramTypes(pos)
+ if (pos < mtpe.paramInfos.length) {
+ val ptype = mtpe.paramInfos(pos)
if (isFullyDefined(ptype, ForceDegree.noBottom)) return ptype
}
case _ =>
@@ -1809,12 +1809,12 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
errorTree(tree,
em"""none of the ${err.overloadedAltsStr(altDenots)}
|match $expectedStr""")
- def hasEmptyParams(denot: SingleDenotation) = denot.info.paramTypess == ListOfNil
+ def hasEmptyParams(denot: SingleDenotation) = denot.info.paramInfoss == ListOfNil
pt match {
case pt: FunProto =>
tryInsertApplyOrImplicit(tree, pt)(noMatches)
case _ =>
- if (altDenots exists (_.info.paramTypess == ListOfNil))
+ if (altDenots exists (_.info.paramInfoss == ListOfNil))
typed(untpd.Apply(untpd.TypedSplice(tree), Nil), pt)
else
noMatches
@@ -1886,7 +1886,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
adaptInterpolated(tree.withType(wtp.resultType), pt, original)
case wtp: ImplicitMethodType if constrainResult(wtp, followAlias(pt)) =>
val tvarsToInstantiate = tvarsInParams(tree)
- wtp.paramTypes.foreach(instantiateSelected(_, tvarsToInstantiate))
+ wtp.paramInfos.foreach(instantiateSelected(_, tvarsToInstantiate))
val constr = ctx.typerState.constraint
def addImplicitArgs(implicit ctx: Context) = {
val errors = new mutable.ListBuffer[() => String]
@@ -1898,7 +1898,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
for (err <- errors) ctx.error(err(), tree.pos.endPos)
tree.withType(wtp.resultType)
}
- val args = (wtp.paramNames, wtp.paramTypes).zipped map { (pname, formal) =>
+ val args = (wtp.paramNames, wtp.paramInfos).zipped map { (pname, formal) =>
def implicitArgError(msg: String => String) =
errors += (() => msg(em"parameter $pname of $methodStr"))
if (errors.nonEmpty) EmptyTree
@@ -1941,11 +1941,11 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
// prioritize method parameter types as parameter types of the eta-expanded closure
0
else defn.functionArity(pt)
- else if (pt eq AnyFunctionProto) wtp.paramTypes.length
+ else if (pt eq AnyFunctionProto) wtp.paramInfos.length
else -1
if (arity >= 0 && !tree.symbol.isConstructor)
typed(etaExpand(tree, wtp, arity), pt)
- else if (wtp.paramTypes.isEmpty)
+ else if (wtp.paramInfos.isEmpty)
adaptInterpolated(tpd.Apply(tree, Nil), pt, EmptyTree)
else if (wtp.isImplicit)
err.typeMismatch(tree, pt)
diff --git a/compiler/src/dotty/tools/dotc/typer/Variances.scala b/compiler/src/dotty/tools/dotc/typer/Variances.scala
index c2a75ee0e..83ac23f7e 100644
--- a/compiler/src/dotty/tools/dotc/typer/Variances.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Variances.scala
@@ -80,7 +80,7 @@ object Variances {
case tp: RecType =>
varianceInType(tp.parent)(tparam)
case tp: MethodType =>
- flip(varianceInTypes(tp.paramTypes)(tparam)) & varianceInType(tp.resultType)(tparam)
+ flip(varianceInTypes(tp.paramInfos)(tparam)) & varianceInType(tp.resultType)(tparam)
case ExprType(restpe) =>
varianceInType(restpe)(tparam)
case tp @ HKApply(tycon, args) =>
@@ -95,7 +95,7 @@ object Variances {
}
varianceInArgs(varianceInType(tycon)(tparam), args, tycon.typeParams)
case tp: PolyType =>
- flip(varianceInTypes(tp.paramBounds)(tparam)) & varianceInType(tp.resultType)(tparam)
+ flip(varianceInTypes(tp.paramInfos)(tparam)) & varianceInType(tp.resultType)(tparam)
case AnnotatedType(tp, annot) =>
varianceInType(tp)(tparam) & varianceInAnnot(annot)(tparam)
case tp: AndOrType =>