From 8871528f60958a45eb119a5cc487f87215e4e92f Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Fri, 11 Sep 2009 13:11:04 +0000 Subject: A bundle of small bugfixes to recent patches. --- src/compiler/scala/tools/nsc/symtab/Symbols.scala | 2 +- src/compiler/scala/tools/nsc/transform/UnCurry.scala | 6 ++---- src/library/scala/Option.scala | 7 +++++++ src/library/scala/Predef.scala | 1 - src/library/scala/xml/XML.scala | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala index 745782fbdf..885ff0d8ee 100644 --- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala +++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala @@ -447,7 +447,7 @@ trait Symbols { // since we default to enabled by default, only look hard for falsity annot.args match { case Literal(Constant(x: Int)) :: Nil => Some(x) - case x => println(x) ; None + case _ => None } } } diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala index 5d1f30d9b6..9f1897353e 100644 --- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala +++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala @@ -536,10 +536,8 @@ abstract class UnCurry extends InfoTransform with TypingTransformers { // XXX settings.noassertions.value temporarily retained to avoid // breakage until a reasonable interface is settled upon. def elideFunctionCall(sym: Symbol) = - sym != null && (sym.elisionLevel match { - case Some(x) => (x < settings.elideLevel.value) || settings.noassertions.value - case _ => false - }) + sym != null && sym.elisionLevel.exists(x => x < settings.elideLevel.value || settings.noassertions.value) + if (elideFunctionCall(fn.symbol)) { Literal(()).setPos(tree.pos).setType(UnitClass.tpe) } else if (fn.symbol == Object_synchronized && shouldBeLiftedAnyway(args.head)) { diff --git a/src/library/scala/Option.scala b/src/library/scala/Option.scala index df2d9639c1..c3605c7c1b 100644 --- a/src/library/scala/Option.scala +++ b/src/library/scala/Option.scala @@ -106,6 +106,13 @@ sealed abstract class Option[+A] extends Product { def filter(p: A => Boolean): Option[A] = if (isEmpty || p(this.get)) this else None + /** If the option is nonempty, p(value), otherwise false. + * + * @param p the predicate to test + */ + def exists(p: A => Boolean): Boolean = + !isEmpty && p(this.get) + /** Apply the given procedure f to the option's value, * if it is nonempty. Do nothing if it is empty. * diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala index f359a3ccd1..bb2e05248f 100644 --- a/src/library/scala/Predef.scala +++ b/src/library/scala/Predef.scala @@ -12,7 +12,6 @@ package scala import collection.immutable.StringOps -import collection.mutable.StringBuilder import collection.generic.BuilderFactory /** The Predef object provides definitions that are diff --git a/src/library/scala/xml/XML.scala b/src/library/scala/xml/XML.scala index 13b62539f3..0c3ea5e295 100644 --- a/src/library/scala/xml/XML.scala +++ b/src/library/scala/xml/XML.scala @@ -77,7 +77,7 @@ object XML extends XMLLoader[Elem] node: Node, enc: String = encoding, xmlDecl: Boolean = false, - doctype: dtd.DocType + doctype: dtd.DocType = null ): Unit = { val fos = new FileOutputStream(filename) -- cgit v1.2.3