From 61f4b7fcce0b22996a08ba6e3f1800866baa9f60 Mon Sep 17 00:00:00 2001 From: Yuito Murase Date: Fri, 18 Aug 2023 21:16:26 +0900 Subject: [PATCH] Refactor test directories --- .../dotty/tools/dotc/CompilationTests.scala | 3 --- ...ted-pattern-with-bounded-type-params.check | 4 ---- .../quoted-pattern-with-type-params.check | 12 ---------- ...-with-bounded-type-params-regression.check | 12 ++++++++++ ...with-bounded-type-params-regression.scala} | 9 +++---- ...ted-pattern-with-bounded-type-params.check | 16 ++++--------- ...ted-pattern-with-bounded-type-params.scala | 10 ++++---- ...-pattern-with-type-params-regression.check | 16 +++++++++++++ ...pattern-with-type-params-regression.scala} | 3 +++ .../quoted-pattern-with-type-params.check | 24 ++++++++----------- .../quoted-pattern-with-type-params.scala | 4 +--- .../quoted-patten-with-type-params.scala | 1 + ...te-match-poly-function-1-regression.check} | 0 .../Macro_1.scala | 0 .../Test_2.scala | 0 ...heck => quote-match-poly-function-1.check} | 0 .../Macro_1.scala | 1 + .../Test_2.scala | 0 .../quote-match-poly-function-2.check} | 0 .../Macro_1.scala | 1 + .../quote-match-poly-function-2}/Test_2.scala | 0 21 files changed, 59 insertions(+), 57 deletions(-) delete mode 100644 tests/neg-custom-args/quoted-pattern-poly/quoted-pattern-with-bounded-type-params.check delete mode 100644 tests/neg-custom-args/quoted-pattern-poly/quoted-pattern-with-type-params.check create mode 100644 tests/neg-macros/quoted-pattern-with-bounded-type-params-regression.check rename tests/{neg-custom-args/quoted-pattern-poly/quoted-pattern-with-bounded-type-params.scala => neg-macros/quoted-pattern-with-bounded-type-params-regression.scala} (58%) create mode 100644 tests/neg-macros/quoted-pattern-with-type-params-regression.check rename tests/{neg-custom-args/quoted-pattern-poly/quoted-pattern-with-type-params.scala => neg-macros/quoted-pattern-with-type-params-regression.scala} (83%) rename tests/{pos-custom-args/quoted-pattern-poly => pos-macros}/quoted-patten-with-type-params.scala (88%) rename tests/{run-custom-args/quoted-pattern-poly/quote-match-poly-function-regression.check => run-macros/quote-match-poly-function-1-regression.check} (100%) rename tests/{run-custom-args/quoted-pattern-poly/quote-match-poly-function-regression => run-macros/quote-match-poly-function-1-regression}/Macro_1.scala (100%) rename tests/{run-custom-args/quoted-pattern-poly/quote-match-poly-function-regression => run-macros/quote-match-poly-function-1-regression}/Test_2.scala (100%) rename tests/run-macros/{quote-match-poly-function-regression.check => quote-match-poly-function-1.check} (100%) rename tests/run-macros/{quote-match-poly-function-regression => quote-match-poly-function-1}/Macro_1.scala (82%) rename tests/run-macros/{quote-match-poly-function-regression => quote-match-poly-function-1}/Test_2.scala (100%) rename tests/{run-custom-args/quoted-pattern-poly/quote-match-poly-function.check => run-macros/quote-match-poly-function-2.check} (100%) rename tests/{run-custom-args/quoted-pattern-poly/quote-match-poly-function => run-macros/quote-match-poly-function-2}/Macro_1.scala (94%) rename tests/{run-custom-args/quoted-pattern-poly/quote-match-poly-function => run-macros/quote-match-poly-function-2}/Test_2.scala (100%) diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index 0e33a9cd67e4..0d07504c4df8 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -38,7 +38,6 @@ class CompilationTests { compileFilesInDir("tests/pos-custom-args/captures", defaultOptions.and("-language:experimental.captureChecking")), compileFile("tests/pos-special/utf8encoded.scala", defaultOptions.and("-encoding", "UTF8")), compileFile("tests/pos-special/utf16encoded.scala", defaultOptions.and("-encoding", "UTF16")), - compileFilesInDir("tests/pos-custom-args/quoted-pattern-poly", defaultOptions.and("-language:experimental.quotedPatternsWithPolymorphicFunctions")), // Run tests for legacy lazy vals compileFilesInDir("tests/pos", defaultOptions.and("-Ysafe-init", "-Ylegacy-lazy-vals", "-Ycheck-constraint-deps"), FileFilter.include(TestSources.posLazyValsAllowlist)), compileDir("tests/pos-special/java-param-names", defaultOptions.withJavacOnlyOptions("-parameters")), @@ -118,7 +117,6 @@ class CompilationTests { compileFilesInDir("tests/neg", defaultOptions), compileFilesInDir("tests/neg-deep-subtype", allowDeepSubtypes), compileFilesInDir("tests/neg-custom-args/captures", defaultOptions.and("-language:experimental.captureChecking")), - compileFilesInDir("tests/neg-custom-args/quoted-pattern-poly", defaultOptions.and("-language:experimental.quotedPatternsWithPolymorphicFunctions")), compileFile("tests/neg-custom-args/sourcepath/outer/nested/Test1.scala", defaultOptions.and("-sourcepath", "tests/neg-custom-args/sourcepath")), compileDir("tests/neg-custom-args/sourcepath2/hi", defaultOptions.and("-sourcepath", "tests/neg-custom-args/sourcepath2", "-Xfatal-warnings")), compileList("duplicate source", List( @@ -139,7 +137,6 @@ class CompilationTests { @Test def runAll: Unit = { implicit val testGroup: TestGroup = TestGroup("runAll") aggregateTests( - compileFilesInDir("tests/run-custom-args/quoted-pattern-poly", defaultOptions.and("-language:experimental.quotedPatternsWithPolymorphicFunctions")), compileFilesInDir("tests/run", defaultOptions.and("-Ysafe-init")), compileFilesInDir("tests/run-deep-subtype", allowDeepSubtypes), compileFilesInDir("tests/run-custom-args/captures", allowDeepSubtypes.and("-language:experimental.captureChecking")), diff --git a/tests/neg-custom-args/quoted-pattern-poly/quoted-pattern-with-bounded-type-params.check b/tests/neg-custom-args/quoted-pattern-poly/quoted-pattern-with-bounded-type-params.check deleted file mode 100644 index b2117191cd78..000000000000 --- a/tests/neg-custom-args/quoted-pattern-poly/quoted-pattern-with-bounded-type-params.check +++ /dev/null @@ -1,4 +0,0 @@ --- Error: tests/neg-custom-args/quoted-pattern-poly/quoted-pattern-with-bounded-type-params.scala:10:50 ---------------- -10 | case '{ [A <: Int, B] => (x : A, y : A) => $b[A](x, y) : A } => ??? // error - | ^ - | Implementation restriction: Type arguments to Open pattern are expected to have no bounds diff --git a/tests/neg-custom-args/quoted-pattern-poly/quoted-pattern-with-type-params.check b/tests/neg-custom-args/quoted-pattern-poly/quoted-pattern-with-type-params.check deleted file mode 100644 index ae4f9ee2a3c1..000000000000 --- a/tests/neg-custom-args/quoted-pattern-poly/quoted-pattern-with-type-params.check +++ /dev/null @@ -1,12 +0,0 @@ --- Error: tests/neg-custom-args/quoted-pattern-poly/quoted-pattern-with-type-params.scala:5:32 ------------------------- -5 | case '{ [A] => (x : A) => $b[A] : (A => A) } => ??? // error - | ^^^^^ - | Implementation restriction: A higher-order pattern must carry value arguments --- Error: tests/neg-custom-args/quoted-pattern-poly/quoted-pattern-with-type-params.scala:6:33 ------------------------- -6 | case '{ [A] => (x : A) => $b(x) : (A => A) } => ??? // error - | ^ - | Type variables that this argument depends on are not captured in this hoas pattern --- Error: tests/neg-custom-args/quoted-pattern-poly/quoted-pattern-with-type-params.scala:7:26 ------------------------- -7 | case '{ (a:Int) => $b[Int](a) : String } => ??? // error - | ^^^ - | Type arguments of a hoas pattern needs to be defined inside the quoted pattern diff --git a/tests/neg-macros/quoted-pattern-with-bounded-type-params-regression.check b/tests/neg-macros/quoted-pattern-with-bounded-type-params-regression.check new file mode 100644 index 000000000000..9e83141b36ab --- /dev/null +++ b/tests/neg-macros/quoted-pattern-with-bounded-type-params-regression.check @@ -0,0 +1,12 @@ +-- Error: tests/neg-macros/quoted-pattern-with-bounded-type-params.scala:10:48 ----------------------------------------- +10 | case '{ [A <: Int, B] => (x : A, y : A) => $b[A](x, y) : A } => // error + | ^ + | Type must be fully defined. + | Consider annotating the splice using a type ascription: + | (${b}: XYZ). +-- [E006] Not Found Error: tests/neg-macros/quoted-pattern-with-bounded-type-params.scala:11:10 ------------------------ +11 | '{ $b[String]("truthy", "falsy") } // error + | ^ + | Not found: b + | + | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/quoted-pattern-poly/quoted-pattern-with-bounded-type-params.scala b/tests/neg-macros/quoted-pattern-with-bounded-type-params-regression.scala similarity index 58% rename from tests/neg-custom-args/quoted-pattern-poly/quoted-pattern-with-bounded-type-params.scala rename to tests/neg-macros/quoted-pattern-with-bounded-type-params-regression.scala index d6fc436334fe..6797ae926367 100644 --- a/tests/neg-custom-args/quoted-pattern-poly/quoted-pattern-with-bounded-type-params.scala +++ b/tests/neg-macros/quoted-pattern-with-bounded-type-params-regression.scala @@ -1,7 +1,8 @@ -/* - * Supporting hoas quote pattern with bounded type variable - * is future todo. - */ +/** + * Supporting hoas quote pattern with bounded type variable + * is future todo. + * Refer to: quoted-pattern-with-bounded-type-params.scala + */ import scala.quoted.* diff --git a/tests/neg-macros/quoted-pattern-with-bounded-type-params.check b/tests/neg-macros/quoted-pattern-with-bounded-type-params.check index 9e83141b36ab..b2117191cd78 100644 --- a/tests/neg-macros/quoted-pattern-with-bounded-type-params.check +++ b/tests/neg-macros/quoted-pattern-with-bounded-type-params.check @@ -1,12 +1,4 @@ --- Error: tests/neg-macros/quoted-pattern-with-bounded-type-params.scala:10:48 ----------------------------------------- -10 | case '{ [A <: Int, B] => (x : A, y : A) => $b[A](x, y) : A } => // error - | ^ - | Type must be fully defined. - | Consider annotating the splice using a type ascription: - | (${b}: XYZ). --- [E006] Not Found Error: tests/neg-macros/quoted-pattern-with-bounded-type-params.scala:11:10 ------------------------ -11 | '{ $b[String]("truthy", "falsy") } // error - | ^ - | Not found: b - | - | longer explanation available when compiling with `-explain` +-- Error: tests/neg-custom-args/quoted-pattern-poly/quoted-pattern-with-bounded-type-params.scala:10:50 ---------------- +10 | case '{ [A <: Int, B] => (x : A, y : A) => $b[A](x, y) : A } => ??? // error + | ^ + | Implementation restriction: Type arguments to Open pattern are expected to have no bounds diff --git a/tests/neg-macros/quoted-pattern-with-bounded-type-params.scala b/tests/neg-macros/quoted-pattern-with-bounded-type-params.scala index c3ad24acae67..567efa9ee35d 100644 --- a/tests/neg-macros/quoted-pattern-with-bounded-type-params.scala +++ b/tests/neg-macros/quoted-pattern-with-bounded-type-params.scala @@ -1,10 +1,10 @@ -/** - * Supporting hoas quote pattern with bounded type variable - * is future todo. - * Refer to: neg-custom-args/quoted-pattern-poly/quoted-pattern-with-bounded-type-params.scala - */ +/* + * Supporting hoas quote pattern with bounded type variable + * is future todo. + */ import scala.quoted.* +import scala.language.experimental.quotedPatternsWithPolymorphicFunctions def test(body: Expr[Any])(using Quotes): Expr[String] = body match diff --git a/tests/neg-macros/quoted-pattern-with-type-params-regression.check b/tests/neg-macros/quoted-pattern-with-type-params-regression.check new file mode 100644 index 000000000000..8e79366889a1 --- /dev/null +++ b/tests/neg-macros/quoted-pattern-with-type-params-regression.check @@ -0,0 +1,16 @@ +-- Error: tests/neg-macros/quoted-pattern-with-type-params.scala:8:31 -------------------------------------------------- +8 | case '{ [A] => (x : A) => $b[A] : (A => A) } => ??? // error + | ^ + | Type must be fully defined. + | Consider annotating the splice using a type ascription: + | (${b}: XYZ). +-- Error: tests/neg-macros/quoted-pattern-with-type-params.scala:9:33 -------------------------------------------------- +9 | case '{ [A] => (x : A) => $b(x) : (A => A) } => ??? // error + | ^ + | Type variables that this argument depends on are not captured in this hoas pattern +-- Error: tests/neg-macros/quoted-pattern-with-type-params.scala:10:24 ------------------------------------------------- +10 | case '{ (a:Int) => $b[Int](a) : String } => ??? // error + | ^ + | Type must be fully defined. + | Consider annotating the splice using a type ascription: + | (${b}: XYZ). diff --git a/tests/neg-custom-args/quoted-pattern-poly/quoted-pattern-with-type-params.scala b/tests/neg-macros/quoted-pattern-with-type-params-regression.scala similarity index 83% rename from tests/neg-custom-args/quoted-pattern-poly/quoted-pattern-with-type-params.scala rename to tests/neg-macros/quoted-pattern-with-type-params-regression.scala index bf9cf5dd4052..aa2489bc440b 100644 --- a/tests/neg-custom-args/quoted-pattern-poly/quoted-pattern-with-type-params.scala +++ b/tests/neg-macros/quoted-pattern-with-type-params-regression.scala @@ -1,3 +1,6 @@ +/** + * Refer to: quoted-pattern-with-type-params.scala + */ import scala.quoted.* def test(body: Expr[Any])(using Quotes): Expr[String] = diff --git a/tests/neg-macros/quoted-pattern-with-type-params.check b/tests/neg-macros/quoted-pattern-with-type-params.check index 8e79366889a1..ae4f9ee2a3c1 100644 --- a/tests/neg-macros/quoted-pattern-with-type-params.check +++ b/tests/neg-macros/quoted-pattern-with-type-params.check @@ -1,16 +1,12 @@ --- Error: tests/neg-macros/quoted-pattern-with-type-params.scala:8:31 -------------------------------------------------- -8 | case '{ [A] => (x : A) => $b[A] : (A => A) } => ??? // error - | ^ - | Type must be fully defined. - | Consider annotating the splice using a type ascription: - | (${b}: XYZ). --- Error: tests/neg-macros/quoted-pattern-with-type-params.scala:9:33 -------------------------------------------------- -9 | case '{ [A] => (x : A) => $b(x) : (A => A) } => ??? // error +-- Error: tests/neg-custom-args/quoted-pattern-poly/quoted-pattern-with-type-params.scala:5:32 ------------------------- +5 | case '{ [A] => (x : A) => $b[A] : (A => A) } => ??? // error + | ^^^^^ + | Implementation restriction: A higher-order pattern must carry value arguments +-- Error: tests/neg-custom-args/quoted-pattern-poly/quoted-pattern-with-type-params.scala:6:33 ------------------------- +6 | case '{ [A] => (x : A) => $b(x) : (A => A) } => ??? // error | ^ | Type variables that this argument depends on are not captured in this hoas pattern --- Error: tests/neg-macros/quoted-pattern-with-type-params.scala:10:24 ------------------------------------------------- -10 | case '{ (a:Int) => $b[Int](a) : String } => ??? // error - | ^ - | Type must be fully defined. - | Consider annotating the splice using a type ascription: - | (${b}: XYZ). +-- Error: tests/neg-custom-args/quoted-pattern-poly/quoted-pattern-with-type-params.scala:7:26 ------------------------- +7 | case '{ (a:Int) => $b[Int](a) : String } => ??? // error + | ^^^ + | Type arguments of a hoas pattern needs to be defined inside the quoted pattern diff --git a/tests/neg-macros/quoted-pattern-with-type-params.scala b/tests/neg-macros/quoted-pattern-with-type-params.scala index b8f30e79dfe6..2e4a059ee23a 100644 --- a/tests/neg-macros/quoted-pattern-with-type-params.scala +++ b/tests/neg-macros/quoted-pattern-with-type-params.scala @@ -1,7 +1,5 @@ -/** - * Refer to: neg-custom-args/quoted-pattern-poly/quoted-pattern-with-type-params.scala - */ import scala.quoted.* +import scala.language.experimental.quotedPatternsWithPolymorphicFunctions def test(body: Expr[Any])(using Quotes): Expr[String] = body match diff --git a/tests/pos-custom-args/quoted-pattern-poly/quoted-patten-with-type-params.scala b/tests/pos-macros/quoted-patten-with-type-params.scala similarity index 88% rename from tests/pos-custom-args/quoted-pattern-poly/quoted-patten-with-type-params.scala rename to tests/pos-macros/quoted-patten-with-type-params.scala index b127eaec5312..030e3415476e 100644 --- a/tests/pos-custom-args/quoted-pattern-poly/quoted-patten-with-type-params.scala +++ b/tests/pos-macros/quoted-patten-with-type-params.scala @@ -1,4 +1,5 @@ import scala.quoted.* +import scala.language.experimental.quotedPatternsWithPolymorphicFunctions def test(body: Expr[Any])(using Quotes): Expr[String] = body match diff --git a/tests/run-custom-args/quoted-pattern-poly/quote-match-poly-function-regression.check b/tests/run-macros/quote-match-poly-function-1-regression.check similarity index 100% rename from tests/run-custom-args/quoted-pattern-poly/quote-match-poly-function-regression.check rename to tests/run-macros/quote-match-poly-function-1-regression.check diff --git a/tests/run-custom-args/quoted-pattern-poly/quote-match-poly-function-regression/Macro_1.scala b/tests/run-macros/quote-match-poly-function-1-regression/Macro_1.scala similarity index 100% rename from tests/run-custom-args/quoted-pattern-poly/quote-match-poly-function-regression/Macro_1.scala rename to tests/run-macros/quote-match-poly-function-1-regression/Macro_1.scala diff --git a/tests/run-custom-args/quoted-pattern-poly/quote-match-poly-function-regression/Test_2.scala b/tests/run-macros/quote-match-poly-function-1-regression/Test_2.scala similarity index 100% rename from tests/run-custom-args/quoted-pattern-poly/quote-match-poly-function-regression/Test_2.scala rename to tests/run-macros/quote-match-poly-function-1-regression/Test_2.scala diff --git a/tests/run-macros/quote-match-poly-function-regression.check b/tests/run-macros/quote-match-poly-function-1.check similarity index 100% rename from tests/run-macros/quote-match-poly-function-regression.check rename to tests/run-macros/quote-match-poly-function-1.check diff --git a/tests/run-macros/quote-match-poly-function-regression/Macro_1.scala b/tests/run-macros/quote-match-poly-function-1/Macro_1.scala similarity index 82% rename from tests/run-macros/quote-match-poly-function-regression/Macro_1.scala rename to tests/run-macros/quote-match-poly-function-1/Macro_1.scala index a148fdee3d27..07fd18ccabb7 100644 --- a/tests/run-macros/quote-match-poly-function-regression/Macro_1.scala +++ b/tests/run-macros/quote-match-poly-function-1/Macro_1.scala @@ -1,4 +1,5 @@ import scala.quoted.* +import scala.language.experimental.quotedPatternsWithPolymorphicFunctions inline def testExpr(inline body: Any) = ${ testExprImpl1('body) } def testExprImpl1(body: Expr[Any])(using Quotes): Expr[String] = diff --git a/tests/run-macros/quote-match-poly-function-regression/Test_2.scala b/tests/run-macros/quote-match-poly-function-1/Test_2.scala similarity index 100% rename from tests/run-macros/quote-match-poly-function-regression/Test_2.scala rename to tests/run-macros/quote-match-poly-function-1/Test_2.scala diff --git a/tests/run-custom-args/quoted-pattern-poly/quote-match-poly-function.check b/tests/run-macros/quote-match-poly-function-2.check similarity index 100% rename from tests/run-custom-args/quoted-pattern-poly/quote-match-poly-function.check rename to tests/run-macros/quote-match-poly-function-2.check diff --git a/tests/run-custom-args/quoted-pattern-poly/quote-match-poly-function/Macro_1.scala b/tests/run-macros/quote-match-poly-function-2/Macro_1.scala similarity index 94% rename from tests/run-custom-args/quoted-pattern-poly/quote-match-poly-function/Macro_1.scala rename to tests/run-macros/quote-match-poly-function-2/Macro_1.scala index 2e45da14a0f0..8b5d5a85942a 100644 --- a/tests/run-custom-args/quoted-pattern-poly/quote-match-poly-function/Macro_1.scala +++ b/tests/run-macros/quote-match-poly-function-2/Macro_1.scala @@ -1,4 +1,5 @@ import scala.quoted.* +import scala.language.experimental.quotedPatternsWithPolymorphicFunctions inline def testExpr(inline body: Any) = ${ testExprImpl1('body) } def testExprImpl1(body: Expr[Any])(using Quotes): Expr[String] = diff --git a/tests/run-custom-args/quoted-pattern-poly/quote-match-poly-function/Test_2.scala b/tests/run-macros/quote-match-poly-function-2/Test_2.scala similarity index 100% rename from tests/run-custom-args/quoted-pattern-poly/quote-match-poly-function/Test_2.scala rename to tests/run-macros/quote-match-poly-function-2/Test_2.scala