aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/typer
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-03-16 15:15:28 +0100
committerMartin Odersky <odersky@gmail.com>2017-04-06 13:15:27 +0200
commitc024a6037f3dd7e7458d936566cd4b653b8b7545 (patch)
treeaae9b2e9b332fc166a04f1b29f1ff4e62fdd6216 /compiler/src/dotty/tools/dotc/typer
parent549bd812684e6f269610234ddefe8054dfb42746 (diff)
downloaddotty-c024a6037f3dd7e7458d936566cd4b653b8b7545.tar.gz
dotty-c024a6037f3dd7e7458d936566cd4b653b8b7545.tar.bz2
dotty-c024a6037f3dd7e7458d936566cd4b653b8b7545.zip
Break out functionality from MethodType
and generalize MethodParam to ParamRef, and TypeParamInfo to ParamInfo
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer')
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Applications.scala4
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Checking.scala4
-rw-r--r--compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Typer.scala4
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Variances.scala2
7 files changed, 10 insertions, 10 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Applications.scala b/compiler/src/dotty/tools/dotc/typer/Applications.scala
index 310121f31..f506abce8 100644
--- a/compiler/src/dotty/tools/dotc/typer/Applications.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Applications.scala
@@ -395,7 +395,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
def addTyped(arg: Arg, formal: Type): Type => Type = {
addArg(typedArg(arg, formal), formal)
if (methodType.isParamDependent)
- _.substParam(MethodParam(methodType, n), typeOfArg(arg))
+ _.substParam(methodType.newParamRef(n), typeOfArg(arg))
else
identity
}
@@ -1066,7 +1066,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
case _ => // (3)
tp2 match {
case tp2: MethodType => true // (3a)
- case tp2: PolyType if tp2.isPolymorphicMethodType => true // (3a)
+ case tp2: PolyType if tp2.resultType.isInstanceOf[MethodType] => true // (3a)
case tp2: PolyType => // (3b)
val nestedCtx = ctx.fresh.setExploreTyperState
diff --git a/compiler/src/dotty/tools/dotc/typer/Checking.scala b/compiler/src/dotty/tools/dotc/typer/Checking.scala
index 148ccd6e3..76cbbdc6d 100644
--- a/compiler/src/dotty/tools/dotc/typer/Checking.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Checking.scala
@@ -69,12 +69,12 @@ object Checking {
// If `args` is a list of named arguments, return corresponding type parameters,
// otherwise return type parameters unchanged
val tparams = tycon.tpe.typeParams
- def argNamed(tparam: TypeParamInfo) = args.find {
+ def argNamed(tparam: ParamInfo) = args.find {
case NamedArg(name, _) => name == tparam.paramName
case _ => false
}.getOrElse(TypeTree(tparam.paramRef))
val orderedArgs = if (hasNamedArg(args)) tparams.map(argNamed) else args
- val bounds = tparams.map(_.paramBoundsAsSeenFrom(tycon.tpe))
+ val bounds = tparams.map(_.paramInfoAsSeenFrom(tycon.tpe).bounds)
def instantiate(bound: Type, args: List[Type]) =
bound.LambdaAbstract(tparams).appliedTo(args)
checkBounds(orderedArgs, bounds, instantiate)
diff --git a/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala b/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala
index a1690955f..00e393f7b 100644
--- a/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala
+++ b/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala
@@ -46,7 +46,7 @@ object ErrorReporting {
errorMsg(ex.toMessage, ctx)
}
- def wrongNumberOfTypeArgs(fntpe: Type, expectedArgs: List[TypeParamInfo], actual: List[untpd.Tree], pos: Position)(implicit ctx: Context) =
+ def wrongNumberOfTypeArgs(fntpe: Type, expectedArgs: List[ParamInfo], actual: List[untpd.Tree], pos: Position)(implicit ctx: Context) =
errorType(WrongNumberOfTypeArgs(fntpe, expectedArgs, actual)(ctx), pos)
class Errors(implicit ctx: Context) {
diff --git a/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala b/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala
index d61e24261..3f935a8dc 100644
--- a/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala
+++ b/compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala
@@ -485,7 +485,7 @@ object ProtoTypes {
case inst => wildApprox(inst, theMap, seen)
}
approxPoly
- case MethodParam(mt, pnum) =>
+ case ParamRef(mt, pnum) =>
WildcardType(TypeBounds.upper(wildApprox(mt.paramTypes(pnum), theMap, seen)))
case tp: TypeVar =>
wildApprox(tp.underlying, theMap, seen)
diff --git a/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala b/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala
index 6d0fc08f9..93a534f6b 100644
--- a/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala
+++ b/compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala
@@ -106,7 +106,7 @@ trait TypeAssigner {
val base = apply(tycon)
var args = tp.baseArgInfos(base.typeSymbol)
if (base.typeParams.length != args.length)
- args = base.typeParams.map(_.paramBounds)
+ args = base.typeParams.map(_.paramInfo)
apply(base.appliedTo(args))
case tp @ RefinedType(parent, name, rinfo) if variance > 0 =>
val parent1 = apply(tp.parent)
diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala
index d4a9744e4..68ff7579f 100644
--- a/compiler/src/dotty/tools/dotc/typer/Typer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala
@@ -1074,10 +1074,10 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
wrongNumberOfTypeArgs(tpt1.tpe, tparams, args, tree.pos)
args = args.take(tparams.length)
}
- def typedArg(arg: untpd.Tree, tparam: TypeParamInfo) = {
+ def typedArg(arg: untpd.Tree, tparam: ParamInfo) = {
val (desugaredArg, argPt) =
if (ctx.mode is Mode.Pattern)
- (if (isVarPattern(arg)) desugar.patternVar(arg) else arg, tparam.paramBounds)
+ (if (isVarPattern(arg)) desugar.patternVar(arg) else arg, tparam.paramInfo)
else
(arg, WildcardType)
if (tpt1.symbol.isClass)
diff --git a/compiler/src/dotty/tools/dotc/typer/Variances.scala b/compiler/src/dotty/tools/dotc/typer/Variances.scala
index 5a1745930..c2a75ee0e 100644
--- a/compiler/src/dotty/tools/dotc/typer/Variances.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Variances.scala
@@ -84,7 +84,7 @@ object Variances {
case ExprType(restpe) =>
varianceInType(restpe)(tparam)
case tp @ HKApply(tycon, args) =>
- def varianceInArgs(v: Variance, args: List[Type], tparams: List[TypeParamInfo]): Variance =
+ def varianceInArgs(v: Variance, args: List[Type], tparams: List[ParamInfo]): Variance =
args match {
case arg :: args1 =>
varianceInArgs(