From fa605ea5b153478c9b8c27a4a98059badfa08b97 Mon Sep 17 00:00:00 2001 From: odersky Date: Sun, 13 Nov 2022 13:27:24 +0100 Subject: [PATCH 1/2] Make 3.3 the default source version --- compiler/src/dotty/tools/dotc/config/SourceVersion.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/config/SourceVersion.scala b/compiler/src/dotty/tools/dotc/config/SourceVersion.scala index 4a252eeb64c6..4b9b1b247856 100644 --- a/compiler/src/dotty/tools/dotc/config/SourceVersion.scala +++ b/compiler/src/dotty/tools/dotc/config/SourceVersion.scala @@ -19,7 +19,7 @@ enum SourceVersion: def isAtLeast(v: SourceVersion) = stable.ordinal >= v.ordinal object SourceVersion extends Property.Key[SourceVersion]: - def defaultSourceVersion = `3.2` + def defaultSourceVersion = `3.3` /** language versions that may appear in a language import, are deprecated, but not removed from the standard library. */ val illegalSourceVersionNames = List("3.1-migration").map(_.toTermName) From e0a5adb57a9e58493a66077317b2ef230e62dd85 Mon Sep 17 00:00:00 2001 From: odersky Date: Sun, 13 Nov 2022 16:08:54 +0100 Subject: [PATCH 2/2] Fix tests to work under 3.3 default source version --- .../dotty/tools/repl/ReplCompilerTests.scala | 21 --------- tests/neg/i4373b.scala | 6 +-- tests/neg/indent-colons.check | 44 +++++++++---------- tests/neg/indent-colons.scala | 1 + 4 files changed, 26 insertions(+), 46 deletions(-) diff --git a/compiler/test/dotty/tools/repl/ReplCompilerTests.scala b/compiler/test/dotty/tools/repl/ReplCompilerTests.scala index 866647476888..bcb08cd232d7 100644 --- a/compiler/test/dotty/tools/repl/ReplCompilerTests.scala +++ b/compiler/test/dotty/tools/repl/ReplCompilerTests.scala @@ -347,27 +347,6 @@ class ReplCompilerTests extends ReplTest: assertEquals("java.lang.AssertionError: assertion failed", all.head) } - @Test def i14491 = - initially { - run("import language.experimental.fewerBraces") - } andThen { - run("""|val x = Seq(7,8,9).apply: - | 1 - |""".stripMargin) - assertEquals("val x: Int = 8", storedOutput().trim) - } - initially { - run("""|import language.experimental.fewerBraces - |import language.experimental.fewerBraces as _ - |""".stripMargin) - } andThen { - run("""|val x = Seq(7,8,9).apply: - | 1 - |""".stripMargin) - assert("expected error if fewerBraces is unimported", - lines().exists(_.contains("missing arguments for method apply"))) - } - object ReplCompilerTests: private val pattern = Pattern.compile("\\r[\\n]?|\\n"); diff --git a/tests/neg/i4373b.scala b/tests/neg/i4373b.scala index 45b60a46c721..93d967ef7778 100644 --- a/tests/neg/i4373b.scala +++ b/tests/neg/i4373b.scala @@ -1,5 +1,5 @@ // ==> 05bef7805687ba94da37177f7568e3ba7da1f91c.scala <== class x0 { - x1: - x0 | _ // error -// error \ No newline at end of file + x1: // error + x0 | _ + // error \ No newline at end of file diff --git a/tests/neg/indent-colons.check b/tests/neg/indent-colons.check index 06bd7a31b079..102d41592014 100644 --- a/tests/neg/indent-colons.check +++ b/tests/neg/indent-colons.check @@ -1,29 +1,29 @@ --- Error: tests/neg/indent-colons.scala:6:4 ---------------------------------------------------------------------------- -6 | : // error +-- Error: tests/neg/indent-colons.scala:7:4 ---------------------------------------------------------------------------- +7 | : // error | ^ | end of statement expected but ':' found --- Error: tests/neg/indent-colons.scala:12:2 --------------------------------------------------------------------------- -12 | : // error +-- Error: tests/neg/indent-colons.scala:13:2 --------------------------------------------------------------------------- +13 | : // error | ^ | end of statement expected but ':' found --- Error: tests/neg/indent-colons.scala:19:2 --------------------------------------------------------------------------- -19 | : // error +-- Error: tests/neg/indent-colons.scala:20:2 --------------------------------------------------------------------------- +20 | : // error | ^ | end of statement expected but ':' found --- [E018] Syntax Error: tests/neg/indent-colons.scala:26:14 ------------------------------------------------------------ -26 | val y = 1 + : // error +-- [E018] Syntax Error: tests/neg/indent-colons.scala:27:14 ------------------------------------------------------------ +27 | val y = 1 + : // error | ^ | expression expected but : found | | longer explanation available when compiling with `-explain` --- [E018] Syntax Error: tests/neg/indent-colons.scala:30:27 ------------------------------------------------------------ -30 | val all = credentials ++ : // error +-- [E018] Syntax Error: tests/neg/indent-colons.scala:31:27 ------------------------------------------------------------ +31 | val all = credentials ++ : // error | ^ | expression expected but : found | | longer explanation available when compiling with `-explain` --- [E134] Type Error: tests/neg/indent-colons.scala:23:12 -------------------------------------------------------------- -23 | val x = 1.+ : // error +-- [E134] Type Error: tests/neg/indent-colons.scala:24:12 -------------------------------------------------------------- +24 | val x = 1.+ : // error | ^^^ | None of the overloaded alternatives of method + in class Int with types | (x: Double): Double @@ -35,27 +35,27 @@ | (x: Byte): Int | (x: String): String | match expected type (2 : Int) --- [E006] Not Found Error: tests/neg/indent-colons.scala:32:7 ---------------------------------------------------------- -32 | if file.isEmpty // error +-- [E006] Not Found Error: tests/neg/indent-colons.scala:33:7 ---------------------------------------------------------- +33 | if file.isEmpty // error | ^^^^ | Not found: file | | longer explanation available when compiling with `-explain` --- [E006] Not Found Error: tests/neg/indent-colons.scala:34:13 --------------------------------------------------------- -34 | else Seq(file) // error +-- [E006] Not Found Error: tests/neg/indent-colons.scala:35:13 --------------------------------------------------------- +35 | else Seq(file) // error | ^^^^ | Not found: file | | longer explanation available when compiling with `-explain` --- Error: tests/neg/indent-colons.scala:4:2 ---------------------------------------------------------------------------- -4 | tryEither: // error +-- Error: tests/neg/indent-colons.scala:5:2 ---------------------------------------------------------------------------- +5 | tryEither: // error | ^^^^^^^^^ | missing arguments for method tryEither --- Error: tests/neg/indent-colons.scala:10:2 --------------------------------------------------------------------------- -10 | tryEither: // error +-- Error: tests/neg/indent-colons.scala:11:2 --------------------------------------------------------------------------- +11 | tryEither: // error | ^^^^^^^^^ | missing arguments for method tryEither --- Error: tests/neg/indent-colons.scala:17:2 --------------------------------------------------------------------------- -17 | Some(3).fold: // error +-- Error: tests/neg/indent-colons.scala:18:2 --------------------------------------------------------------------------- +18 | Some(3).fold: // error | ^^^^^^^^^^^^ | missing arguments for method fold in class Option diff --git a/tests/neg/indent-colons.scala b/tests/neg/indent-colons.scala index 5364713dd4aa..240012f5489b 100644 --- a/tests/neg/indent-colons.scala +++ b/tests/neg/indent-colons.scala @@ -1,3 +1,4 @@ +import language.`3.2` def tryEither[T](x: T)(y: Int => T): T = ??? def test1 =