@@ -25,16 +25,16 @@ object Dependencies:
2525 * - 1.1.2-M2 -> 1.1.2-M3 is a patch update
2626 */
2727 def compareVersions (oldVersion : Version , newVersion : Version ): VersionDiff =
28- if oldVersion.major != newVersion.major then MajorUpdate
28+ if oldVersion.major != newVersion.major then VersionDiff . MajorUpdate
2929 else if oldVersion.minor != newVersion.minor then
30- if oldVersion.minor < newVersion.minor then MinorUpdate
31- else MajorUpdate
32- else if oldVersion.patch != newVersion.patch then PatchUpdate
30+ if oldVersion.minor < newVersion.minor then VersionDiff . MinorUpdate
31+ else VersionDiff . MajorUpdate
32+ else if oldVersion.patch != newVersion.patch then VersionDiff . PatchUpdate
3333 else if oldVersion.suffix != newVersion.suffix then
3434 oldVersion match
35- case Version (_, 0 , 0 , _) => MajorUpdate
36- case Version (_, _, 0 , _) => MinorUpdate
37- case _ => PatchUpdate
35+ case Version (_, 0 , 0 , _) => VersionDiff . MajorUpdate
36+ case Version (_, _, 0 , _) => VersionDiff . MinorUpdate
37+ case _ => VersionDiff . PatchUpdate
3838 else throw new IllegalArgumentException (" Versions are the same: " + oldVersion + " -> " + newVersion)
3939
4040 /**
@@ -49,11 +49,13 @@ object Dependencies:
4949 case _ => None
5050
5151
52- sealed abstract class VersionDiff (val order : Int ) extends Ordered [VersionDiff ]:
52+ enum VersionDiff (val order : Int ) extends Ordered [VersionDiff ]:
53+ case PatchUpdate extends VersionDiff (0 )
54+ case MinorUpdate extends VersionDiff (1 )
55+ case MajorUpdate extends VersionDiff (2 )
56+
5357 def compare (that : VersionDiff ): Int = order compare that.order
54- case object PatchUpdate extends VersionDiff (0 )
55- case object MinorUpdate extends VersionDiff (1 )
56- case object MajorUpdate extends VersionDiff (2 )
58+
5759
5860 object VersionString :
5961 def unapply (s : String ): Option [Version ] = Version .parse(s)
0 commit comments