From cc485a9c4f5764753a7d2d64815c2de84268d5ec Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Fri, 15 Mar 2013 08:54:58 -0700 Subject: SI-5717 error when bytecode cannot be written If there's an existing file foo when emitting a class file for foo.Bar, then emit an error at foo.Bar, similar to what javac does. The error message looks something like: foo.scala:4: error: error writing object Foo: ./mypkg/Foo.class: ./mypkg is not a directory --- test/files/run/t5717.scala | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 test/files/run/t5717.scala (limited to 'test/files/run/t5717.scala') diff --git a/test/files/run/t5717.scala b/test/files/run/t5717.scala new file mode 100755 index 0000000000..a0997f5a49 --- /dev/null +++ b/test/files/run/t5717.scala @@ -0,0 +1,21 @@ +import scala.tools.partest._ +import java.io.File + +object Test extends StoreReporterDirectTest { + def code = ??? + + def compileCode(code: String) = { + val classpath = List(sys.props("partest.lib"), testOutput.path) mkString sys.props("path.separator") + compileString(newCompiler("-cp", classpath, "-d", testOutput.path))(code) + } + // TODO + // Don't assume output is on physical disk + // Let the compiler tell us output dir + // val sc = newCompiler("-cp", classpath, "-d", testOutput.path) + // val out = sc.settings.outputDirs.getSingleOutput.get + def show(): Unit = { + // Don't crash when we find a file 'a' where package 'a' should go. + scala.reflect.io.File(testOutput.path + "/a").writeAll("a") + compileCode("package a { class B }") + } +} -- cgit v1.2.3