@@ -8,7 +8,8 @@ import Feature.isPreviewEnabled
88import util .Property
99
1010enum 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`
1213 case `3.2-migration`, `3.2`
1314 case `3.3-migration`, `3.3`
1415 case `3.4-migration`, `3.4`
@@ -40,10 +41,18 @@ enum SourceVersion:
4041 def enablesBetterFors (using Context ) = isAtLeast(`3.7`) && isPreviewEnabled
4142
4243object 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`)
4453
4554 /** 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)
4756
4857 /** language versions that the compiler recognises. */
4958 val validSourceVersionNames = values.toList.map(_.toString.toTermName)
0 commit comments