diff options
author | Paul Phillips <paulp@improving.org> | 2009-09-01 21:26:05 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-09-01 21:26:05 +0000 |
commit | 3eb22b8eb1db6a73c8afc05f80dcb33d3c46ee15 (patch) | |
tree | 45ff5e0e81af2cea83af8fca6eaa40d5063ace56 | |
parent | 8ed736aab8dbc8422c70e7d2a6e05bac0a006471 (diff) | |
download | scala-3eb22b8eb1db6a73c8afc05f80dcb33d3c46ee15.tar.gz scala-3eb22b8eb1db6a73c8afc05f80dcb33d3c46ee15.tar.bz2 scala-3eb22b8eb1db6a73c8afc05f80dcb33d3c46ee15.zip |
A few minor bugfixes for recent work.
-rw-r--r-- | src/compiler/scala/tools/nsc/io/AbstractFile.scala | 2 | ||||
-rw-r--r-- | src/library/scala/Function.scala | 18 | ||||
-rw-r--r-- | 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 * <pre> * 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! * </pre> * * @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 <code>f<sub>1</sub></code>, ..., 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) } |