Skip to content

Commit 131ceb1

Browse files
committed
Fix #18609: Add language.3.4 and language.3.4-migration.
1 parent 982c91b commit 131ceb1

File tree

6 files changed

+22
-0
lines changed

6 files changed

+22
-0
lines changed

Diff for: compiler/src/dotty/tools/dotc/config/SourceVersion.scala

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ enum SourceVersion:
1010
case `3.2-migration`, `3.2`
1111
case `3.3-migration`, `3.3`
1212
case `3.4-migration`, `3.4`
13+
// !!! Keep in sync with scala.runtime.stdlibPatches.language !!!
1314
case `future-migration`, `future`
1415

1516
val isMigrating: Boolean = toString.endsWith("-migration")

Diff for: library/src/scala/runtime/stdLibPatches/language.scala

+17
Original file line numberDiff line numberDiff line change
@@ -231,4 +231,21 @@ object language:
231231
@compileTimeOnly("`3.3` can only be used at compile time in import statements")
232232
object `3.3`
233233

234+
/** Set source version to 3.4-migration.
235+
*
236+
* @see [[https://docs.scala-lang.org/scala3/guides/migration/compatibility-intro.html]]
237+
*/
238+
@compileTimeOnly("`3.4-migration` can only be used at compile time in import statements")
239+
object `3.4-migration`
240+
241+
/** Set source version to 3.4
242+
*
243+
* @see [[https://docs.scala-lang.org/scala3/guides/migration/compatibility-intro.html]]
244+
*/
245+
@compileTimeOnly("`3.4` can only be used at compile time in import statements")
246+
object `3.4`
247+
248+
// !!! Keep in sync with dotty.tools.dotc.config.SourceVersion !!!
249+
// Also add tests in `tests/pos/source-import-3-x.scala` and `tests/pos/source-import-3-x-migration.scala`
250+
234251
end language

Diff for: tests/pos/source-import-3-3-migration.scala

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import language.`3.3-migration`

Diff for: tests/pos/source-import-3-3.scala

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import language.`3.3`

Diff for: tests/pos/source-import-3-4-migration.scala

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import language.`3.4-migration`

Diff for: tests/pos/source-import-3-4.scala

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import language.`3.4`

0 commit comments

Comments
 (0)