Write patch version for VersionRequirement correctly

This commit is contained in:
Alexander Udalov
2017-10-10 12:18:59 +02:00
parent 6f2e6db131
commit 00c846a160
3 changed files with 14 additions and 1 deletions
@@ -615,7 +615,7 @@ class DescriptorSerializer private constructor(
val major = matchResult.groupValues.getOrNull(1)?.toIntOrNull() ?: return null
val minor = matchResult.groupValues.getOrNull(2)?.toIntOrNull() ?: 0
val patch = matchResult.groupValues.getOrNull(3)?.toIntOrNull() ?: 0
val patch = matchResult.groupValues.getOrNull(4)?.toIntOrNull() ?: 0
val proto = ProtoBuf.VersionRequirement.newBuilder()
VersionRequirement.Version(major, minor, patch).encode(
+7
View File
@@ -0,0 +1,7 @@
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
package test
import kotlin.internal.RequireKotlin
@RequireKotlin("1.1.50", level = DeprecationLevel.HIDDEN)
class Klass
@@ -139,4 +139,10 @@ class VersionRequirementTest : TestCaseWithTmpdir() {
"test.property"
)
}
fun testPatchVersion() {
doTest(VersionRequirement.Version(1, 1, 50), DeprecationLevel.HIDDEN, null, ProtoBuf.VersionRequirement.VersionKind.LANGUAGE_VERSION, null,
"test.Klass"
)
}
}