summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-01-17 16:37:24 +0100
committerJason Zaugg <jzaugg@gmail.com>2014-01-17 16:37:24 +0100
commitca05d22006dd528eae26c8ab4d6ca0a4f27fb69f (patch)
tree3f62a3a92102fe9538d558b1ca9722721502714d /src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
parenta5b0fc49e517d1c63d22f9909ac9bed0552ed466 (diff)
downloadscala-ca05d22006dd528eae26c8ab4d6ca0a4f27fb69f.tar.gz
scala-ca05d22006dd528eae26c8ab4d6ca0a4f27fb69f.tar.bz2
scala-ca05d22006dd528eae26c8ab4d6ca0a4f27fb69f.zip
SI-8157 Make overloading, defaults restriction PolyType aware
Named/Default args levies an implementation restriction that only one overloaded alternative may declare defaults. But, this restriction failed to consider polymorphic methods. Rather than matching on MethodType, this commit uses `Type#paramms`, which handles PolyTypes and curried MethodTypes in one fell swoop.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/RefChecks.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index 95f2620061..4ba8d56da0 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -132,11 +132,7 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans
defaultMethodNames.toList.distinct foreach { name =>
val methods = clazz.info.findMember(name, 0L, requiredFlags = METHOD, stableOnly = false).alternatives
- def hasDefaultParam(tpe: Type): Boolean = tpe match {
- case MethodType(params, restpe) => (params exists (_.hasDefault)) || hasDefaultParam(restpe)
- case _ => false
- }
- val haveDefaults = methods filter (sym => hasDefaultParam(sym.info) && !nme.isProtectedAccessorName(sym.name))
+ val haveDefaults = methods filter (sym => mexists(sym.info.paramss)(_.hasDefault) && !nme.isProtectedAccessorName(sym.name))
if (haveDefaults.lengthCompare(1) > 0) {
val owners = haveDefaults map (_.owner)