@@ -6,7 +6,8 @@ import core.Decorators.*
6
6
import util .Property
7
7
8
8
enum SourceVersion :
9
- case `3.0-migration`, `3.0`, `3.1` // Note: do not add `3.1-migration` here, 3.1 is the same language as 3.0.
9
+ case `3.0-migration`, `3.0`
10
+ case `3.1-migration`, `3.1`
10
11
case `3.2-migration`, `3.2`
11
12
case `3.3-migration`, `3.3`
12
13
case `future-migration`, `future`
@@ -21,10 +22,17 @@ enum SourceVersion:
21
22
def isAtMost (v : SourceVersion ) = stable.ordinal <= v.ordinal
22
23
23
24
object SourceVersion extends Property .Key [SourceVersion ]:
25
+
24
26
def defaultSourceVersion = `3.3`
25
27
28
+ /* Illegal source versions that may not appear in the settings `-source:<...>` */
29
+ val illegalInSettings = List (`3.1-migration`, `never`)
30
+
31
+ /* Illegal source versions that may not appear as an import `import scala.language.<...>` */
32
+ val illegalInImports = List (`3.1-migration`, `never`)
33
+
26
34
/** language versions that may appear in a language import, are deprecated, but not removed from the standard library. */
27
- val illegalSourceVersionNames = List ( " 3.1-migration" ) .map(_.toTermName)
35
+ val illegalSourceVersionNames = " 3.1-migration" :: illegalInImports .map(_.toString .toTermName)
28
36
29
37
/** language versions that the compiler recognises. */
30
38
val validSourceVersionNames = values.toList.map(_.toString.toTermName)
0 commit comments