summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-09-11 13:11:04 +0000
committerPaul Phillips <paulp@improving.org>2009-09-11 13:11:04 +0000
commit8871528f60958a45eb119a5cc487f87215e4e92f (patch)
treef1156b640db91dd9dec968ca7f1f5129ddf7d6d6
parent57ed4ca11459b48f2310c81beef1d31476494d25 (diff)
downloadscala-8871528f60958a45eb119a5cc487f87215e4e92f.tar.gz
scala-8871528f60958a45eb119a5cc487f87215e4e92f.tar.bz2
scala-8871528f60958a45eb119a5cc487f87215e4e92f.zip
A bundle of small bugfixes to recent patches.
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Symbols.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala6
-rw-r--r--src/library/scala/Option.scala7
-rw-r--r--src/library/scala/Predef.scala1
-rw-r--r--src/library/scala/xml/XML.scala2
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 <code>f</code> 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 <code>Predef</code> 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)