@@ -6,48 +6,36 @@ import SourceVersion.*
6
6
import Feature .*
7
7
import core .Contexts .Context
8
8
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)
26
12
// we tighten for-comprehension without `case` to error in 3.4,
27
13
// but we keep pat-defs as warnings for now ("@unchecked"),
28
14
// 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)
35
-
36
- val ExplicitContextBoundArgument = MigrationVersion (`3.4`, `3.5`)
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 NonNamedArgumentInJavaAnnotation extends MigrationVersion (`3.6`, `3.6`)
29
+ case ImportWildcard extends MigrationVersion (future, future)
30
+ case ImportRename extends MigrationVersion (future, future)
31
+ case ParameterEnclosedByParenthesis extends MigrationVersion (future, future)
32
+ case XmlLiteral extends MigrationVersion (future, future)
37
33
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)
34
+ require(warnFrom.ordinal <= errorFrom.ordinal)
45
35
46
- val NonNamedArgumentInJavaAnnotation = MigrationVersion (`3.6`, `3.6`)
36
+ def needsPatch (using Context ): Boolean =
37
+ sourceVersion.isMigrating && sourceVersion.isAtLeast(warnFrom)
47
38
48
- val ImportWildcard = MigrationVersion (future, future)
49
- val ImportRename = MigrationVersion (future, future)
50
- val ParameterEnclosedByParenthesis = MigrationVersion (future, future)
51
- val XmlLiteral = MigrationVersion (future, future)
39
+ def patchFrom : SourceVersion = warnFrom.prevMigrating
52
40
53
41
end MigrationVersion
0 commit comments