aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dottydoc/test/BaseTest.scala4
-rw-r--r--project/Build.scala16
-rw-r--r--src/dotty/tools/dotc/config/JavaPlatform.scala2
-rw-r--r--src/dotty/tools/dotc/config/PathResolver.scala41
-rw-r--r--src/dotty/tools/dotc/config/ScalaSettings.scala2
-rw-r--r--test/dotc/tests.scala23
-rw-r--r--test/test/CompilerTest.scala11
-rw-r--r--test/test/OtherEntryPointsTest.scala17
-rw-r--r--test/test/ShowClassTests.scala13
-rw-r--r--test/test/TestREPL.scala12
-rw-r--r--tests/repl/errmsgs.check48
-rw-r--r--tests/repl/imports.check2
12 files changed, 111 insertions, 80 deletions
diff --git a/dottydoc/test/BaseTest.scala b/dottydoc/test/BaseTest.scala
index 303c476a5..e439c6eca 100644
--- a/dottydoc/test/BaseTest.scala
+++ b/dottydoc/test/BaseTest.scala
@@ -21,6 +21,10 @@ trait DottyTest {
ctx.setSetting(ctx.settings.YkeepComments, true)
ctx.setSetting(ctx.settings.YnoInline, true)
ctx.setProperty(ContextDoc, new ContextDottydoc)
+ ctx.setSetting(
+ ctx.settings.classpath,
+ "./library/target/scala-2.11/dotty-library_2.11-0.1-SNAPSHOT.jar"
+ )
base.initialize()(ctx)
ctx
}
diff --git a/project/Build.scala b/project/Build.scala
index 7e48e2ddd..e650325d4 100644
--- a/project/Build.scala
+++ b/project/Build.scala
@@ -212,19 +212,22 @@ object DottyBuild extends Build {
).
settings(
addCommandAlias(
- "partest",
- ";test:package" +
+ "packageAll",
+ ";dotty-interfaces/package" +
";dotty-compiler/package" +
";dotty-library/package" +
+ ";test:package"
+ ) ++
+ addCommandAlias(
+ "partest",
+ ";packageAll" +
";test:runMain dotc.build" +
";lockPartestFile" +
";test:test" +
";runPartestRunner"
) ++
addCommandAlias("partest-only",
- ";test:package" +
- ";dotty-compiler/package" +
- ";dotty-library/package" +
+ ";packageAll" +
";test:runMain dotc.build" +
";lockPartestFile" +
";test:test-only dotc.tests" +
@@ -232,8 +235,7 @@ object DottyBuild extends Build {
) ++
addCommandAlias(
"partest-only-no-bootstrap",
- ";test:package" +
- ";package" +
+ ";packageAll" +
";lockPartestFile" +
";test:test-only dotc.tests" +
";runPartestRunner"
diff --git a/src/dotty/tools/dotc/config/JavaPlatform.scala b/src/dotty/tools/dotc/config/JavaPlatform.scala
index 5a21acd15..a695202d3 100644
--- a/src/dotty/tools/dotc/config/JavaPlatform.scala
+++ b/src/dotty/tools/dotc/config/JavaPlatform.scala
@@ -17,7 +17,7 @@ class JavaPlatform extends Platform {
if (currentClassPath.isEmpty)
currentClassPath = Some(new PathResolver().result)
val cp = currentClassPath.get
- println(cp)
+ //println(cp)
cp
}
diff --git a/src/dotty/tools/dotc/config/PathResolver.scala b/src/dotty/tools/dotc/config/PathResolver.scala
index 83d4c6933..1f9ee7eec 100644
--- a/src/dotty/tools/dotc/config/PathResolver.scala
+++ b/src/dotty/tools/dotc/config/PathResolver.scala
@@ -20,7 +20,7 @@ object PathResolver {
// security exceptions.
import AccessControl._
- def firstNonEmpty(xs: String*) = xs find (_ != "") getOrElse ""
+ def firstNonEmpty(xs: String*) = xs find (_ != "") getOrElse ""
/** Map all classpath elements to absolute paths and reconstruct the classpath.
*/
@@ -50,16 +50,12 @@ object PathResolver {
propOrElse("sun.boot.class.path", searchForBootClasspath)
.split(":")
.filterNot { jar =>
- // This classpath gets propagated to the compiled resources and as
- // such needs to be purged of things that should not be on the
- // compiled programs' classpath:
- jar.contains("dotty-compiler") ||
- jar.contains("dotty-library") ||
- jar.contains("dotty-interfaces") ||
// let's blacklist locally compiled classes:
- jar.contains("dotty/library/target") ||
- jar.contains("dotty/interfaces/target") ||
- jar.contains("dotty/target/scala-2.11")
+ jar.contains("/dotty/library/target/classes") ||
+ jar.contains("/dotty/library/target/scala-2.11/classes") ||
+ jar.contains("/dotty/interfaces/target/classes") ||
+ jar.contains("/dotty/target/scala-2.11/classes") ||
+ jar.contains("/dotty/target/classes")
}
.mkString(":")
@@ -71,20 +67,14 @@ object PathResolver {
def javaUserClassPath = propOrElse("java.class.path", "")
def useJavaClassPath = propOrFalse("scala.usejavacp")
- override def toString = """
+ override def toString = s"""
|object Environment {
- | scalaHome = %s (useJavaClassPath = %s)
- | javaBootClassPath = <%d chars>
- | javaExtDirs = %s
- | javaUserClassPath = %s
- | scalaExtDirs = %s
- |}""".trim.stripMargin.format(
- scalaHome, useJavaClassPath,
- javaBootClassPath.length,
- ppcp(javaExtDirs),
- ppcp(javaUserClassPath),
- ppcp(scalaExtDirs)
- )
+ | scalaHome = $scalaHome (useJavaClassPath = $useJavaClassPath)
+ | javaBootClassPath = <${javaBootClassPath.length} chars>
+ | javaExtDirs = ${ppcp(javaExtDirs)}
+ | javaUserClassPath = ${ppcp(javaUserClassPath)}
+ | scalaExtDirs = ${ppcp(scalaExtDirs)}
+ |}""".trim.stripMargin
}
/** Default values based on those in Environment as interpreted according
@@ -259,7 +249,7 @@ class PathResolver(implicit ctx: Context) {
| javaBootClassPath = %s
| javaExtDirs = %s
| javaUserClassPath = %s
- | useJavaClassPath = %s
+ | useJavaClassPath = %s
| scalaBootClassPath = %s
| scalaExtDirs = %s
| userClassPath = %s
@@ -276,7 +266,8 @@ class PathResolver(implicit ctx: Context) {
def containers = Calculated.containers
lazy val result: JavaClassPath = {
- val cp = new JavaClassPath(containers.toIndexedSeq, context)
+ val (dottyJars, others) = containers.partition(_.name.contains("dotty"))
+ val cp = new JavaClassPath((dottyJars ++ others).toIndexedSeq, context)
if (settings.Ylogcp.value) {
Console.println("Classpath built from " + settings.toConciseString(ctx.sstate))
Console.println("Defaults: " + PathResolver.Defaults)
diff --git a/src/dotty/tools/dotc/config/ScalaSettings.scala b/src/dotty/tools/dotc/config/ScalaSettings.scala
index 8f47e08bf..fd2ded0b5 100644
--- a/src/dotty/tools/dotc/config/ScalaSettings.scala
+++ b/src/dotty/tools/dotc/config/ScalaSettings.scala
@@ -42,7 +42,7 @@ class ScalaSettings extends Settings.SettingGroup {
val usejavacp = BooleanSetting("-usejavacp", "Utilize the java.class.path in classpath resolution.")
val verbose = BooleanSetting("-verbose", "Output messages about what the compiler is doing.")
val version = BooleanSetting("-version", "Print product version and exit.")
- val pageWidth = IntSetting("-pagewidth", "Set page width", 120)
+ val pageWidth = IntSetting("-pagewidth", "Set page width", 80)
val jvmargs = PrefixSetting("-J<flag>", "-J", "Pass <flag> directly to the runtime system.")
val defines = PrefixSetting("-Dproperty=value", "-D", "Pass -Dproperty=value directly to the runtime system.")
diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala
index 4d3e8e1dd..747396c73 100644
--- a/test/dotc/tests.scala
+++ b/test/dotc/tests.scala
@@ -19,22 +19,25 @@ class tests extends CompilerTest {
// "-Xprompt",
// "-explaintypes",
// "-Yshow-suppressed-errors",
- "-d", defaultOutputDir,
- "-pagewidth", "80"
+ "-pagewidth", "120",
+ "-d", defaultOutputDir
)
- implicit val defaultOptions = noCheckOptions ++ {
- if (isRunByJenkins) List("-Ycheck:tailrec,resolveSuper,mixin,restoreScopes,labelDef") // should be Ycheck:all, but #725
- else List("-Ycheck:tailrec,resolveSuper,mixin,restoreScopes,labelDef")
- } ++ List(
+ val classPath = List(
"-Yno-deep-subtypes",
"-Yno-double-bindings",
"-Yforce-sbt-phases",
"-color:never",
"-classpath",
- "./library/target/scala-2.11/dotty-library_2.11-0.1-SNAPSHOT.jar"
+ "./library/target/scala-2.11/dotty-library_2.11-0.1-SNAPSHOT.jar" +
+ ":./interfaces/target/dotty-interfaces-0.1-SNAPSHOT.jar"
)
+ implicit val defaultOptions = noCheckOptions ++ {
+ if (isRunByJenkins) List("-Ycheck:tailrec,resolveSuper,mixin,restoreScopes,labelDef") // should be Ycheck:all, but #725
+ else List("-Ycheck:tailrec,resolveSuper,mixin,restoreScopes,labelDef")
+ } ++ classPath
+
val testPickling = List("-Xprint-types", "-Ytest-pickler", "-Ystop-after:pickler", "-Yprintpos")
val twice = List("#runs", "2")
@@ -191,7 +194,9 @@ class tests extends CompilerTest {
".",
List(
"-deep", "-Ycheck-reentrant", "-strict", "-classpath", defaultOutputDir +
- ":./target/scala-2.11/dotty-compiler_2.11-0.1-SNAPSHOT.jar" //WAT???
+ ":./target/scala-2.11/dotty-compiler_2.11-0.1-SNAPSHOT.jar" +
+ ":./interfaces/target/dotty-interfaces-0.1-SNAPSHOT.jar" +
+ ":./library/target/scala-2.11/dotty-library_2.11-0.1-SNAPSHOT.jar"
)
)(allowDeepSubtypes) // note the -deep argument
@@ -214,7 +219,7 @@ class tests extends CompilerTest {
@Test def dotc_ast = compileDir(dotcDir, "ast")
@Test def dotc_config = compileDir(dotcDir, "config")
@Test def dotc_core = compileDir(dotcDir, "core")(allowDeepSubtypes)// twice omitted to make tests run faster
- @Test def dotc_core_nocheck = compileDir(dotcDir, "core")(noCheckOptions)
+ @Test def dotc_core_nocheck = compileDir(dotcDir, "core")(noCheckOptions ++ classPath)
// This directory doesn't exist anymore
// @Test def dotc_core_pickling = compileDir(coreDir, "pickling")(allowDeepSubtypes)// twice omitted to make tests run faster
diff --git a/test/test/CompilerTest.scala b/test/test/CompilerTest.scala
index fe63106b5..5a4a9830a 100644
--- a/test/test/CompilerTest.scala
+++ b/test/test/CompilerTest.scala
@@ -133,15 +133,18 @@ abstract class CompilerTest {
}
}
- private def compileWithJavac(fs: Array[String], args: Array[String]): Unit = {
+ private def compileWithJavac(
+ fs: Array[String],
+ args: Array[String]
+ )(implicit defaultOptions: List[String]): Boolean = {
val scalaLib = findJarFromRuntime("scala-library")
val fullArgs = Array(
"javac",
"-classpath",
s".:$scalaLib"
- ) ++ args ++ fs ++ Array("-d", defaultOutputDir)
+ ) ++ args ++ defaultOptions.dropWhile("-d" != _).take(2) ++ fs
- Runtime.getRuntime.exec(fullArgs).waitFor()
+ Runtime.getRuntime.exec(fullArgs).waitFor() == 0
}
/** Compiles the code files in the given directory together. If args starts
@@ -169,7 +172,7 @@ abstract class CompilerTest {
log(s"WARNING: run tests can only be run by partest, JUnit just verifies compilation: $prefix$dirName")
val (filePaths, javaFilePaths, normArgs, expErrors) = computeFilePathsAndExpErrors
compileWithJavac(javaFilePaths, Array.empty) // javac needs to run first on dotty-library
- compileArgs(filePaths ++ normArgs, expErrors)
+ compileArgs(javaFilePaths ++ filePaths ++ normArgs, expErrors)
} else {
val (sourceDir, flags, deep) = args match {
case "-deep" :: args1 => (flattenDir(prefix, dirName), args1 ++ defaultOptions, "deep")
diff --git a/test/test/OtherEntryPointsTest.scala b/test/test/OtherEntryPointsTest.scala
index abaa043c0..ae46fa36f 100644
--- a/test/test/OtherEntryPointsTest.scala
+++ b/test/test/OtherEntryPointsTest.scala
@@ -17,10 +17,18 @@ import scala.collection.mutable.ListBuffer
* @see [[InterfaceEntryPointTest]]
*/
class OtherEntryPointsTest {
- @Test def runCompiler = {
- val sources = List("./tests/pos/HelloWorld.scala").map(p => new java.io.File(p).getPath())
- val args = sources ++ List("-d", "./out/")
+ private val sources =
+ List("./tests/pos/HelloWorld.scala").map(p => new java.io.File(p).getPath())
+ private val dottyInterfaces =
+ new java.io.File("./interfaces/dotty-interfaces-0.1-SNAPSHOT.jar").getPath
+ private val dottyLibrary =
+ new java.io.File("./library/target/scala-2.11/dotty-library_2.11-0.1-SNAPSHOT.jar").getPath
+ private val args =
+ sources ++
+ List("-d", "./out/") ++
+ List("-classpath", dottyInterfaces + ":" + dottyLibrary)
+ @Test def runCompiler = {
val reporter = new CustomReporter
val callback = new CustomCompilerCallback
@@ -32,9 +40,6 @@ class OtherEntryPointsTest {
}
@Test def runCompilerWithContext = {
- val sources = List("./tests/pos/HelloWorld.scala").map(p => new java.io.File(p).getPath())
- val args = sources ++ List("-d", "./out/")
-
val reporter = new CustomReporter
val callback = new CustomCompilerCallback
val context = (new ContextBase).initialCtx.fresh
diff --git a/test/test/ShowClassTests.scala b/test/test/ShowClassTests.scala
index d5e59c169..81e304296 100644
--- a/test/test/ShowClassTests.scala
+++ b/test/test/ShowClassTests.scala
@@ -11,6 +11,19 @@ import dotty.tools.dotc.core.Decorators._
import org.junit.Test
class ShowClassTests extends DottyTest {
+ ctx = {
+ val base = new ContextBase
+ import base.settings._
+ val ctx = base.initialCtx.fresh
+ ctx.setSetting(ctx.settings.encoding, "UTF8")
+ ctx.setSetting(
+ ctx.settings.classpath,
+ "./library/target/scala-2.11/dotty-library_2.11-0.1-SNAPSHOT.jar" +
+ ":./interfaces/target/dotty-interfaces-0.1-SNAPSHOT.jar"
+ )
+ base.initialize()(ctx)
+ ctx
+ }
def debug_println(msg: => Any) = {
if (sys.props.isDefinedAt("test.ShowClassTests.verbose"))
diff --git a/test/test/TestREPL.scala b/test/test/TestREPL.scala
index 9867cb4ec..cccfacc41 100644
--- a/test/test/TestREPL.scala
+++ b/test/test/TestREPL.scala
@@ -20,8 +20,16 @@ class TestREPL(script: String) extends REPL {
override lazy val config = new REPL.Config {
override val output = new NewLinePrintWriter(out)
- override def context(ctx: Context) =
- ctx.fresh.setSetting(ctx.settings.color, "never")
+ override def context(ctx: Context) = {
+ val fresh = ctx.fresh
+ fresh.setSetting(ctx.settings.color, "never")
+ fresh.setSetting(
+ ctx.settings.classpath,
+ "./library/target/scala-2.11/dotty-library_2.11-0.1-SNAPSHOT.jar"
+ )
+ fresh.initialize()(fresh)
+ fresh
+ }
override def input(in: Interpreter)(implicit ctx: Context) = new InteractiveReader {
val lines = script.lines.buffered
diff --git a/tests/repl/errmsgs.check b/tests/repl/errmsgs.check
index 2bcb40eb0..f0ccdf53f 100644
--- a/tests/repl/errmsgs.check
+++ b/tests/repl/errmsgs.check
@@ -1,42 +1,42 @@
scala> class Inv[T](x: T)
defined class Inv
scala> val x: List[String] = List(1)
--- [E007] Type Mismatch Error: <console> -------------------------------------------------------------------------------
+-- [E007] Type Mismatch Error: <console> ---------------------------------------
4 |val x: List[String] = List(1)
| ^
| found: Int(1)
| required: String
|
scala> val y: List[List[String]] = List(List(1))
--- [E007] Type Mismatch Error: <console> -------------------------------------------------------------------------------
+-- [E007] Type Mismatch Error: <console> ---------------------------------------
4 |val y: List[List[String]] = List(List(1))
| ^
| found: Int(1)
| required: String
|
scala> val z: (List[String], List[Int]) = (List(1), List("a"))
--- [E007] Type Mismatch Error: <console> -------------------------------------------------------------------------------
+-- [E007] Type Mismatch Error: <console> ---------------------------------------
4 |val z: (List[String], List[Int]) = (List(1), List("a"))
| ^
| found: Int(1)
| required: String
|
--- [E007] Type Mismatch Error: <console> -------------------------------------------------------------------------------
+-- [E007] Type Mismatch Error: <console> ---------------------------------------
4 |val z: (List[String], List[Int]) = (List(1), List("a"))
| ^^^
| found: String("a")
| required: Int
|
scala> val a: Inv[String] = new Inv(new Inv(1))
--- [E007] Type Mismatch Error: <console> -------------------------------------------------------------------------------
+-- [E007] Type Mismatch Error: <console> ---------------------------------------
5 |val a: Inv[String] = new Inv(new Inv(1))
| ^^^^^
- | found: Inv[T]
- | required: String
- |
- | where: T is a type variable with constraint >: Int(1)
+ | found: Inv[T]
+ | required: String
+ |
+ | where: T is a type variable with constraint >: Int(1)
scala> val b: Inv[String] = new Inv(1)
--- [E007] Type Mismatch Error: <console> -------------------------------------------------------------------------------
+-- [E007] Type Mismatch Error: <console> ---------------------------------------
5 |val b: Inv[String] = new Inv(1)
| ^
| found: Int(1)
@@ -57,25 +57,25 @@ scala> abstract class C {
}
}
}
--- [E007] Type Mismatch Error: <console> -------------------------------------------------------------------------------
+-- [E007] Type Mismatch Error: <console> ---------------------------------------
9 | var y: T = x
| ^
- | found: C.this.T(C.this.x)
- | required: T'
- |
- | where: T is a type in class C
- | T' is a type in the initalizer of value s which is an alias of String
--- [E007] Type Mismatch Error: <console> -------------------------------------------------------------------------------
+ |found: C.this.T(C.this.x)
+ |required: T'
+ |
+ |where: T is a type in class C
+ | T' is a type in the initalizer of value s which is an alias of String
+-- [E007] Type Mismatch Error: <console> ---------------------------------------
13 | val z: T = y
| ^
- | found: T(y)
- | required: T'
- |
- | where: T is a type in the initalizer of value s which is an alias of String
- | T' is a type in method f which is an alias of Int
+ |found: T(y)
+ |required: T'
+ |
+ |where: T is a type in the initalizer of value s which is an alias of String
+ | T' is a type in method f which is an alias of Int
scala> class Foo() { def bar: Int = 1 }; val foo = new Foo(); foo.barr
--- [E008] Member Not Found Error: <console> ----------------------------------------------------------------------------
+-- [E008] Member Not Found Error: <console> ------------------------------------
4 |class Foo() { def bar: Int = 1 }; val foo = new Foo(); foo.barr
| ^^^^^^^^
- | value `barr` is not a member of Foo(foo) - did you mean `foo.bar`?
+ | value `barr` is not a member of Foo(foo) - did you mean `foo.bar`?
scala> :quit
diff --git a/tests/repl/imports.check b/tests/repl/imports.check
index b6d9ae8a7..4ca59e4ee 100644
--- a/tests/repl/imports.check
+++ b/tests/repl/imports.check
@@ -7,7 +7,7 @@ defined module o
scala> import o._
import o._
scala> buf += xs
--- [E007] Type Mismatch Error: <console> -------------------------------------------------------------------------------
+-- [E007] Type Mismatch Error: <console> ---------------------------------------
11 |buf += xs
| ^^
| found: scala.collection.immutable.List[Int](o.xs)