@@ -6,46 +6,35 @@ import SourceVersion.*
66import Feature .*
77import core .Contexts .Context
88
9- class MigrationVersion (
10- val warnFrom : SourceVersion ,
11- val errorFrom : SourceVersion ):
12- require(warnFrom.ordinal <= errorFrom.ordinal)
13-
14- def needsPatch (using Context ): Boolean =
15- sourceVersion.isMigrating && sourceVersion.isAtLeast(warnFrom)
16-
17- def patchFrom : SourceVersion =
18- warnFrom.prevMigrating
19-
20- object MigrationVersion :
21-
22- val Scala2to3 = MigrationVersion (`3.0`, `3.0`)
23-
24- val OverrideValParameter = MigrationVersion (`3.0`, future)
25-
9+ enum MigrationVersion (val warnFrom : SourceVersion , val errorFrom : SourceVersion ):
10+ case Scala2to3 extends MigrationVersion (`3.0`, `3.0`)
11+ case OverrideValParameter extends MigrationVersion (`3.0`, future)
2612 // we tighten for-comprehension without `case` to error in 3.4,
2713 // but we keep pat-defs as warnings for now ("@unchecked"),
2814 // until we propose an alternative way to assert exhaustivity to the typechecker.
29- val ForComprehensionPatternWithoutCase = MigrationVersion (`3.2`, `3.4`)
30- val ForComprehensionUncheckedPathDefs = MigrationVersion (`3.2`, future)
31-
32- val NonLocalReturns = MigrationVersion (`3.2`, future)
33-
34- val AscriptionAfterPattern = MigrationVersion (`3.3`, future)
15+ case ForComprehensionPatternWithoutCase extends MigrationVersion (`3.2`, `3.4`)
16+ case ForComprehensionUncheckedPathDefs extends MigrationVersion (`3.2`, future)
17+
18+ case NonLocalReturns extends MigrationVersion (`3.2`, future)
19+ case AscriptionAfterPattern extends MigrationVersion (`3.3`, future)
20+ case ExplicitContextBoundArgument extends MigrationVersion (`3.4`, `3.5`)
21+ case AlphanumericInfix extends MigrationVersion (`3.4`, future)
22+ case RemoveThisQualifier extends MigrationVersion (`3.4`, future)
23+ case UninitializedVars extends MigrationVersion (`3.4`, future)
24+ case VarargSpliceAscription extends MigrationVersion (`3.4`, future)
25+ case WildcardType extends MigrationVersion (`3.4`, future)
26+ case WithOperator extends MigrationVersion (`3.4`, future)
27+ case FunctionUnderscore extends MigrationVersion (`3.4`, future)
28+ case ImportWildcard extends MigrationVersion (future, future)
29+ case ImportRename extends MigrationVersion (future, future)
30+ case ParameterEnclosedByParenthesis extends MigrationVersion (future, future)
31+ case XmlLiteral extends MigrationVersion (future, future)
3532
36- val ExplicitContextBoundArgument = MigrationVersion (`3.4`, `3.5` )
33+ require(warnFrom.ordinal <= errorFrom.ordinal )
3734
38- val AlphanumericInfix = MigrationVersion (`3.4`, future)
39- val RemoveThisQualifier = MigrationVersion (`3.4`, future)
40- val UninitializedVars = MigrationVersion (`3.4`, future)
41- val VarargSpliceAscription = MigrationVersion (`3.4`, future)
42- val WildcardType = MigrationVersion (`3.4`, future)
43- val WithOperator = MigrationVersion (`3.4`, future)
44- val FunctionUnderscore = MigrationVersion (`3.4`, future)
35+ def needsPatch (using Context ): Boolean =
36+ sourceVersion.isMigrating && sourceVersion.isAtLeast(warnFrom)
4537
46- val ImportWildcard = MigrationVersion (future, future)
47- val ImportRename = MigrationVersion (future, future)
48- val ParameterEnclosedByParenthesis = MigrationVersion (future, future)
49- val XmlLiteral = MigrationVersion (future, future)
38+ def patchFrom : SourceVersion = warnFrom.prevMigrating
5039
5140end MigrationVersion
0 commit comments