diff --git a/compiler/test/dotc/tests.scala b/compiler/test/dotc/tests.scala index c626f0d80976..6de3a86d2054 100644 --- a/compiler/test/dotc/tests.scala +++ b/compiler/test/dotc/tests.scala @@ -186,7 +186,7 @@ class tests extends CompilerTest { @Test def negVarargsT1625 = compileFiles(negDir + "varargsInMethodsT1625/") - val negCustomArgs = negDir + "customArgs/" + val negCustomArgs = testsDir + "neg-custom-args/" @Test def neg_typers() = compileFile(negCustomArgs, "typers")(allowDoubleBindings) @Test def neg_overrideClass = compileFile(negCustomArgs, "overrideClass", scala2mode) @@ -198,7 +198,7 @@ class tests extends CompilerTest { @Test def neg_valueclasses_pavlov = compileFile(negCustomArgs, "valueclasses-pavlov")(allowDoubleBindings) @Test def neg_trailingUnderscore = compileFile(negCustomArgs, "trailingUnderscore", args = "-strict" :: Nil) - val negTailcallDir = negDir + "tailcall/" + val negTailcallDir = testsDir + "neg-tailcall/" @Test def neg_tailcall_t1672b = compileFile(negTailcallDir, "t1672b") @Test def neg_tailcall_t3275 = compileFile(negTailcallDir, "t3275") @Test def neg_tailcall_t6574 = compileFile(negTailcallDir, "t6574") diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index 8326468c5ffa..e1057838ddbe 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -99,7 +99,7 @@ class CompilationTests extends ParallelTesting { compileDir("../tests/pos/i1137-1", defaultOptions and "-Yemit-tasty") + compileFile( // succeeds despite -Xfatal-warnings because of -nowarn - "../tests/neg/customArgs/xfatalWarnings.scala", + "../tests/neg-custom-args/xfatalWarnings.scala", defaultOptions.and("-nowarn", "-Xfatal-warnings") ) }.checkCompile() @@ -165,30 +165,25 @@ class CompilationTests extends ParallelTesting { @Test def compileNeg: Unit = { implicit val testGroup: TestGroup = TestGroup("compileNeg") - compileShallowFilesInDir("../tests/neg", defaultOptions) + - compileShallowFilesInDir("../tests/neg/no-optimise", defaultOptions) + - compileFile("../tests/neg/customArgs/typers.scala", allowDoubleBindings) + - compileFile("../tests/neg/customArgs/overrideClass.scala", scala2Mode) + - compileFile("../tests/neg/customArgs/autoTuplingTest.scala", defaultOptions.and("-language:noAutoTupling")) + - compileFile("../tests/neg/customArgs/i1050.scala", defaultOptions.and("-strict")) + - compileFile("../tests/neg/customArgs/i1240.scala", allowDoubleBindings) + - compileFile("../tests/neg/customArgs/i2002.scala", allowDoubleBindings) + - compileFile("../tests/neg/customArgs/nopredef.scala", defaultOptions.and("-Yno-predef")) + - compileFile("../tests/neg/customArgs/noimports.scala", defaultOptions.and("-Yno-imports")) + - compileFile("../tests/neg/customArgs/noimports2.scala", defaultOptions.and("-Yno-imports")) + - compileFile("../tests/neg/customArgs/overloadsOnAbstractTypes.scala", allowDoubleBindings) + - compileFile("../tests/neg/customArgs/xfatalWarnings.scala", defaultOptions.and("-Xfatal-warnings")) + - compileFile("../tests/neg/customArgs/pureStatement.scala", defaultOptions.and("-Xfatal-warnings")) + - compileFile("../tests/neg/customArgs/phantom-overload.scala", allowDoubleBindings) + - compileFile("../tests/neg/customArgs/phantom-overload-2.scala", allowDoubleBindings) + - compileFile("../tests/neg/tailcall/t1672b.scala", defaultOptions) + - compileFile("../tests/neg/tailcall/t3275.scala", defaultOptions) + - compileFile("../tests/neg/tailcall/t6574.scala", defaultOptions) + - compileFile("../tests/neg/tailcall/tailrec.scala", defaultOptions) + - compileFile("../tests/neg/tailcall/tailrec-2.scala", defaultOptions) + - compileFile("../tests/neg/tailcall/tailrec-3.scala", defaultOptions) + - compileFile("../tests/neg/i3246.scala", scala2Mode) + - compileDir("../tests/neg/typedIdents", defaultOptions) + compileFilesInDir("../tests/neg", defaultOptions) + + compileFilesInDir("../tests/neg-tailcall", defaultOptions) + + compileFilesInDir("../tests/neg-no-optimise", defaultOptions) + + compileFile("../tests/neg-custom-args/i3246.scala", scala2Mode) + + compileFile("../tests/neg-custom-args/typers.scala", allowDoubleBindings) + + compileFile("../tests/neg-custom-args/overrideClass.scala", scala2Mode) + + compileFile("../tests/neg-custom-args/autoTuplingTest.scala", defaultOptions.and("-language:noAutoTupling")) + + compileFile("../tests/neg-custom-args/i1050.scala", defaultOptions.and("-strict")) + + compileFile("../tests/neg-custom-args/i1240.scala", allowDoubleBindings) + + compileFile("../tests/neg-custom-args/i2002.scala", allowDoubleBindings) + + compileFile("../tests/neg-custom-args/nopredef.scala", defaultOptions.and("-Yno-predef")) + + compileFile("../tests/neg-custom-args/noimports.scala", defaultOptions.and("-Yno-imports")) + + compileFile("../tests/neg-custom-args/noimports2.scala", defaultOptions.and("-Yno-imports")) + + compileFile("../tests/neg-custom-args/overloadsOnAbstractTypes.scala", allowDoubleBindings) + + compileFile("../tests/neg-custom-args/xfatalWarnings.scala", defaultOptions.and("-Xfatal-warnings")) + + compileFile("../tests/neg-custom-args/pureStatement.scala", defaultOptions.and("-Xfatal-warnings")) + + compileFile("../tests/neg-custom-args/phantom-overload.scala", allowDoubleBindings) + + compileFile("../tests/neg-custom-args/phantom-overload-2.scala", allowDoubleBindings) + + compileFile("../tests/neg-custom-args/structural.scala", defaultOptions.and("-Xfatal-warnings")) }.checkExpectedErrors() // Run tests ----------------------------------------------------------------- @@ -311,7 +306,7 @@ class CompilationTests extends ParallelTesting { implicit val testGroup: TestGroup = TestGroup("optimised/testOptimised") compileFilesInDir("../tests/pos", defaultOptimised).checkCompile() compileFilesInDir("../tests/run", defaultOptimised).checkRuns() - compileShallowFilesInDir("../tests/neg", defaultOptimised).checkExpectedErrors() + compileFilesInDir("../tests/neg", defaultOptimised).checkExpectedErrors() } private val (compilerSources, backendSources, backendJvmSources) = { @@ -340,10 +335,14 @@ object CompilationTests { implicit val summaryReport: SummaryReporting = new SummaryReport @AfterClass def cleanup(): Unit = summaryReport.echoSummary() - def sources(paths: JStream[Path], excludedFiles: List[String] = Nil): List[String] = - paths.iterator().asScala + def sources(paths: JStream[Path], excludedFiles: List[String] = Nil): List[String] = { + val sources = paths.iterator().asScala .filter(path => (path.toString.endsWith(".scala") || path.toString.endsWith(".java")) && !excludedFiles.contains(path.getFileName.toString)) .map(_.toString).toList + + paths.close() + sources + } } diff --git a/compiler/test/dotty/tools/dotc/CompilerTest.scala b/compiler/test/dotty/tools/dotc/CompilerTest.scala index 888b20f69efa..d6c2bbbc80f1 100644 --- a/compiler/test/dotty/tools/dotc/CompilerTest.scala +++ b/compiler/test/dotty/tools/dotc/CompilerTest.scala @@ -149,7 +149,8 @@ abstract class CompilerTest { private def expectedErrors(filePath: String): List[ErrorsInFile] = expectedErrors(List(filePath)) - private def isNegTest(testPath: String) = testPath.contains("/neg/") + private def isNegTest(testPath: String) = + testPath.contains("/neg/") || testPath.contains("/neg-custom-args/") || testPath.contains("/neg-tailcall/") private def compileArgs(args: Array[String], expectedErrorsPerFile: List[ErrorsInFile]) (implicit defaultOptions: List[String]): Unit = { diff --git a/compiler/test/dotty/tools/dotc/MissingCoreLibTests.scala b/compiler/test/dotty/tools/dotc/MissingCoreLibTests.scala index 31c7197ad498..bf50c6f3d6ad 100644 --- a/compiler/test/dotty/tools/dotc/MissingCoreLibTests.scala +++ b/compiler/test/dotty/tools/dotc/MissingCoreLibTests.scala @@ -11,7 +11,7 @@ class MissingCoreLibTests { @Test def missingDottyLib: Unit = { val classPath = mkClassPath(Jars.dottyCompiler :: Jars.dottyInterfaces :: Jars.dottyExtras) // missing Jars.dottyLib - val source = "../tests/neg/nolib/Foo.scala" + val source = "../tests/pos/Foo.scala" val options = Array("-classpath", classPath, source) val reporter = Main.process(options) assertEquals(1, reporter.errorCount) diff --git a/compiler/test/dotty/tools/dotc/SettingsTests.scala b/compiler/test/dotty/tools/dotc/SettingsTests.scala index b1fffbabda44..1742e9e93d25 100644 --- a/compiler/test/dotty/tools/dotc/SettingsTests.scala +++ b/compiler/test/dotty/tools/dotc/SettingsTests.scala @@ -19,7 +19,7 @@ class SettingsTests { @Test def jarOutput: Unit = { val classPath = mkClassPath(Jars.dottyTestDeps) - val source = "../tests/neg/nolib/Foo.scala" + val source = "../tests/pos/Foo.scala" val out = Paths.get("../out/jaredFoo.jar").normalize if (Files.exists(out)) Files.delete(out) val options = Array("-classpath", classPath, "-d", out.toString, source) diff --git a/tests/neg/customArgs/autoTuplingTest.scala b/tests/neg-custom-args/autoTuplingTest.scala similarity index 100% rename from tests/neg/customArgs/autoTuplingTest.scala rename to tests/neg-custom-args/autoTuplingTest.scala diff --git a/tests/neg/customArgs/i1050.scala b/tests/neg-custom-args/i1050.scala similarity index 100% rename from tests/neg/customArgs/i1050.scala rename to tests/neg-custom-args/i1050.scala diff --git a/tests/neg/customArgs/i1240.scala b/tests/neg-custom-args/i1240.scala similarity index 100% rename from tests/neg/customArgs/i1240.scala rename to tests/neg-custom-args/i1240.scala diff --git a/tests/neg/customArgs/i2002.scala b/tests/neg-custom-args/i2002.scala similarity index 100% rename from tests/neg/customArgs/i2002.scala rename to tests/neg-custom-args/i2002.scala diff --git a/tests/neg/i3246.scala b/tests/neg-custom-args/i3246.scala similarity index 100% rename from tests/neg/i3246.scala rename to tests/neg-custom-args/i3246.scala diff --git a/tests/neg/customArgs/noimports.scala b/tests/neg-custom-args/noimports.scala similarity index 100% rename from tests/neg/customArgs/noimports.scala rename to tests/neg-custom-args/noimports.scala diff --git a/tests/neg/customArgs/noimports2.scala b/tests/neg-custom-args/noimports2.scala similarity index 100% rename from tests/neg/customArgs/noimports2.scala rename to tests/neg-custom-args/noimports2.scala diff --git a/tests/neg/customArgs/nopredef.scala b/tests/neg-custom-args/nopredef.scala similarity index 100% rename from tests/neg/customArgs/nopredef.scala rename to tests/neg-custom-args/nopredef.scala diff --git a/tests/neg/customArgs/overloadsOnAbstractTypes.scala b/tests/neg-custom-args/overloadsOnAbstractTypes.scala similarity index 100% rename from tests/neg/customArgs/overloadsOnAbstractTypes.scala rename to tests/neg-custom-args/overloadsOnAbstractTypes.scala diff --git a/tests/neg/customArgs/overrideClass.scala b/tests/neg-custom-args/overrideClass.scala similarity index 100% rename from tests/neg/customArgs/overrideClass.scala rename to tests/neg-custom-args/overrideClass.scala diff --git a/tests/neg/customArgs/phantom-overload-2.scala b/tests/neg-custom-args/phantom-overload-2.scala similarity index 100% rename from tests/neg/customArgs/phantom-overload-2.scala rename to tests/neg-custom-args/phantom-overload-2.scala diff --git a/tests/neg/customArgs/phantom-overload.scala b/tests/neg-custom-args/phantom-overload.scala similarity index 100% rename from tests/neg/customArgs/phantom-overload.scala rename to tests/neg-custom-args/phantom-overload.scala diff --git a/tests/neg/customArgs/pureStatement.scala b/tests/neg-custom-args/pureStatement.scala similarity index 100% rename from tests/neg/customArgs/pureStatement.scala rename to tests/neg-custom-args/pureStatement.scala diff --git a/tests/neg/compExceptions/structural.scala b/tests/neg-custom-args/structural.scala similarity index 68% rename from tests/neg/compExceptions/structural.scala rename to tests/neg-custom-args/structural.scala index 1d25062909f3..6cc2c5be7e33 100644 --- a/tests/neg/compExceptions/structural.scala +++ b/tests/neg-custom-args/structural.scala @@ -1,3 +1,5 @@ +import scala.reflect.Selectable.reflectiveSelectable + package p1 { object test123 { @@ -36,12 +38,13 @@ object RClose { } package p3 { + object Test { - def idMap[C[_],T](m: { def map[U](f: T => U): C[U] }): C[T] = m.map(t => t) + def idMap[C[_],T](m: { def map[U](f: T => U): C[U] }): C[T] = m.map(t => t) // error: polymorphic refinement method map without matching type in parent Object is no longer allowed def main(args: Array[String]): Unit = { - idMap(Some(5)) - idMap(Responder.constant(5)) + idMap(Some(5)) // error: type mismatch: found Some[Int], required Object{map: [U](f: Any => U): Any} + idMap(Responder.constant(5)) // error: type mismatch: found Responder[Int], required Object{map: [U](f: Any => U): Any} } } } @@ -49,7 +52,7 @@ package p4 { trait A { self: Any { def p: Any } => def f(b: => Unit): Unit = {} - f { p } // error: cannot access member 'p' from structural type + f { p } // OK } } @@ -64,7 +67,7 @@ object Test { package p6 { class Refinements { - val y: C { val x: T; type T } // was adeprecated warning: illegal forward reference in refinement; now illegal + val y: { val x: T; type T } // error: deprecated warning: illegal forward reference in refinement; now illegal } } diff --git a/tests/neg/customArgs/trailingUnderscore.scala b/tests/neg-custom-args/trailingUnderscore.scala similarity index 100% rename from tests/neg/customArgs/trailingUnderscore.scala rename to tests/neg-custom-args/trailingUnderscore.scala diff --git a/tests/neg/customArgs/typers.scala b/tests/neg-custom-args/typers.scala similarity index 100% rename from tests/neg/customArgs/typers.scala rename to tests/neg-custom-args/typers.scala diff --git a/tests/neg/customArgs/valueclasses-doubledefs.scala b/tests/neg-custom-args/valueclasses-doubledefs.scala similarity index 100% rename from tests/neg/customArgs/valueclasses-doubledefs.scala rename to tests/neg-custom-args/valueclasses-doubledefs.scala diff --git a/tests/neg/customArgs/valueclasses-pavlov.scala b/tests/neg-custom-args/valueclasses-pavlov.scala similarity index 100% rename from tests/neg/customArgs/valueclasses-pavlov.scala rename to tests/neg-custom-args/valueclasses-pavlov.scala diff --git a/tests/neg/customArgs/xfatalWarnings.scala b/tests/neg-custom-args/xfatalWarnings.scala similarity index 100% rename from tests/neg/customArgs/xfatalWarnings.scala rename to tests/neg-custom-args/xfatalWarnings.scala diff --git a/tests/neg/no-optimise/patmat.scala b/tests/neg-no-optimise/patmat1.scala similarity index 100% rename from tests/neg/no-optimise/patmat.scala rename to tests/neg-no-optimise/patmat1.scala diff --git a/tests/neg/no-optimise/tryPatternMatchError.scala b/tests/neg-no-optimise/patmat2.scala similarity index 100% rename from tests/neg/no-optimise/tryPatternMatchError.scala rename to tests/neg-no-optimise/patmat2.scala diff --git a/tests/neg/tailcall/i1221.scala b/tests/neg-tailcall/i1221.scala similarity index 100% rename from tests/neg/tailcall/i1221.scala rename to tests/neg-tailcall/i1221.scala diff --git a/tests/neg/tailcall/i1221b.scala b/tests/neg-tailcall/i1221b.scala similarity index 100% rename from tests/neg/tailcall/i1221b.scala rename to tests/neg-tailcall/i1221b.scala diff --git a/tests/neg/tailcall/t1672b.check b/tests/neg-tailcall/t1672b.check similarity index 100% rename from tests/neg/tailcall/t1672b.check rename to tests/neg-tailcall/t1672b.check diff --git a/tests/neg/tailcall/t1672b.scala b/tests/neg-tailcall/t1672b.scala similarity index 100% rename from tests/neg/tailcall/t1672b.scala rename to tests/neg-tailcall/t1672b.scala diff --git a/tests/neg/tailcall/t3275.check b/tests/neg-tailcall/t3275.check similarity index 100% rename from tests/neg/tailcall/t3275.check rename to tests/neg-tailcall/t3275.check diff --git a/tests/neg/tailcall/t3275.scala b/tests/neg-tailcall/t3275.scala similarity index 100% rename from tests/neg/tailcall/t3275.scala rename to tests/neg-tailcall/t3275.scala diff --git a/tests/neg/tailcall/t6574.check b/tests/neg-tailcall/t6574.check similarity index 100% rename from tests/neg/tailcall/t6574.check rename to tests/neg-tailcall/t6574.check diff --git a/tests/neg/tailcall/t6574.scala b/tests/neg-tailcall/t6574.scala similarity index 100% rename from tests/neg/tailcall/t6574.scala rename to tests/neg-tailcall/t6574.scala diff --git a/tests/neg/tailcall/tailrec-2.check b/tests/neg-tailcall/tailrec-2.check similarity index 100% rename from tests/neg/tailcall/tailrec-2.check rename to tests/neg-tailcall/tailrec-2.check diff --git a/tests/neg/tailcall/tailrec-2.scala b/tests/neg-tailcall/tailrec-2.scala similarity index 100% rename from tests/neg/tailcall/tailrec-2.scala rename to tests/neg-tailcall/tailrec-2.scala diff --git a/tests/neg/tailcall/tailrec-3.check b/tests/neg-tailcall/tailrec-3.check similarity index 100% rename from tests/neg/tailcall/tailrec-3.check rename to tests/neg-tailcall/tailrec-3.check diff --git a/tests/neg/tailcall/tailrec-3.scala b/tests/neg-tailcall/tailrec-3.scala similarity index 100% rename from tests/neg/tailcall/tailrec-3.scala rename to tests/neg-tailcall/tailrec-3.scala diff --git a/tests/neg/tailcall/tailrec.check b/tests/neg-tailcall/tailrec.check similarity index 100% rename from tests/neg/tailcall/tailrec.check rename to tests/neg-tailcall/tailrec.check diff --git a/tests/neg/tailcall/tailrec.scala b/tests/neg-tailcall/tailrec.scala similarity index 100% rename from tests/neg/tailcall/tailrec.scala rename to tests/neg-tailcall/tailrec.scala diff --git a/tests/neg/nolib/Foo.scala b/tests/neg/nolib/Foo.scala deleted file mode 100644 index ef4e4e70d01d..000000000000 --- a/tests/neg/nolib/Foo.scala +++ /dev/null @@ -1,2 +0,0 @@ -// nopos-error -class Foo diff --git a/tests/neg/trailingCommas/trailingCommas.scala b/tests/neg/trailingCommas.scala similarity index 100% rename from tests/neg/trailingCommas/trailingCommas.scala rename to tests/neg/trailingCommas.scala diff --git a/tests/neg/inlineAccess/C_1.scala b/tests/pending/neg/inlineAccess/C_1.scala similarity index 100% rename from tests/neg/inlineAccess/C_1.scala rename to tests/pending/neg/inlineAccess/C_1.scala diff --git a/tests/neg/inlineAccess/Test_2.scala b/tests/pending/neg/inlineAccess/Test_2.scala similarity index 100% rename from tests/neg/inlineAccess/Test_2.scala rename to tests/pending/neg/inlineAccess/Test_2.scala diff --git a/tests/pos/Foo.scala b/tests/pos/Foo.scala new file mode 100644 index 000000000000..c389887ee5aa --- /dev/null +++ b/tests/pos/Foo.scala @@ -0,0 +1 @@ +class Foo