Skip to content

Commit

Permalink
Fix #18609: Add language.3.4 and language.3.4-migration. (#18610)
Browse files Browse the repository at this point in the history
  • Loading branch information
bishabosha authored Sep 28, 2023
2 parents acee11f + 131ceb1 commit 892d734
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/config/SourceVersion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ enum SourceVersion:
case `3.2-migration`, `3.2`
case `3.3-migration`, `3.3`
case `3.4-migration`, `3.4`
// !!! Keep in sync with scala.runtime.stdlibPatches.language !!!
case `future-migration`, `future`

val isMigrating: Boolean = toString.endsWith("-migration")
Expand Down
17 changes: 17 additions & 0 deletions library/src/scala/runtime/stdLibPatches/language.scala
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,21 @@ object language:
@compileTimeOnly("`3.3` can only be used at compile time in import statements")
object `3.3`

/** Set source version to 3.4-migration.
*
* @see [[https://docs.scala-lang.org/scala3/guides/migration/compatibility-intro.html]]
*/
@compileTimeOnly("`3.4-migration` can only be used at compile time in import statements")
object `3.4-migration`

/** Set source version to 3.4
*
* @see [[https://docs.scala-lang.org/scala3/guides/migration/compatibility-intro.html]]
*/
@compileTimeOnly("`3.4` can only be used at compile time in import statements")
object `3.4`

// !!! Keep in sync with dotty.tools.dotc.config.SourceVersion !!!
// Also add tests in `tests/pos/source-import-3-x.scala` and `tests/pos/source-import-3-x-migration.scala`

end language
1 change: 1 addition & 0 deletions tests/pos/source-import-3-3-migration.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import language.`3.3-migration`
1 change: 1 addition & 0 deletions tests/pos/source-import-3-3.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import language.`3.3`
1 change: 1 addition & 0 deletions tests/pos/source-import-3-4-migration.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import language.`3.4-migration`
1 change: 1 addition & 0 deletions tests/pos/source-import-3-4.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import language.`3.4`

0 comments on commit 892d734

Please sign in to comment.