K2: support DELEGATION member kind for properties #KT-62581 Fixed
This commit is contained in:
committed by
Space Team
parent
19bf11f041
commit
d42ae35624
-47
@@ -1,47 +0,0 @@
|
||||
PsiJetFileStubImpl[package=]
|
||||
PACKAGE_DIRECTIVE
|
||||
IMPORT_LIST
|
||||
CLASS[classId=/Delegation, fqName=Delegation, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=Delegation, superNames=[T]]
|
||||
MODIFIER_LIST[public final]
|
||||
PRIMARY_CONSTRUCTOR[fqName=null, hasBody=false, isDelegatedCallToThis=false, isExtension=false, isTopLevel=false, name=Delegation]
|
||||
MODIFIER_LIST[public]
|
||||
VALUE_PARAMETER_LIST
|
||||
VALUE_PARAMETER[fqName=null, hasDefaultValue=true, hasValOrVar=false, isMutable=false, name=c]
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION[referencedName=kotlin]
|
||||
REFERENCE_EXPRESSION[referencedName=Int]
|
||||
REFERENCE_EXPRESSION[referencedName=COMPILED_CODE]
|
||||
VALUE_PARAMETER[fqName=null, hasDefaultValue=false, hasValOrVar=false, isMutable=false, name=a]
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION[referencedName=A]
|
||||
SUPER_TYPE_LIST
|
||||
SUPER_TYPE_ENTRY
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION[referencedName=T]
|
||||
CLASS_BODY
|
||||
PROPERTY[fqName=Delegation.c, hasDelegate=false, hasDelegateExpression=false, hasInitializer=false, hasReturnTypeRef=true, isExtension=false, isTopLevel=false, isVar=false, name=c]
|
||||
MODIFIER_LIST[public final]
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION[referencedName=kotlin]
|
||||
REFERENCE_EXPRESSION[referencedName=Int]
|
||||
PROPERTY[fqName=Delegation.g, hasDelegate=false, hasDelegateExpression=false, hasInitializer=false, hasReturnTypeRef=true, isExtension=false, isTopLevel=false, isVar=false, name=g]
|
||||
MODIFIER_LIST[open public]
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION[referencedName=kotlin]
|
||||
REFERENCE_EXPRESSION[referencedName=Int]
|
||||
FUN[fqName=Delegation.ff, hasBlockBody=true, hasBody=true, hasTypeParameterListBeforeFunctionName=false, isExtension=false, isTopLevel=false, mayHaveContract=false, name=ff]
|
||||
MODIFIER_LIST[public final]
|
||||
VALUE_PARAMETER_LIST
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION[referencedName=kotlin]
|
||||
REFERENCE_EXPRESSION[referencedName=Int]
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
interface T {
|
||||
fun f()
|
||||
val g: Int
|
||||
|
||||
+8
-1
@@ -440,7 +440,7 @@ class FirElementSerializer private constructor(
|
||||
hasAnnotations,
|
||||
ProtoEnumFlags.visibility(normalizeVisibility(property)),
|
||||
ProtoEnumFlags.modality(modality),
|
||||
ProtoBuf.MemberKind.DECLARATION,
|
||||
property.memberKind(),
|
||||
property.isVar, hasGetter, hasSetter, hasConstant, property.isConst, property.isLateInit,
|
||||
property.isExternal, property.delegateFieldSymbol != null, property.isExpect
|
||||
)
|
||||
@@ -492,6 +492,13 @@ class FirElementSerializer private constructor(
|
||||
return builder
|
||||
}
|
||||
|
||||
private fun FirProperty.memberKind(): MemberKind {
|
||||
return when (origin) {
|
||||
FirDeclarationOrigin.Delegated -> MemberKind.DELEGATION
|
||||
else -> MemberKind.DECLARATION
|
||||
}
|
||||
}
|
||||
|
||||
fun functionProto(function: FirFunction): ProtoBuf.Function.Builder? = whileAnalysing(session, function) {
|
||||
val builder = ProtoBuf.Function.newBuilder()
|
||||
val simpleFunction = function as? FirSimpleFunction
|
||||
|
||||
@@ -208,7 +208,7 @@ class FlagDelegatesTest {
|
||||
val foo = Foo::class.java.readMetadataAsKmClass()
|
||||
val props = foo.properties.associateBy { it.name }
|
||||
with(props["x"]!!) {
|
||||
assertEquals(MemberKind.DECLARATION, kind) // TODO: KT-62581
|
||||
assertEquals(MemberKind.DELEGATION, kind)
|
||||
assertFalse(isDelegated)
|
||||
assertFalse(getter.isNotDefault)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user