diff options
author | Antonio Cunei <antonio.cunei@epfl.ch> | 2009-11-09 20:34:09 +0000 |
---|---|---|
committer | Antonio Cunei <antonio.cunei@epfl.ch> | 2009-11-09 20:34:09 +0000 |
commit | 29d431ce89db67e079943eeaff322c60410cd713 (patch) | |
tree | 5a50d5cf201fc852af16b5edf59b9c7ddf7b2c8c /src/compiler | |
parent | cedd41ba4a14f7f1595057edfeca5437ef674bc3 (diff) | |
download | scala-29d431ce89db67e079943eeaff322c60410cd713.tar.gz scala-29d431ce89db67e079943eeaff322c60410cd713.tar.bz2 scala-29d431ce89db67e079943eeaff322c60410cd713.zip |
Reverted r19466, as the decision is now that
isDefinedAt should /not/ be in Function1
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/UnCurry.scala | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index 36ca4f399d..eec523a2b8 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -282,7 +282,7 @@ abstract class UnCurry extends InfoTransform with TypingTransformers { * class $anon() extends Object() with PartialFunction[T, R] with ScalaObject { * def apply(x: T): R = (x: @unchecked) match { * { case P_i if G_i => E_i }_i=1..n - * override def isDefinedAt(x: T): boolean = (x: @unchecked) match { + * def isDefinedAt(x: T): boolean = (x: @unchecked) match { * case P_1 if G_1 => true * ... * case P_n if G_n => true @@ -291,12 +291,9 @@ abstract class UnCurry extends InfoTransform with TypingTransformers { * } * new $anon() * - * However, if one of the patterns P_i if G_i is a default pattern, it should generate instead + * However, if one of the patterns P_i if G_i is a default pattern, generate instead * - * override def isDefinedAt(x: T): boolean = true - * - * which is the default in Function1 (and PartialFunction) anyway, so - * no overridden def is emitted. + * def isDefinedAt(x: T): boolean = true */ def transformFunction(fun: Function): Tree = { val fun1 = deEta(fun) @@ -338,7 +335,7 @@ abstract class UnCurry extends InfoTransform with TypingTransformers { } val members = { if (fun.tpe.typeSymbol == PartialFunctionClass) { - val isDefinedAtMethod = anonClass.newMethod(fun.pos, nme.isDefinedAt).setFlag(FINAL | OVERRIDE) + val isDefinedAtMethod = anonClass.newMethod(fun.pos, nme.isDefinedAt).setFlag(FINAL) isDefinedAtMethod.setInfo(MethodType(isDefinedAtMethod.newSyntheticValueParams(formals), BooleanClass.tpe)) anonClass.info.decls enter isDefinedAtMethod @@ -356,12 +353,8 @@ abstract class UnCurry extends InfoTransform with TypingTransformers { (cases map transformCase) ::: List(CaseDef(Ident(nme.WILDCARD), EmptyTree, Literal(false)))) } - val isDef=idbody(isDefinedAtMethod.paramss.head.head) - if (isDef == Literal(true)) - List(applyMethodDef(mkUnchecked(fun.body))) - else - List(applyMethodDef(mkUnchecked(fun.body)), - DefDef(isDefinedAtMethod, mkUnchecked(isDef))) + List(applyMethodDef(mkUnchecked(fun.body)), + DefDef(isDefinedAtMethod, mkUnchecked(idbody(isDefinedAtMethod.paramss.head.head)))) } else { List(applyMethodDef(fun.body)) } |