Do not write version requirements for InlineClasses

Language feature InlineClasses is enabled since 1.3. The current lowest
supported language version is 1.4, so any compiler that can read
binaries produced by the current compiler also supports inline classes,
which means that the version requirement is not needed anymore.

No issue reported because it's mostly not a user-visible change. The
main effect is that it reduces differences in metadata between K1 and
K2, because K2 never supported writing this version requirement properly
due to the TODO in `hasInlineClassTypesInSignature`.
This commit is contained in:
Alexander Udalov
2023-07-27 12:17:23 +02:00
committed by Space Team
parent 9e50a3b71d
commit afd35accd8
8 changed files with 7 additions and 172 deletions
@@ -227,21 +227,4 @@ abstract class AbstractVersionRequirementTest : TestCaseWithTmpdir() {
)
)
}
fun testInlineClassesAndRelevantDeclarations13() {
doTest(
VersionRequirement.Version(1, 3), DeprecationLevel.ERROR, null, ProtoBuf.VersionRequirement.VersionKind.LANGUAGE_VERSION, null,
fqNamesWithRequirements = listOf(
"test.IC",
"test.Ctor.<init>",
"test.simpleFun",
"test.aliasedFun",
"test.simpleProp",
"test.result",
"test.Foo",
"test.Bar"
),
shouldBeSingleRequirement = false
)
}
}
@@ -112,8 +112,7 @@ class JvmVersionRequirementTest : AbstractVersionRequirementTest() {
fun testInlineClassReturnTypeMangled() {
// Class members returning inline class values are mangled,
// and have "since 1.4", "require 1.4.30" version requirement along with
// "since 1.3" version requirement for inline class in signature
// and have "language >= 1.4" and "compiler >= 1.4.30" version requirements.
doTest(
VersionRequirement.Version(1, 4, 0), DeprecationLevel.ERROR, null, LANGUAGE_VERSION, null,
fqNamesWithRequirements = listOf(
@@ -126,36 +125,11 @@ class JvmVersionRequirementTest : AbstractVersionRequirementTest() {
doTest(
VersionRequirement.Version(1, 4, 30), DeprecationLevel.ERROR, null, COMPILER_VERSION, null,
fqNamesWithRequirements = listOf(
"test.C.propertyOfInlineClassType",
"test.C.returnsInlineClassType",
),
shouldBeSingleRequirement = false,
customLanguageVersion = LanguageVersion.KOTLIN_1_4
)
// Top-level functions and properties returning inline class values are NOT mangled,
// and have "since 1.3" version requirement for inline class in signature only.
doTest(
VersionRequirement.Version(1, 3, 0), DeprecationLevel.ERROR, null, LANGUAGE_VERSION, null,
fqNamesWithRequirements = listOf(
"test.propertyOfInlineClassType",
"test.returnsInlineClassType",
),
shouldBeSingleRequirement = false,
customLanguageVersion = LanguageVersion.KOTLIN_1_4
)
// In Kotlin 1.3, all functions and properties returning inline class values are NOT mangled,
// and have "since 1.3" version requirement for inline class in signature only.
doTest(
VersionRequirement.Version(1, 3, 0), DeprecationLevel.ERROR, null, LANGUAGE_VERSION, null,
fqNamesWithRequirements = listOf(
"test.propertyOfInlineClassType",
"test.C.propertyOfInlineClassType",
"test.C.returnsInlineClassTypeJvmName",
"test.returnsInlineClassType",
"test.C.returnsInlineClassType"
),
shouldBeSingleRequirement = true,
customLanguageVersion = LanguageVersion.KOTLIN_1_3
customLanguageVersion = LanguageVersion.KOTLIN_1_4,
shouldBeSingleRequirement = false,
)
}