Serialize and deserialize 'header' modifier for descriptors
This fixes KT-17001 because now 'header' modifier is loaded correctly for deserialized members and the standard disambiguation in OverloadingConflictResolver.compareCallsByUsedArguments takes place, where header members are discriminated against the corresponding impl members #KT-17001 Fixed
This commit is contained in:
@@ -185,6 +185,7 @@ message Class {
|
||||
ClassKind
|
||||
isInner
|
||||
isData
|
||||
isHeader
|
||||
*/
|
||||
optional int32 flags = 1 [default = 6 /* public final class, no annotations */];
|
||||
|
||||
@@ -265,6 +266,8 @@ message Function {
|
||||
isInline
|
||||
isTailrec
|
||||
isExternal
|
||||
isSuspend
|
||||
isHeader
|
||||
*/
|
||||
optional int32 flags = 9 [default = 6 /* public final function, no annotations */];
|
||||
optional int32 old_flags = 1 [default = 6];
|
||||
@@ -303,6 +306,7 @@ message Property {
|
||||
hasConstant
|
||||
isExternal
|
||||
isDelegated
|
||||
isHeader
|
||||
*/
|
||||
optional int32 flags = 11 [default = 518 /* public (6) final property with getter (512) */];
|
||||
optional int32 old_flags = 1 [default = 2054];
|
||||
|
||||
@@ -39,6 +39,7 @@ public class Flags {
|
||||
public static final BooleanFlagField IS_INNER = FlagField.booleanAfter(CLASS_KIND);
|
||||
public static final BooleanFlagField IS_DATA = FlagField.booleanAfter(IS_INNER);
|
||||
public static final BooleanFlagField IS_EXTERNAL_CLASS = FlagField.booleanAfter(IS_DATA);
|
||||
public static final BooleanFlagField IS_HEADER_CLASS = FlagField.booleanAfter(IS_EXTERNAL_CLASS);
|
||||
|
||||
// Constructors
|
||||
|
||||
@@ -56,6 +57,7 @@ public class Flags {
|
||||
public static final BooleanFlagField IS_TAILREC = FlagField.booleanAfter(IS_INLINE);
|
||||
public static final BooleanFlagField IS_EXTERNAL_FUNCTION = FlagField.booleanAfter(IS_TAILREC);
|
||||
public static final BooleanFlagField IS_SUSPEND = FlagField.booleanAfter(IS_EXTERNAL_FUNCTION);
|
||||
public static final BooleanFlagField IS_HEADER_FUNCTION = FlagField.booleanAfter(IS_SUSPEND);
|
||||
|
||||
// Properties
|
||||
|
||||
@@ -67,6 +69,7 @@ public class Flags {
|
||||
public static final BooleanFlagField HAS_CONSTANT = FlagField.booleanAfter(IS_LATEINIT);
|
||||
public static final BooleanFlagField IS_EXTERNAL_PROPERTY = FlagField.booleanAfter(HAS_CONSTANT);
|
||||
public static final BooleanFlagField IS_DELEGATED = FlagField.booleanAfter(IS_EXTERNAL_PROPERTY);
|
||||
public static final BooleanFlagField IS_HEADER_PROPERTY = FlagField.booleanAfter(IS_DELEGATED);
|
||||
|
||||
// Parameters
|
||||
|
||||
@@ -94,7 +97,8 @@ public class Flags {
|
||||
boolean inner,
|
||||
boolean isCompanionObject,
|
||||
boolean isData,
|
||||
boolean isExternal
|
||||
boolean isExternal,
|
||||
boolean isHeader
|
||||
) {
|
||||
return HAS_ANNOTATIONS.toFlags(hasAnnotations)
|
||||
| MODALITY.toFlags(modality(modality))
|
||||
@@ -103,6 +107,7 @@ public class Flags {
|
||||
| IS_INNER.toFlags(inner)
|
||||
| IS_DATA.toFlags(isData)
|
||||
| IS_EXTERNAL_CLASS.toFlags(isExternal)
|
||||
| IS_HEADER_CLASS.toFlags(isHeader)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -147,7 +152,8 @@ public class Flags {
|
||||
boolean isInline,
|
||||
boolean isTailrec,
|
||||
boolean isExternal,
|
||||
boolean isSuspend
|
||||
boolean isSuspend,
|
||||
boolean isHeader
|
||||
) {
|
||||
return HAS_ANNOTATIONS.toFlags(hasAnnotations)
|
||||
| VISIBILITY.toFlags(visibility(visibility))
|
||||
@@ -159,6 +165,7 @@ public class Flags {
|
||||
| IS_TAILREC.toFlags(isTailrec)
|
||||
| IS_EXTERNAL_FUNCTION.toFlags(isExternal)
|
||||
| IS_SUSPEND.toFlags(isSuspend)
|
||||
| IS_HEADER_FUNCTION.toFlags(isHeader)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -174,7 +181,8 @@ public class Flags {
|
||||
boolean isConst,
|
||||
boolean lateInit,
|
||||
boolean isExternal,
|
||||
boolean isDelegated
|
||||
boolean isDelegated,
|
||||
boolean isHeader
|
||||
) {
|
||||
return HAS_ANNOTATIONS.toFlags(hasAnnotations)
|
||||
| VISIBILITY.toFlags(visibility(visibility))
|
||||
@@ -188,6 +196,7 @@ public class Flags {
|
||||
| HAS_CONSTANT.toFlags(hasConstant)
|
||||
| IS_EXTERNAL_PROPERTY.toFlags(isExternal)
|
||||
| IS_DELEGATED.toFlags(isDelegated)
|
||||
| IS_HEADER_PROPERTY.toFlags(isHeader)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
@@ -7936,6 +7936,7 @@ public final class ProtoBuf {
|
||||
*ClassKind
|
||||
*isInner
|
||||
*isData
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
boolean hasFlags();
|
||||
@@ -7949,6 +7950,7 @@ public final class ProtoBuf {
|
||||
*ClassKind
|
||||
*isInner
|
||||
*isData
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
int getFlags();
|
||||
@@ -8544,6 +8546,7 @@ public final class ProtoBuf {
|
||||
*ClassKind
|
||||
*isInner
|
||||
*isData
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
public boolean hasFlags() {
|
||||
@@ -8559,6 +8562,7 @@ public final class ProtoBuf {
|
||||
*ClassKind
|
||||
*isInner
|
||||
*isData
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
public int getFlags() {
|
||||
@@ -9659,6 +9663,7 @@ public final class ProtoBuf {
|
||||
*ClassKind
|
||||
*isInner
|
||||
*isData
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
public boolean hasFlags() {
|
||||
@@ -9674,6 +9679,7 @@ public final class ProtoBuf {
|
||||
*ClassKind
|
||||
*isInner
|
||||
*isData
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
public int getFlags() {
|
||||
@@ -9689,6 +9695,7 @@ public final class ProtoBuf {
|
||||
*ClassKind
|
||||
*isInner
|
||||
*isData
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
public Builder setFlags(int value) {
|
||||
@@ -9707,6 +9714,7 @@ public final class ProtoBuf {
|
||||
*ClassKind
|
||||
*isInner
|
||||
*isData
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
public Builder clearFlags() {
|
||||
@@ -13606,6 +13614,8 @@ public final class ProtoBuf {
|
||||
*isInline
|
||||
*isTailrec
|
||||
*isExternal
|
||||
*isSuspend
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
boolean hasFlags();
|
||||
@@ -13622,6 +13632,8 @@ public final class ProtoBuf {
|
||||
*isInline
|
||||
*isTailrec
|
||||
*isExternal
|
||||
*isSuspend
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
int getFlags();
|
||||
@@ -13925,6 +13937,8 @@ public final class ProtoBuf {
|
||||
*isInline
|
||||
*isTailrec
|
||||
*isExternal
|
||||
*isSuspend
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
public boolean hasFlags() {
|
||||
@@ -13943,6 +13957,8 @@ public final class ProtoBuf {
|
||||
*isInline
|
||||
*isTailrec
|
||||
*isExternal
|
||||
*isSuspend
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
public int getFlags() {
|
||||
@@ -14620,6 +14636,8 @@ public final class ProtoBuf {
|
||||
*isInline
|
||||
*isTailrec
|
||||
*isExternal
|
||||
*isSuspend
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
public boolean hasFlags() {
|
||||
@@ -14638,6 +14656,8 @@ public final class ProtoBuf {
|
||||
*isInline
|
||||
*isTailrec
|
||||
*isExternal
|
||||
*isSuspend
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
public int getFlags() {
|
||||
@@ -14656,6 +14676,8 @@ public final class ProtoBuf {
|
||||
*isInline
|
||||
*isTailrec
|
||||
*isExternal
|
||||
*isSuspend
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
public Builder setFlags(int value) {
|
||||
@@ -14677,6 +14699,8 @@ public final class ProtoBuf {
|
||||
*isInline
|
||||
*isTailrec
|
||||
*isExternal
|
||||
*isSuspend
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
public Builder clearFlags() {
|
||||
@@ -15324,6 +15348,7 @@ public final class ProtoBuf {
|
||||
*hasConstant
|
||||
*isExternal
|
||||
*isDelegated
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
boolean hasFlags();
|
||||
@@ -15343,6 +15368,7 @@ public final class ProtoBuf {
|
||||
*hasConstant
|
||||
*isExternal
|
||||
*isDelegated
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
int getFlags();
|
||||
@@ -15670,6 +15696,7 @@ public final class ProtoBuf {
|
||||
*hasConstant
|
||||
*isExternal
|
||||
*isDelegated
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
public boolean hasFlags() {
|
||||
@@ -15691,6 +15718,7 @@ public final class ProtoBuf {
|
||||
*hasConstant
|
||||
*isExternal
|
||||
*isDelegated
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
public int getFlags() {
|
||||
@@ -16381,6 +16409,7 @@ public final class ProtoBuf {
|
||||
*hasConstant
|
||||
*isExternal
|
||||
*isDelegated
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
public boolean hasFlags() {
|
||||
@@ -16402,6 +16431,7 @@ public final class ProtoBuf {
|
||||
*hasConstant
|
||||
*isExternal
|
||||
*isDelegated
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
public int getFlags() {
|
||||
@@ -16423,6 +16453,7 @@ public final class ProtoBuf {
|
||||
*hasConstant
|
||||
*isExternal
|
||||
*isDelegated
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
public Builder setFlags(int value) {
|
||||
@@ -16447,6 +16478,7 @@ public final class ProtoBuf {
|
||||
*hasConstant
|
||||
*isExternal
|
||||
*isDelegated
|
||||
*isHeader
|
||||
* </pre>
|
||||
*/
|
||||
public Builder clearFlags() {
|
||||
|
||||
+2
@@ -47,6 +47,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
||||
Flags.IS_CONST.get(flags),
|
||||
Flags.IS_EXTERNAL_PROPERTY.get(flags),
|
||||
Flags.IS_DELEGATED.get(flags),
|
||||
Flags.IS_HEADER_PROPERTY.get(flags),
|
||||
proto,
|
||||
c.nameResolver,
|
||||
c.typeTable,
|
||||
@@ -174,6 +175,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
||||
function.isInline = Flags.IS_INLINE.get(flags)
|
||||
function.isTailrec = Flags.IS_TAILREC.get(flags)
|
||||
function.isSuspend = Flags.IS_SUSPEND.get(flags)
|
||||
function.isHeader = Flags.IS_HEADER_FUNCTION.get(flags)
|
||||
return function
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ class DeserializedClassDescriptor(
|
||||
|
||||
override fun isData() = Flags.IS_DATA.get(classProto.flags)
|
||||
|
||||
override fun isHeader() = false
|
||||
override fun isHeader() = Flags.IS_HEADER_CLASS.get(classProto.flags)
|
||||
|
||||
override fun isImpl() = false
|
||||
|
||||
|
||||
+6
-8
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.serialization.deserialization.descriptors
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.descriptors.impl.*
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.protobuf.MessageLite
|
||||
import org.jetbrains.kotlin.serialization.Flags
|
||||
@@ -108,16 +107,16 @@ class DeserializedPropertyDescriptor(
|
||||
isConst: Boolean,
|
||||
isExternal: Boolean,
|
||||
isDelegated: Boolean,
|
||||
isHeader: Boolean,
|
||||
override val proto: ProtoBuf.Property,
|
||||
override val nameResolver: NameResolver,
|
||||
override val typeTable: TypeTable,
|
||||
override val sinceKotlinInfoTable: SinceKotlinInfoTable,
|
||||
override val containerSource: DeserializedContainerSource?
|
||||
) : DeserializedCallableMemberDescriptor,
|
||||
PropertyDescriptorImpl(containingDeclaration, original, annotations,
|
||||
modality, visibility, isVar, name, kind, SourceElement.NO_SOURCE, isLateInit, isConst, false, false,
|
||||
isExternal, isDelegated) {
|
||||
|
||||
) : DeserializedCallableMemberDescriptor, PropertyDescriptorImpl(
|
||||
containingDeclaration, original, annotations, modality, visibility, isVar, name, kind, SourceElement.NO_SOURCE,
|
||||
isLateInit, isConst, isHeader, false, isExternal, isDelegated
|
||||
) {
|
||||
override fun createSubstitutedCopy(
|
||||
newOwner: DeclarationDescriptor,
|
||||
newModality: Modality,
|
||||
@@ -127,8 +126,7 @@ class DeserializedPropertyDescriptor(
|
||||
): PropertyDescriptorImpl {
|
||||
return DeserializedPropertyDescriptor(
|
||||
newOwner, original, annotations, newModality, newVisibility, isVar, name, kind, isLateInit, isConst, isExternal,
|
||||
@Suppress("DEPRECATION") isDelegated,
|
||||
proto, nameResolver, typeTable, sinceKotlinInfoTable, containerSource
|
||||
@Suppress("DEPRECATION") isDelegated, isHeader, proto, nameResolver, typeTable, sinceKotlinInfoTable, containerSource
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user