Add Flag.IS_VALUE for value classes to kotlinx-metadata-jvm
#KT-44783 Fixed
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
|
||||
## 0.2.1
|
||||
|
||||
- Deprecate `KotlinClassHeader.bytecodeVersion` and `KotlinClassHeader`'s constructor that takes a bytecode version array.
|
||||
- [KT-44783](https://youtrack.jetbrains.com/issue/KT-44783) Add Flag.IS_VALUE for value classes
|
||||
- Breaking change: `Flag.IS_INLINE` is deprecated, use `Flag.IS_VALUE` instead
|
||||
- Breaking change: deprecate `KotlinClassHeader.bytecodeVersion` and `KotlinClassHeader`'s constructor that takes a bytecode version array.
|
||||
Related to ['KT-41758`](https://youtrack.jetbrains.com/issue/KT-41758).
|
||||
|
||||
## 0.2.0
|
||||
|
||||
@@ -202,11 +202,19 @@ class Flag(private val offset: Int, private val bitWidth: Int, private val value
|
||||
@JvmField
|
||||
val IS_EXPECT = Flag(F.IS_EXPECT_CLASS)
|
||||
|
||||
@JvmField
|
||||
@Deprecated(
|
||||
"Use IS_VALUE instead, which returns true if the class is either a pre-1.5 inline class, or a 1.5+ value class.",
|
||||
level = DeprecationLevel.ERROR
|
||||
)
|
||||
@Suppress("unused")
|
||||
val IS_INLINE = Flag(F.IS_INLINE_CLASS)
|
||||
|
||||
/**
|
||||
* Signifies that the corresponding class is `inline`.
|
||||
* Signifies that the corresponding class is either a pre-Kotlin-1.5 `inline` class, or a 1.5+ `value` class.
|
||||
*/
|
||||
@JvmField
|
||||
val IS_INLINE = Flag(F.IS_INLINE_CLASS)
|
||||
val IS_VALUE = Flag(F.IS_INLINE_CLASS)
|
||||
|
||||
/**
|
||||
* Signifies that the corresponding class is a functional interface, i.e. marked with the keyword `fun`.
|
||||
|
||||
@@ -946,7 +946,7 @@ private val CLASS_FLAGS_MAP = COMMON_FLAGS_MAP + mapOf(
|
||||
Flag.Class.IS_DATA to "data",
|
||||
Flag.Class.IS_EXTERNAL to "external",
|
||||
Flag.Class.IS_EXPECT to "expect",
|
||||
Flag.Class.IS_INLINE to "inline",
|
||||
Flag.Class.IS_VALUE to "value",
|
||||
Flag.Class.IS_FUN to "fun",
|
||||
|
||||
Flag.Class.IS_CLASS to "class",
|
||||
|
||||
+5
@@ -109,6 +109,11 @@ public class KotlinpTestGenerated extends AbstractKotlinpTest {
|
||||
runTest("libraries/tools/kotlinp/testData/TypeParameters.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ValueClass.kt")
|
||||
public void testValueClass() throws Exception {
|
||||
runTest("libraries/tools/kotlinp/testData/ValueClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("VersionRequirement.kt")
|
||||
public void testVersionRequirement() throws Exception {
|
||||
runTest("libraries/tools/kotlinp/testData/VersionRequirement.kt");
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
@JvmInline
|
||||
value class Z(val s: String)
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// Z.class
|
||||
// ------------------------------------------
|
||||
// requires language version 1.3.0 (level=ERROR)
|
||||
public final value class Z : kotlin/Any {
|
||||
|
||||
// requires language version 1.3.0 (level=ERROR)
|
||||
// signature: constructor-impl(Ljava/lang/String;)Ljava/lang/String;
|
||||
public constructor(s: kotlin/String)
|
||||
|
||||
// signature: equals-impl(Ljava/lang/String;Ljava/lang/Object;)Z
|
||||
public open /* synthesized */ operator fun equals(other: kotlin/Any?): kotlin/Boolean
|
||||
|
||||
// signature: hashCode-impl(Ljava/lang/String;)I
|
||||
public open /* synthesized */ fun hashCode(): kotlin/Int
|
||||
|
||||
// signature: toString-impl(Ljava/lang/String;)Ljava/lang/String;
|
||||
public open /* synthesized */ fun toString(): kotlin/String
|
||||
|
||||
// field: s:Ljava/lang/String;
|
||||
// getter: getS()Ljava/lang/String;
|
||||
public final val s: kotlin/String
|
||||
public final get
|
||||
|
||||
// module name: test-module
|
||||
}
|
||||
// META-INF/test-module.kotlin_module
|
||||
// ------------------------------------------
|
||||
module {
|
||||
}
|
||||
@@ -90,7 +90,7 @@ internal fun CirClass.classFlags(isExpect: Boolean): Flags =
|
||||
Flag.Class.IS_DATA.takeIf { isData },
|
||||
Flag.Class.IS_EXTERNAL.takeIf { isExternal },
|
||||
Flag.Class.IS_EXPECT.takeIf { isExpect },
|
||||
Flag.Class.IS_INLINE.takeIf { isInline },
|
||||
Flag.Class.IS_VALUE.takeIf { isInline },
|
||||
//Flag.Class.IS_FUN.takeIf { false }
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -993,7 +993,7 @@ class MetadataDeclarationsComparator private constructor(private val config: Con
|
||||
Flag.Class::IS_DATA,
|
||||
Flag.Class::IS_EXTERNAL,
|
||||
Flag.Class::IS_EXPECT,
|
||||
Flag.Class::IS_INLINE,
|
||||
Flag.Class::IS_VALUE,
|
||||
Flag.Class::IS_FUN
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user