kotlinx-metadata: Wrong interpretation of Flag.Constructor.IS_PRIMARY
^KT-42429
This commit is contained in:
@@ -53,7 +53,7 @@ class MetadataSmokeTest {
|
||||
val klass = KmClass().apply {
|
||||
name = "Hello"
|
||||
flags = flagsOf(Flag.IS_PUBLIC)
|
||||
constructors += KmConstructor(flagsOf(Flag.IS_PUBLIC, Flag.Constructor.IS_PRIMARY)).apply {
|
||||
constructors += KmConstructor(flagsOf(Flag.IS_PUBLIC)).apply {
|
||||
signature = JvmMethodSignature("<init>", "()V")
|
||||
}
|
||||
functions += KmFunction(flagsOf(Flag.IS_PUBLIC, Flag.Function.IS_DECLARATION), "hello").apply {
|
||||
|
||||
@@ -219,11 +219,19 @@ class Flag(private val offset: Int, private val bitWidth: Int, private val value
|
||||
* A container of flags applicable to Kotlin constructors.
|
||||
*/
|
||||
object Constructor {
|
||||
@JvmField
|
||||
@Deprecated(
|
||||
"Use IS_SECONDARY which holds inverted value instead.",
|
||||
ReplaceWith("Flag.Constructor.IS_SECONDARY"),
|
||||
level = DeprecationLevel.ERROR
|
||||
)
|
||||
val IS_PRIMARY = Flag(F.IS_SECONDARY, 0)
|
||||
|
||||
/**
|
||||
* Signifies that the corresponding constructor is primary, i.e. declared in the class header, not in the class body.
|
||||
* Signifies that the corresponding constructor is secondary, i.e. declared not in the class header, but in the class body.
|
||||
*/
|
||||
@JvmField
|
||||
val IS_PRIMARY = Flag(F.IS_SECONDARY, 0)
|
||||
val IS_SECONDARY = Flag(F.IS_SECONDARY)
|
||||
|
||||
/**
|
||||
* Signifies that the corresponding constructor has non-stable parameter names, i.e. cannot be called with named arguments.
|
||||
|
||||
@@ -958,7 +958,7 @@ private val CLASS_FLAGS_MAP = COMMON_FLAGS_MAP + mapOf(
|
||||
)
|
||||
|
||||
private val CONSTRUCTOR_FLAGS_MAP = VISIBILITY_FLAGS_MAP + mapOf(
|
||||
Flag.Constructor.IS_PRIMARY to "/* primary */",
|
||||
Flag.Constructor.IS_SECONDARY to "/* secondary */",
|
||||
Flag.Constructor.HAS_NON_STABLE_PARAMETER_NAMES to "/* non-stable parameter names */"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user