@@ -8,7 +8,8 @@ import Feature.isPreviewEnabled
8
8
import util .Property
9
9
10
10
enum SourceVersion :
11
- 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.
11
+ case `3.0-migration`, `3.0`
12
+ case `3.1-migration`, `3.1`
12
13
case `3.2-migration`, `3.2`
13
14
case `3.3-migration`, `3.3`
14
15
case `3.4-migration`, `3.4`
@@ -40,10 +41,18 @@ enum SourceVersion:
40
41
def enablesBetterFors (using Context ) = isAtLeast(`3.7`) && isPreviewEnabled
41
42
42
43
object SourceVersion extends Property .Key [SourceVersion ]:
43
- def defaultSourceVersion = `3.7`
44
+
45
+ /* The default source version used by the built compiler */
46
+ val defaultSourceVersion = `3.7`
47
+
48
+ /* Illegal source versions that may not appear in the settings `-source:<...>` */
49
+ val illegalInSettings = List (`3.1-migration`, `never`)
50
+
51
+ /* Illegal source versions that may not appear as an import `import scala.language.<...>` */
52
+ val illegalInImports = List (`3.1-migration`, `never`)
44
53
45
54
/** language versions that may appear in a language import, are deprecated, but not removed from the standard library. */
46
- val illegalSourceVersionNames = List ( " 3.1-migration " , " never " ). map(_.toTermName)
55
+ val illegalSourceVersionNames = illegalInImports. map(_.toString .toTermName)
47
56
48
57
/** language versions that the compiler recognises. */
49
58
val validSourceVersionNames = values.toList.map(_.toString.toTermName)
0 commit comments