From 3eb22b8eb1db6a73c8afc05f80dcb33d3c46ee15 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Tue, 1 Sep 2009 21:26:05 +0000 Subject: A few minor bugfixes for recent work. --- src/compiler/scala/tools/nsc/io/AbstractFile.scala | 2 +- src/library/scala/Function.scala | 18 +++++++++--------- src/library/scala/io/Path.scala | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/compiler/scala/tools/nsc/io/AbstractFile.scala b/src/compiler/scala/tools/nsc/io/AbstractFile.scala index 518dc1b9e6..5cbd504fd3 100644 --- a/src/compiler/scala/tools/nsc/io/AbstractFile.scala +++ b/src/compiler/scala/tools/nsc/io/AbstractFile.scala @@ -59,7 +59,7 @@ object AbstractFile * @return ... */ def getURL(url: URL): AbstractFile = - Some(url) filterMap { case url: URL if isJarOrZip(url.getPath) => ZipArchive fromURL url } orNull + Option(url) filterMap { case url: URL if isJarOrZip(url.getPath) => ZipArchive fromURL url } orNull } /** diff --git a/src/library/scala/Function.scala b/src/library/scala/Function.scala index 9cdaf90349..a76fa61039 100644 --- a/src/library/scala/Function.scala +++ b/src/library/scala/Function.scala @@ -28,21 +28,21 @@ object Function *
    *    case class Bop(next: Bop)
    *    val x = Bop(Bop(Bop(null)))
-   *    ?:(x)(_.next)()                         // returns Bop(Bop(null))
-   *    ?:(x)(_.next)(_.next)()                 // returns Bop(null)
-   *    ?:(x)(_.next)(_.next)(_.next)()         // returns null
-   *    ?:(x)(_.next)(_.next)(_.next)(_.next)() // still returns null!
+   *    ??(x)(_.next)()                         // returns Bop(Bop(null))
+   *    ??(x)(_.next)(_.next)()                 // returns Bop(null)
+   *    ??(x)(_.next)(_.next)(_.next)()         // returns null
+   *    ??(x)(_.next)(_.next)(_.next)(_.next)() // still returns null!
    *  
* * @param x The starting value - * @return The ?: object, containing apply methods T => U and () => T + * @return The ?? object, containing apply methods T => U and () => T */ @experimental - case class ?:[T](x: T) { + case class ??[T](x: T) { def apply(): T = x - def apply[U >: Null](f: T => U): ?:[U] = - if (x == null) ?:[U](null) - else ?:[U](f(x)) + def apply[U >: Null](f: T => U): ??[U] = + if (x == null) ??[U](null) + else ??[U](f(x)) } /** Given a sequence of functions f1, ..., diff --git a/src/library/scala/io/Path.scala b/src/library/scala/io/Path.scala index b4b317081b..020bf82e4c 100644 --- a/src/library/scala/io/Path.scala +++ b/src/library/scala/io/Path.scala @@ -144,13 +144,13 @@ class Path private[io] (val jfile: JFile) // creations def createDirectory(force: Boolean = true, failIfExists: Boolean = false): Directory = { val res = if (force) jfile.mkdirs() else jfile.mkdir() - if (!res && exists && failIfExists) fail("Directory '%s' already exists." format name) + if (!res && failIfExists && exists) fail("Directory '%s' already exists." format name) else if (isDirectory) toDirectory else new Directory(jfile) } def createFile(failIfExists: Boolean = false): File = { val res = jfile.createNewFile() - if (!res && exists && failIfExists) fail("File '%s' already exists." format name) + if (!res && failIfExists && exists) fail("File '%s' already exists." format name) else if (isFile) toFile else new File(jfile) } -- cgit v1.2.3