@@ -6,7 +6,8 @@ import core.Decorators.*
66import util .Property
77
88enum 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`
1011 case `3.2-migration`, `3.2`
1112 case `3.3-migration`, `3.3`
1213 case `future-migration`, `future`
@@ -21,10 +22,17 @@ enum SourceVersion:
2122 def isAtMost (v : SourceVersion ) = stable.ordinal <= v.ordinal
2223
2324object SourceVersion extends Property .Key [SourceVersion ]:
25+
2426 def defaultSourceVersion = `3.3`
2527
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+
2634 /** 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)
2836
2937 /** language versions that the compiler recognises. */
3038 val validSourceVersionNames = values.toList.map(_.toString.toTermName)
0 commit comments