summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/TypeStacks.scala3
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala15
-rw-r--r--src/compiler/scala/tools/nsc/dependencies/Changes.scala10
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala88
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala12
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala8
-rw-r--r--src/compiler/scala/tools/nsc/transform/LazyVals.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Implicits.scala6
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala22
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala2
11 files changed, 84 insertions, 88 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/TypeStacks.scala b/src/compiler/scala/tools/nsc/backend/icode/TypeStacks.scala
index 1e943529b2..6872f56c39 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/TypeStacks.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/TypeStacks.scala
@@ -76,8 +76,7 @@ trait TypeStacks { self: ICodes =>
* types agree if one is a subtype of the other.
*/
def agreesWith(other: TypeStack): Boolean =
- (types.length == other.types.length) &&
- ((types, other.types).zipped forall ((t1, t2) => t1 <:< t2 || t2 <:< t1))
+ (types corresponds other.types)((t1, t2) => t1 <:< t2 || t2 <:< t1)
/* This method returns a String representation of the stack */
override def toString() = types.mkString("\n", "\n", "\n")
diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala
index 5ba5f684f7..b0fef79fa4 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala
@@ -58,18 +58,13 @@ abstract class CopyPropagation {
class State(val bindings: Bindings, var stack: List[Value]) {
override def equals(that: Any): Boolean =
- (this eq that.asInstanceOf[AnyRef]) ||
- that.isInstanceOf[State] && {
- val other = that.asInstanceOf[State]
-
+ (this eq that.asInstanceOf[AnyRef]) || (that match {
/* comparison with bottom is reference equality! */
- if ((other eq bottom) || (this eq bottom))
- (this eq other)
- else {
+ case other: State if (this ne bottom) && (other ne bottom) =>
(this.bindings == other.bindings) &&
- ((this.stack, other.stack).zipped forall (_ == _))
- }
- }
+ (this.stack corresponds other.stack)(_ == _) // @PP: corresponds
+ case _ => false
+ })
/* Return an alias for the given local. It returns the last
* local in the chain of aliased locals. Cycles are not allowed
diff --git a/src/compiler/scala/tools/nsc/dependencies/Changes.scala b/src/compiler/scala/tools/nsc/dependencies/Changes.scala
index 43efd0726b..530519b148 100644
--- a/src/compiler/scala/tools/nsc/dependencies/Changes.scala
+++ b/src/compiler/scala/tools/nsc/dependencies/Changes.scala
@@ -88,13 +88,12 @@ abstract class Changes {
}
sameTypes(parents1, parents2) && isSubScope(ref1, ref2) && isSubScope(ref2, ref1)
- case (MethodType(params1, res1), MethodType(params2, res2)) =>
+ case (mt1 @ MethodType(params1, res1), mt2 @ MethodType(params2, res2)) =>
// new dependent types: probably fix this, use substSym as done for PolyType
(sameTypes(tp1.paramTypes, tp2.paramTypes) &&
- ((tp1.params, tp2.params).zipped forall ((t1, t2) =>
- (sameSymbol(t1, t2) && sameFlags(t1, t2)))) &&
+ (tp1.params corresponds tp2.params)((t1, t2) => sameSymbol(t1, t2) && sameFlags(t1, t2)) && // @PP: corresponds
sameType(res1, res2) &&
- tp1.isInstanceOf[ImplicitMethodType] == tp2.isInstanceOf[ImplicitMethodType])
+ mt1.isImplicit == mt2.isImplicit)
case (PolyType(tparams1, res1), PolyType(tparams2, res2)) =>
sameTypeParams(tparams1, tparams2) && sameType(res1, res2)
@@ -136,8 +135,7 @@ abstract class Changes {
sameTypes(tparams1 map (_.info), tparams2 map (_.info)) &&
sameTypes(tparams1 map (_.tpe), tparams2 map (_.tpe))
- def sameTypes(tps1: List[Type], tps2: List[Type]): Boolean =
- (tps1.length == tps2.length) && ((tps1, tps2).zipped forall sameType)
+ def sameTypes(tps1: List[Type], tps2: List[Type]) = (tps1 corresponds tps2)(sameType)
/** Return the list of changes between 'from' and 'toSym.info'.
*/
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index c1f4115a88..aa2ab5e572 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -1824,6 +1824,13 @@ A type's typeSymbol should never be inspected directly.
override val isTrivial: Boolean =
params.forall(_.tpe.isTrivial) && resultType.isTrivial
+ // The comment at ImplicitMethodType says the class is no longer needed,
+ // "a method type is implicit if the first parameter has the IMPLICIT flag".
+ // Should that change be pursued, then this method should be:
+ // def isImplicit = vparams.nonEmpty && (vparams.head hasFlag IMPLICIT)
+ def isImplicit = false
+ def isJava = false
+
//assert(paramTypes forall (pt => !pt.typeSymbol.isImplClass))//DEBUG
override def paramSectionCount: Int = resultType.paramSectionCount + 1
@@ -1868,9 +1875,13 @@ A type's typeSymbol should never be inspected directly.
// todo: this class is no longer needed, a method type is implicit if the first
// parameter has the IMPLICIT flag
- class ImplicitMethodType(ps: List[Symbol], rt: Type) extends MethodType(ps, rt)
+ class ImplicitMethodType(ps: List[Symbol], rt: Type) extends MethodType(ps, rt) {
+ override def isImplicit = true
+ }
- class JavaMethodType(ps: List[Symbol], rt: Type) extends MethodType(ps, rt)
+ class JavaMethodType(ps: List[Symbol], rt: Type) extends MethodType(ps, rt) {
+ override def isJava = true
+ }
/** A class representing a polymorphic type or, if tparams.length == 0,
* a parameterless method type.
@@ -3856,18 +3867,14 @@ A type's typeSymbol should never be inspected directly.
// new dependent types: probably fix this, use substSym as done for PolyType
(isSameTypes(tp1.paramTypes, tp2.paramTypes) &&
res1 =:= res2 &&
- tp1.isInstanceOf[ImplicitMethodType] == tp2.isInstanceOf[ImplicitMethodType])
+ tp1.isImplicit == tp2.isImplicit)
case (PolyType(tparams1, res1), PolyType(tparams2, res2)) =>
-// assert((tparams1 map (_.typeParams.length)) == (tparams2 map (_.typeParams.length)))
- (tparams1.length == tparams2.length &&
- (tparams1, tparams2).zipped.forall
- ((p1, p2) => p1.info =:= p2.info.substSym(tparams2, tparams1)) && //@M looks like it might suffer from same problem as #2210
- res1 =:= res2.substSym(tparams2, tparams1))
+ // assert((tparams1 map (_.typeParams.length)) == (tparams2 map (_.typeParams.length)))
+ (tparams1 corresponds tparams2)(_.info =:= _.info.substSym(tparams2, tparams1)) && // @M looks like it might suffer from same problem as #2210
+ res1 =:= res2.substSym(tparams2, tparams1)
case (ExistentialType(tparams1, res1), ExistentialType(tparams2, res2)) =>
- (tparams1.length == tparams2.length &&
- (tparams1, tparams2).zipped.forall
- ((p1, p2) => p1.info =:= p2.info.substSym(tparams2, tparams1)) && //@M looks like it might suffer from same problem as #2210
- res1 =:= res2.substSym(tparams2, tparams1))
+ (tparams1 corresponds tparams2)(_.info =:= _.info.substSym(tparams2, tparams1)) && // @M looks like it might suffer from same problem as #2210
+ res1 =:= res2.substSym(tparams2, tparams1)
case (TypeBounds(lo1, hi1), TypeBounds(lo2, hi2)) =>
lo1 =:= lo2 && hi1 =:= hi2
case (BoundedWildcardType(bounds), _) =>
@@ -3981,26 +3988,28 @@ A type's typeSymbol should never be inspected directly.
// new dependent types: probably fix this, use substSym as done for PolyType
return isSameTypes(mt1.paramTypes, mt2.paramTypes) &&
mt1.resultType =:= mt2.resultType &&
- tp1.isInstanceOf[ImplicitMethodType] == tp2.isInstanceOf[ImplicitMethodType]
+ mt1.isImplicit == mt2.isImplicit
case _ =>
}
case PolyType(tparams1, res1) =>
tp2 match {
case PolyType(tparams2, res2) =>
// assert((tparams1 map (_.typeParams.length)) == (tparams2 map (_.typeParams.length)))
- return tparams1.length == tparams2.length &&
- (tparams1, tparams2).zipped.forall((p1, p2) =>
- p1.info =:= p2.info.substSym(tparams2, tparams1)) && //@M looks like it might suffer from same problem as #2210
- res1 =:= res2.substSym(tparams2, tparams1)
+ // @M looks like it might suffer from same problem as #2210
+ return (
+ (tparams1 corresponds tparams2)(_.info =:= _.info.substSym(tparams2, tparams1)) &&
+ res1 =:= res2.substSym(tparams2, tparams1)
+ )
case _ =>
}
case ExistentialType(tparams1, res1) =>
tp2 match {
case ExistentialType(tparams2, res2) =>
- return (tparams1.length == tparams2.length &&
- (tparams1, tparams2).zipped.forall
- ((p1, p2) => p1.info =:= p2.info.substSym(tparams2, tparams1)) && //@M looks like it might suffer from same problem as #2210
- res1 =:= res2.substSym(tparams2, tparams1))
+ // @M looks like it might suffer from same problem as #2210
+ return (
+ (tparams1 corresponds tparams2)(_.info =:= _.info.substSym(tparams2, tparams1)) &&
+ res1 =:= res2.substSym(tparams2, tparams1)
+ )
case _ =>
}
case TypeBounds(lo1, hi1) =>
@@ -4064,8 +4073,7 @@ A type's typeSymbol should never be inspected directly.
/** Are `tps1' and `tps2' lists of pairwise equivalent
* types?
*/
- def isSameTypes(tps1: List[Type], tps2: List[Type]): Boolean =
- tps1.length == tps2.length && ((tps1, tps2).zipped forall (_ =:= _))
+ def isSameTypes(tps1: List[Type], tps2: List[Type]): Boolean = (tps1 corresponds tps2)(_ =:= _)
private var pendingSubTypes = new collection.mutable.HashSet[SubTypePair]
private var basetypeRecursions: Int = 0
@@ -4145,18 +4153,17 @@ A type's typeSymbol should never be inspected directly.
((tp1.normalize, tp2.normalize) match {
case (PolyType(tparams1, res1), PolyType(tparams2, res2)) => // @assume tp1.isHigherKinded && tp2.isHigherKinded (as they were both normalized to PolyType)
tparams1.length == tparams2.length && {
- if(tparams1.isEmpty) res1 <:< res2 // fast-path: monomorphic nullary method type
- else if(tparams1.head.owner.isMethod) { // fast-path: polymorphic method type -- type params cannot be captured
- ((tparams1, tparams2).zipped forall ((p1, p2) =>
- p2.info.substSym(tparams2, tparams1) <:< p1.info)) &&
+ if (tparams1.isEmpty) res1 <:< res2 // fast-path: monomorphic nullary method type
+ else if (tparams1.head.owner.isMethod) { // fast-path: polymorphic method type -- type params cannot be captured
+ (tparams1 corresponds tparams2)((p1, p2) => p2.info.substSym(tparams2, tparams1) <:< p1.info) &&
res1 <:< res2.substSym(tparams2, tparams1)
} else { // normalized higher-kinded type
//@M for an example of why we need to generate fresh symbols, see neg/tcpoly_ticket2101.scala
val tpsFresh = cloneSymbols(tparams1) // @M cloneSymbols(tparams2) should be equivalent -- TODO: check
- ((tparams1, tparams2).zipped forall ((p1, p2) =>
- p2.info.substSym(tparams2, tpsFresh) <:< p1.info.substSym(tparams1, tpsFresh))) &&
- res1.substSym(tparams1, tpsFresh) <:< res2.substSym(tparams2, tpsFresh)
+ (tparams1 corresponds tparams2)((p1, p2) =>
+ p2.info.substSym(tparams2, tpsFresh) <:< p1.info.substSym(tparams1, tpsFresh)) && // @PP: corresponds
+ res1.substSym(tparams1, tpsFresh) <:< res2.substSym(tparams2, tpsFresh)
//@M the forall in the previous test could be optimised to the following,
// but not worth the extra complexity since it only shaves 1s from quick.comp
@@ -4306,13 +4313,13 @@ A type's typeSymbol should never be inspected directly.
tp1.isNotNull && tp1 <:< nn2.underlying
case mt2: MethodType =>
tp1 match {
- case MethodType(params1, res1) =>
+ case mt1 @ MethodType(params1, res1) =>
val params2 = mt2.params
val res2 = mt2.resultType
(params1.length == params2.length &&
- matchingParams(params1, params2, tp1.isInstanceOf[JavaMethodType], tp2.isInstanceOf[JavaMethodType]) &&
+ matchingParams(params1, params2, mt1.isJava, mt2.isJava) &&
(res1 <:< res2) &&
- tp1.isInstanceOf[ImplicitMethodType] == tp2.isInstanceOf[ImplicitMethodType])
+ mt1.isImplicit == mt2.isImplicit)
case _ =>
false
}
@@ -4382,8 +4389,7 @@ A type's typeSymbol should never be inspected directly.
* that all elements of `tps1' conform to corresponding elements
* of `tps2'?
*/
- def isSubTypes(tps1: List[Type], tps2: List[Type]): Boolean =
- tps1.length == tps2.length && ((tps1, tps2).zipped forall (_ <:< _))
+ def isSubTypes(tps1: List[Type], tps2: List[Type]): Boolean = (tps1 corresponds tps2)(_ <:< _)
/** Does type `tp' implement symbol `sym' with same or
* stronger type? Exact only if `sym' is a member of some
@@ -4424,13 +4430,13 @@ A type's typeSymbol should never be inspected directly.
alwaysMatchSimple || tp1 =:= tp2
}
tp1 match {
- case MethodType(params1, res1) =>
+ case mt1 @ MethodType(params1, res1) =>
tp2 match {
- case MethodType(params2, res2) =>
- params1.length == params2.length && // useful pre-secreening optimization
- matchingParams(params1, params2, tp1.isInstanceOf[JavaMethodType], tp2.isInstanceOf[JavaMethodType]) &&
+ case mt2 @ MethodType(params2, res2) =>
+ params1.length == params2.length && // useful pre-screening optimization
+ matchingParams(params1, params2, mt1.isJava, mt2.isJava) &&
matchesType(res1, res2, alwaysMatchSimple) &&
- tp1.isInstanceOf[ImplicitMethodType] == tp2.isInstanceOf[ImplicitMethodType]
+ mt1.isImplicit == mt2.isImplicit
case PolyType(List(), res2) =>
if (params1.isEmpty) matchesType(res1, res2, alwaysMatchSimple)
else matchesType(tp1, res2, alwaysMatchSimple)
@@ -4616,7 +4622,7 @@ A type's typeSymbol should never be inspected directly.
*/
def isWithinBounds(pre: Type, owner: Symbol, tparams: List[Symbol], targs: List[Type]): Boolean = {
val bounds = instantiatedBounds(pre, owner, tparams, targs)
- (bounds, targs).zipped forall (_ containsType _)
+ (bounds corresponds targs)(_ containsType _) // @PP: corresponds
}
def instantiatedBounds(pre: Type, owner: Symbol, tparams: List[Symbol], targs: List[Type]): List[TypeBounds] =
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
index c75c9982de..6011d68a6f 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
@@ -145,17 +145,15 @@ abstract class ICodeReader extends ClassfileParser {
}
/** Checks if tp1 is the same type as tp2, modulo implict methods.
- * We don't care about the distinction between implcit and explicit
+ * We don't care about the distinction between implicit and explicit
* methods as this point, and we can't get back the information from
* bytecode anyway.
*/
private def sameType(tp1: Type, tp2: Type): Boolean = (tp1, tp2) match {
- case (MethodType(args1, resTpe1), MethodType(args2, resTpe2)) =>
- if (tp1.isInstanceOf[ImplicitMethodType] || tp2.isInstanceOf[ImplicitMethodType]) {
- MethodType(args1, resTpe1) =:= MethodType(args2, resTpe2)
- } else
- tp1 =:= tp2
- case _ => tp1 =:= tp2
+ case (mt1 @ MethodType(args1, resTpe1), mt2 @ MethodType(args2, resTpe2)) if mt1.isImplicit || mt2.isImplicit =>
+ MethodType(args1, resTpe1) =:= MethodType(args2, resTpe2)
+ case _ =>
+ tp1 =:= tp2
}
override def parseMethod() {
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
index e080df9210..fd4c7ab99f 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
@@ -586,9 +586,9 @@ abstract class Pickler extends SubComponent {
writeRef(tp.typeSymbol); writeRefs(parents); REFINEDtpe
case ClassInfoType(parents, decls, clazz) =>
writeRef(clazz); writeRefs(parents); CLASSINFOtpe
- case MethodType(formals, restpe) =>
+ case mt @ MethodType(formals, restpe) =>
writeRef(restpe); writeRefs(formals)
- if (entry.isInstanceOf[ImplicitMethodType]) IMPLICITMETHODtpe
+ if (mt.isImplicit) IMPLICITMETHODtpe
else METHODtpe
case PolyType(tparams, restpe) =>
writeRef(restpe); writeRefs(tparams); POLYtpe
@@ -1037,8 +1037,8 @@ abstract class Pickler extends SubComponent {
print("REFINEDtpe "); printRef(tp.typeSymbol); printRefs(parents);
case ClassInfoType(parents, decls, clazz) =>
print("CLASSINFOtpe "); printRef(clazz); printRefs(parents);
- case MethodType(formals, restpe) =>
- print(if (entry.isInstanceOf[ImplicitMethodType]) "IMPLICITMETHODtpe " else "METHODtpe ");
+ case mt @ MethodType(formals, restpe) =>
+ print(if (mt.isImplicit) "IMPLICITMETHODtpe " else "METHODtpe ");
printRef(restpe); printRefs(formals)
case PolyType(tparams, restpe) =>
print("POLYtpe "); printRef(restpe); printRefs(tparams);
diff --git a/src/compiler/scala/tools/nsc/transform/LazyVals.scala b/src/compiler/scala/tools/nsc/transform/LazyVals.scala
index 03339163a1..23dda60f87 100644
--- a/src/compiler/scala/tools/nsc/transform/LazyVals.scala
+++ b/src/compiler/scala/tools/nsc/transform/LazyVals.scala
@@ -95,13 +95,11 @@ abstract class LazyVals extends Transform with ast.TreeDSL {
val bmps = bitmaps(methSym) map (ValDef(_, ZERO))
- // Martin to Iulian: Don't we need to compare lengths here?
- def isMatch(params: List[Ident]) = (params.tail, methSym.tpe.params).zipped forall (_.tpe == _.tpe)
+ def isMatch(params: List[Ident]) = (params.tail corresponds methSym.tpe.params)(_.tpe == _.tpe) // @PP: corresponds
if (bmps.isEmpty) rhs else rhs match {
case Block(assign, l @ LabelDef(name, params, rhs1))
if name.toString == ("_" + methSym.name) && isMatch(params) =>
- val sym = l.symbol
Block(assign, treeCopy.LabelDef(l, name, params, typed(prependStats(bmps, rhs1))))
case _ => prependStats(bmps, rhs)
diff --git a/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala b/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala
index 586c21a31d..ee267690f1 100644
--- a/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/EtaExpansion.scala
@@ -26,7 +26,7 @@ trait EtaExpansion { self: Analyzer =>
}
def unapply(tree: Tree): Option[(List[ValDef], Tree, List[Tree])] = tree match {
- case Function(vparams, Apply(fn, args)) if (vparams, args).zipped forall isMatch =>
+ case Function(vparams, Apply(fn, args)) if (vparams corresponds args)(isMatch) => // @PP: corresponds
Some((vparams, fn, args))
case _ =>
None
diff --git a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
index c8e2afad3d..eb04ab984b 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Implicits.scala
@@ -387,9 +387,9 @@ self: Analyzer =>
result
}
- def matchesPtView(tp: Type, ptarg: Type, ptres: Type, undet: List[Symbol]): Boolean = tp match {
- case MethodType(params, restpe) =>
- if (tp.isInstanceOf[ImplicitMethodType]) matchesPtView(restpe, ptarg, ptres, undet)
+ def matchesPtView(tp: Type, ptarg: Type, ptres: Type, undet: List[Symbol]): Boolean = tp match {
+ case mt @ MethodType(params, restpe) =>
+ if (mt.isImplicit) matchesPtView(restpe, ptarg, ptres, undet)
else params.length == 1 && matchesArgRes(params.head.tpe, restpe, ptarg, ptres, undet)
case ExistentialType(tparams, qtpe) =>
matchesPtView(normalize(tp), ptarg, ptres, undet)
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index 4d1b3c83fe..bde84827b2 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -175,8 +175,10 @@ trait Infer {
tvars map instantiate
}
- def skipImplicit(tp: Type) =
- if (tp.isInstanceOf[ImplicitMethodType]) tp.resultType else tp
+ def skipImplicit(tp: Type) = tp match {
+ case mt: MethodType if mt.isImplicit => mt.resultType
+ case _ => tp
+ }
/** Automatically perform the following conversions on expression types:
* A method type becomes the corresponding function type.
@@ -185,8 +187,8 @@ trait Infer {
* This method seems to be performance critical.
*/
def normalize(tp: Type): Type = tp match {
- case MethodType(params, restpe) if (!restpe.isDependent) =>
- if (tp.isInstanceOf[ImplicitMethodType]) normalize(restpe)
+ case mt @ MethodType(params, restpe) if (!restpe.isDependent) =>
+ if (mt.isImplicit) normalize(restpe)
else functionType(params map (_.tpe), normalize(restpe))
case PolyType(List(), restpe) => // nullary method type
normalize(restpe)
@@ -401,8 +403,8 @@ trait Infer {
isPlausiblyCompatible(mt.resultType, pt)
case ExistentialType(tparams, qtpe) =>
isPlausiblyCompatible(qtpe, pt)
- case MethodType(params, restpe) =>
- if (tp.isInstanceOf[ImplicitMethodType]) isPlausiblyCompatible(restpe, pt)
+ case mt @ MethodType(params, restpe) =>
+ if (mt.isImplicit) isPlausiblyCompatible(restpe, pt)
else pt match {
case TypeRef(pre, sym, args) =>
if (sym.isAliasType) {
@@ -457,8 +459,8 @@ trait Infer {
}
final def normSubType(tp: Type, pt: Type): Boolean = tp match {
- case MethodType(params, restpe) =>
- if (tp.isInstanceOf[ImplicitMethodType]) normSubType(restpe, pt)
+ case mt @ MethodType(params, restpe) =>
+ if (mt.isImplicit) normSubType(restpe, pt)
else pt match {
case TypeRef(pre, sym, args) =>
if (sym.isAliasType) {
@@ -517,8 +519,8 @@ trait Infer {
def isCoercible(tp: Type, pt: Type): Boolean = false
- def isCompatibleArgs(tps: List[Type], pts: List[Type]): Boolean =
- (tps, pts).zipped forall isCompatibleArg
+ def isCompatibleArgs(tps: List[Type], pts: List[Type]) =
+ (tps corresponds pts)(isCompatibleArg) // @PP: corresponds
/* -- Type instantiation------------------------------------------------ */
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index 7b41c7b249..fcc5a3cbf4 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -903,7 +903,7 @@ abstract class RefChecks extends InfoTransform {
val clazz = pat.tpe.typeSymbol;
clazz == seltpe.typeSymbol &&
clazz.isClass && (clazz hasFlag CASE) &&
- ((args, clazz.primaryConstructor.tpe.asSeenFrom(seltpe, clazz).paramTypes).zipped forall isIrrefutable)
+ (args corresponds clazz.primaryConstructor.tpe.asSeenFrom(seltpe, clazz).paramTypes)(isIrrefutable) // @PP: corresponds
case Typed(pat, tpt) =>
seltpe <:< tpt.tpe
case Ident(nme.WILDCARD) =>