summaryrefslogtreecommitdiff
path: root/src/repl
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2016-03-22 21:26:35 +0100
committerLukas Rytz <lukas.rytz@gmail.com>2016-03-22 21:46:51 +0100
commitf8950c1457955835f4411beb8dcb3672f7cd39bd (patch)
treeee7b309b133ca04b2acf0d53533641e939cee75b /src/repl
parent6cb50acfb5ee4df342e83d8505116d4607f45d1c (diff)
downloadscala-f8950c1457955835f4411beb8dcb3672f7cd39bd.tar.gz
scala-f8950c1457955835f4411beb8dcb3672f7cd39bd.tar.bz2
scala-f8950c1457955835f4411beb8dcb3672f7cd39bd.zip
Support :require when using the flat classpath representation.
:require was re-incarnated in https://github.com/scala/scala/pull/4051, it seems to be used by the spark repl. This commit makes it work when using the flat classpath representation.
Diffstat (limited to 'src/repl')
-rw-r--r--src/repl/scala/tools/nsc/interpreter/ILoop.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/repl/scala/tools/nsc/interpreter/ILoop.scala b/src/repl/scala/tools/nsc/interpreter/ILoop.scala
index 459450a94e..56d62f3efc 100644
--- a/src/repl/scala/tools/nsc/interpreter/ILoop.scala
+++ b/src/repl/scala/tools/nsc/interpreter/ILoop.scala
@@ -633,10 +633,10 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
}
}
def alreadyDefined(clsName: String) = intp.classLoader.tryToLoadClass(clsName).isDefined
- val exists = entries.filter(_.hasExtension("class")).map(classNameOf).exists(alreadyDefined)
+ val existingClass = entries.filter(_.hasExtension("class")).map(classNameOf).find(alreadyDefined)
if (!f.exists) echo(s"The path '$f' doesn't seem to exist.")
- else if (exists) echo(s"The path '$f' cannot be loaded, because existing classpath entries conflict.") // TODO tell me which one
+ else if (existingClass.nonEmpty) echo(s"The path '$f' cannot be loaded, it contains a classfile that already exists on the classpath: ${existingClass.get}")
else {
addedClasspath = ClassPath.join(addedClasspath, f.path)
intp.addUrlsToClassPath(f.toURI.toURL)