[FIR] Support deserialization of annotations on JVM
This commit is contained in:
+44
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.fir.java.deserialization
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.fir.expressions.FirArrayOfCall
|
||||||
|
import org.jetbrains.kotlin.fir.expressions.FirConstKind
|
||||||
|
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||||
|
import org.jetbrains.kotlin.fir.expressions.builder.buildArrayOfCall
|
||||||
|
import org.jetbrains.kotlin.fir.expressions.builder.buildConstExpression
|
||||||
|
|
||||||
|
object ConstantValueFactory {
|
||||||
|
fun createArrayValue(value: List<FirExpression>): FirArrayOfCall {
|
||||||
|
return buildArrayOfCall {
|
||||||
|
arguments += value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun createConstantValue(value: Any?): FirExpression? {
|
||||||
|
return when (value) {
|
||||||
|
is Byte -> buildConstExpression(null, FirConstKind.Byte, value)
|
||||||
|
is Short -> buildConstExpression(null, FirConstKind.Short, value)
|
||||||
|
is Int -> buildConstExpression(null, FirConstKind.Int, value)
|
||||||
|
is Long -> buildConstExpression(null, FirConstKind.Long, value)
|
||||||
|
is Char -> buildConstExpression(null, FirConstKind.Char, value)
|
||||||
|
is Float -> buildConstExpression(null, FirConstKind.Float, value)
|
||||||
|
is Double -> buildConstExpression(null, FirConstKind.Double, value)
|
||||||
|
is Boolean -> buildConstExpression(null, FirConstKind.Boolean, value)
|
||||||
|
is String -> buildConstExpression(null, FirConstKind.String, value)
|
||||||
|
is ByteArray -> createArrayValue(value.map { createConstantValue(it)!! })
|
||||||
|
is ShortArray -> createArrayValue(value.map { createConstantValue(it)!! })
|
||||||
|
is IntArray -> createArrayValue(value.map { createConstantValue(it)!! })
|
||||||
|
is LongArray -> createArrayValue(value.map { createConstantValue(it)!! })
|
||||||
|
is CharArray -> createArrayValue(value.map { createConstantValue(it)!! })
|
||||||
|
is FloatArray -> createArrayValue(value.map { createConstantValue(it)!! })
|
||||||
|
is DoubleArray -> createArrayValue(value.map { createConstantValue(it)!! })
|
||||||
|
is BooleanArray -> createArrayValue(value.map { createConstantValue(it)!! })
|
||||||
|
null -> buildConstExpression(null, FirConstKind.Null, value)
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+332
-1
@@ -5,18 +5,349 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.fir.java.deserialization
|
package org.jetbrains.kotlin.fir.java.deserialization
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.descriptors.SourceElement
|
||||||
import org.jetbrains.kotlin.fir.FirSession
|
import org.jetbrains.kotlin.fir.FirSession
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirConstructor
|
||||||
import org.jetbrains.kotlin.fir.deserialization.AbstractAnnotationDeserializer
|
import org.jetbrains.kotlin.fir.deserialization.AbstractAnnotationDeserializer
|
||||||
|
import org.jetbrains.kotlin.fir.deserialization.ProtoContainer
|
||||||
|
import org.jetbrains.kotlin.fir.diagnostics.FirSimpleDiagnostic
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
|
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
|
||||||
|
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||||
|
import org.jetbrains.kotlin.fir.expressions.builder.*
|
||||||
|
import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference
|
||||||
|
import org.jetbrains.kotlin.fir.resolve.firSymbolProvider
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.impl.ConeClassLikeLookupTagImpl
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol
|
||||||
|
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||||
|
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
||||||
|
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
||||||
|
import org.jetbrains.kotlin.load.kotlin.AbstractBinaryClassAnnotationAndConstantLoader
|
||||||
|
import org.jetbrains.kotlin.load.kotlin.JvmPackagePartSource
|
||||||
|
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinaryClass
|
||||||
|
import org.jetbrains.kotlin.load.kotlin.MemberSignature
|
||||||
import org.jetbrains.kotlin.metadata.ProtoBuf
|
import org.jetbrains.kotlin.metadata.ProtoBuf
|
||||||
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
|
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
|
||||||
|
import org.jetbrains.kotlin.metadata.deserialization.TypeTable
|
||||||
|
import org.jetbrains.kotlin.metadata.deserialization.getExtensionOrNull
|
||||||
import org.jetbrains.kotlin.metadata.jvm.JvmProtoBuf
|
import org.jetbrains.kotlin.metadata.jvm.JvmProtoBuf
|
||||||
|
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil
|
||||||
|
import org.jetbrains.kotlin.name.ClassId
|
||||||
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
import org.jetbrains.kotlin.protobuf.MessageLite
|
||||||
|
import org.jetbrains.kotlin.resolve.constants.ClassLiteralValue
|
||||||
|
import org.jetbrains.kotlin.serialization.deserialization.AnnotatedCallableKind
|
||||||
|
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstance
|
||||||
|
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
||||||
|
import org.jetbrains.kotlin.utils.compact
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
class JvmBinaryAnnotationDeserializer(
|
class JvmBinaryAnnotationDeserializer(
|
||||||
session: FirSession
|
session: FirSession
|
||||||
) : AbstractAnnotationDeserializer(session) {
|
) : AbstractAnnotationDeserializer(session) {
|
||||||
override fun loadTypeAnnotations(typeProto: ProtoBuf.Type, nameResolver: NameResolver): List<FirAnnotationCall> {
|
private val cache: MutableMap<KotlinJvmBinaryClass, Storage> = mutableMapOf()
|
||||||
|
|
||||||
|
private class Storage(
|
||||||
|
val memberAnnotations: Map<MemberSignature, List<FirAnnotationCall>>,
|
||||||
|
val propertyConstants: Map<MemberSignature, FirExpression>
|
||||||
|
)
|
||||||
|
|
||||||
|
private val ProtoContainer.kotlinJvmBinaryClass: KotlinJvmBinaryClass?
|
||||||
|
get() = (sourceElement as? JvmPackagePartSource)?.knownJvmBinaryClass
|
||||||
|
|
||||||
|
override fun loadTypeAnnotations(
|
||||||
|
containingDeclaration: ProtoContainer,
|
||||||
|
typeProto: ProtoBuf.Type,
|
||||||
|
nameResolver: NameResolver,
|
||||||
|
typeTable: TypeTable
|
||||||
|
): List<FirAnnotationCall> {
|
||||||
val annotations = typeProto.getExtension(JvmProtoBuf.typeAnnotation).orEmpty()
|
val annotations = typeProto.getExtension(JvmProtoBuf.typeAnnotation).orEmpty()
|
||||||
return annotations.map { deserializeAnnotation(it, nameResolver) }
|
return annotations.map { deserializeAnnotation(it, nameResolver) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun loadFunctionAnnotations(
|
||||||
|
containingDeclaration: ProtoContainer,
|
||||||
|
functionProto: ProtoBuf.Function,
|
||||||
|
nameResolver: NameResolver,
|
||||||
|
typeTable: TypeTable
|
||||||
|
): List<FirAnnotationCall> {
|
||||||
|
val kotlinClass = containingDeclaration.kotlinJvmBinaryClass ?: return emptyList()
|
||||||
|
val signature = getCallableSignature(functionProto, nameResolver, typeTable, AnnotatedCallableKind.FUNCTION) ?: return emptyList()
|
||||||
|
val storage = loadClassFileContent(kotlinClass)
|
||||||
|
return storage.memberAnnotations[signature] ?: emptyList()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun loadPropertyAnnotations(
|
||||||
|
containingDeclaration: ProtoContainer,
|
||||||
|
propertyProto: ProtoBuf.Property,
|
||||||
|
nameResolver: NameResolver,
|
||||||
|
typeTable: TypeTable
|
||||||
|
): List<FirAnnotationCall> {
|
||||||
|
val kotlinClass = containingDeclaration.kotlinJvmBinaryClass ?: return emptyList()
|
||||||
|
val signature = getPropertySignature(propertyProto, nameResolver, typeTable) ?: return emptyList()
|
||||||
|
val storage = loadClassFileContent(kotlinClass)
|
||||||
|
return storage.memberAnnotations[signature] ?: emptyList()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun loadConstructorAnnotations(
|
||||||
|
containingDeclaration: ProtoContainer,
|
||||||
|
constructorProto: ProtoBuf.Constructor,
|
||||||
|
nameResolver: NameResolver,
|
||||||
|
typeTable: TypeTable
|
||||||
|
): List<FirAnnotationCall> {
|
||||||
|
val kotlinClass = containingDeclaration.kotlinJvmBinaryClass ?: return emptyList()
|
||||||
|
val signature = getCallableSignature(constructorProto, nameResolver, typeTable, AnnotatedCallableKind.FUNCTION) ?: return emptyList()
|
||||||
|
val storage = loadClassFileContent(kotlinClass)
|
||||||
|
return storage.memberAnnotations[signature] ?: emptyList()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getCallableSignature(
|
||||||
|
proto: MessageLite,
|
||||||
|
nameResolver: NameResolver,
|
||||||
|
typeTable: TypeTable,
|
||||||
|
kind: AnnotatedCallableKind,
|
||||||
|
requireHasFieldFlagForField: Boolean = false
|
||||||
|
): MemberSignature? {
|
||||||
|
return when (proto) {
|
||||||
|
is ProtoBuf.Constructor -> {
|
||||||
|
MemberSignature.fromJvmMemberSignature(
|
||||||
|
JvmProtoBufUtil.getJvmConstructorSignature(proto, nameResolver, typeTable) ?: return null
|
||||||
|
)
|
||||||
|
}
|
||||||
|
is ProtoBuf.Function -> {
|
||||||
|
MemberSignature.fromJvmMemberSignature(JvmProtoBufUtil.getJvmMethodSignature(proto, nameResolver, typeTable) ?: return null)
|
||||||
|
}
|
||||||
|
is ProtoBuf.Property -> {
|
||||||
|
val signature = proto.getExtensionOrNull(JvmProtoBuf.propertySignature) ?: return null
|
||||||
|
when (kind) {
|
||||||
|
AnnotatedCallableKind.PROPERTY_GETTER ->
|
||||||
|
if (signature.hasGetter()) MemberSignature.fromMethod(nameResolver, signature.getter) else null
|
||||||
|
AnnotatedCallableKind.PROPERTY_SETTER ->
|
||||||
|
if (signature.hasSetter()) MemberSignature.fromMethod(nameResolver, signature.setter) else null
|
||||||
|
AnnotatedCallableKind.PROPERTY ->
|
||||||
|
getPropertySignature(proto, nameResolver, typeTable, true, true, requireHasFieldFlagForField)
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getPropertySignature(
|
||||||
|
proto: ProtoBuf.Property,
|
||||||
|
nameResolver: NameResolver,
|
||||||
|
typeTable: TypeTable,
|
||||||
|
field: Boolean = false,
|
||||||
|
synthetic: Boolean = false,
|
||||||
|
requireHasFieldFlagForField: Boolean = true
|
||||||
|
): MemberSignature? {
|
||||||
|
val signature = proto.getExtensionOrNull(JvmProtoBuf.propertySignature) ?: return null
|
||||||
|
|
||||||
|
if (field) {
|
||||||
|
val fieldSignature =
|
||||||
|
JvmProtoBufUtil.getJvmFieldSignature(proto, nameResolver, typeTable, requireHasFieldFlagForField) ?: return null
|
||||||
|
return MemberSignature.fromJvmMemberSignature(fieldSignature)
|
||||||
|
} else if (synthetic && signature.hasSyntheticMethod()) {
|
||||||
|
return MemberSignature.fromMethod(nameResolver, signature.syntheticMethod)
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun loadClassFileContent(kotlinClass: KotlinJvmBinaryClass): Storage {
|
||||||
|
cache[kotlinClass]?.let { return it }
|
||||||
|
|
||||||
|
val memberAnnotations = HashMap<MemberSignature, MutableList<FirAnnotationCall>>()
|
||||||
|
val propertyConstants = HashMap<MemberSignature, FirExpression>()
|
||||||
|
|
||||||
|
kotlinClass.visitMembers(object : KotlinJvmBinaryClass.MemberVisitor {
|
||||||
|
override fun visitMethod(name: Name, desc: String): KotlinJvmBinaryClass.MethodAnnotationVisitor? {
|
||||||
|
return AnnotationVisitorForMethod(MemberSignature.fromMethodNameAndDesc(name.asString(), desc))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun visitField(name: Name, desc: String, initializer: Any?): KotlinJvmBinaryClass.AnnotationVisitor? {
|
||||||
|
val signature = MemberSignature.fromFieldNameAndDesc(name.asString(), desc)
|
||||||
|
|
||||||
|
if (initializer != null) {
|
||||||
|
val constant = loadConstant(desc, initializer)
|
||||||
|
if (constant != null) {
|
||||||
|
propertyConstants[signature] = constant
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return MemberAnnotationVisitor(signature)
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class AnnotationVisitorForMethod(signature: MemberSignature) : MemberAnnotationVisitor(signature),
|
||||||
|
KotlinJvmBinaryClass.MethodAnnotationVisitor {
|
||||||
|
|
||||||
|
override fun visitParameterAnnotation(
|
||||||
|
index: Int, classId: ClassId, source: SourceElement
|
||||||
|
): KotlinJvmBinaryClass.AnnotationArgumentVisitor? {
|
||||||
|
val paramSignature = MemberSignature.fromMethodSignatureAndParameterIndex(signature, index)
|
||||||
|
var result = memberAnnotations[paramSignature]
|
||||||
|
if (result == null) {
|
||||||
|
result = ArrayList()
|
||||||
|
memberAnnotations[paramSignature] = result
|
||||||
|
}
|
||||||
|
return loadAnnotationIfNotSpecial(classId, source, result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open inner class MemberAnnotationVisitor(protected val signature: MemberSignature) : KotlinJvmBinaryClass.AnnotationVisitor {
|
||||||
|
private val result = ArrayList<FirAnnotationCall>()
|
||||||
|
|
||||||
|
override fun visitAnnotation(classId: ClassId, source: SourceElement): KotlinJvmBinaryClass.AnnotationArgumentVisitor? {
|
||||||
|
return loadAnnotationIfNotSpecial(classId, source, result)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun visitEnd() {
|
||||||
|
if (result.isNotEmpty()) {
|
||||||
|
memberAnnotations[signature] = result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, getCachedFileContent(kotlinClass))
|
||||||
|
|
||||||
|
return Storage(memberAnnotations, propertyConstants).also {
|
||||||
|
cache[kotlinClass] = it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getCachedFileContent(kotlinClass: KotlinJvmBinaryClass): ByteArray? = null
|
||||||
|
|
||||||
|
private fun loadConstant(desc: String, initializer: Any): FirExpression? {
|
||||||
|
val normalizedValue: Any = if (desc in "ZBCS") {
|
||||||
|
val intValue = initializer as Int
|
||||||
|
when (desc) {
|
||||||
|
"Z" -> intValue != 0
|
||||||
|
"B" -> intValue.toByte()
|
||||||
|
"C" -> intValue.toChar()
|
||||||
|
"S" -> intValue.toShort()
|
||||||
|
else -> throw AssertionError(desc)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
initializer
|
||||||
|
}
|
||||||
|
|
||||||
|
return ConstantValueFactory.createConstantValue(normalizedValue)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadAnnotationIfNotSpecial(
|
||||||
|
annotationClassId: ClassId,
|
||||||
|
source: SourceElement,
|
||||||
|
result: MutableList<FirAnnotationCall>
|
||||||
|
): KotlinJvmBinaryClass.AnnotationArgumentVisitor? {
|
||||||
|
if (annotationClassId in AbstractBinaryClassAnnotationAndConstantLoader.SPECIAL_ANNOTATIONS) return null
|
||||||
|
|
||||||
|
return loadAnnotation(annotationClassId, result)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun loadClass(classId: ClassId): FirClassSymbol<*>? {
|
||||||
|
return session.firSymbolProvider.getClassLikeSymbolByFqName(classId) as? FirClassSymbol<*>
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun ClassId.toConeKotlinType(): ConeKotlinType = ConeClassLikeTypeImpl(ConeClassLikeLookupTagImpl(this), emptyArray(), isNullable = false)
|
||||||
|
|
||||||
|
fun loadAnnotation(
|
||||||
|
annotationClassId: ClassId,
|
||||||
|
result: MutableList<FirAnnotationCall>
|
||||||
|
): KotlinJvmBinaryClass.AnnotationArgumentVisitor? {
|
||||||
|
val annotationClass = loadClass(annotationClassId) ?: return null
|
||||||
|
val annotationConstructor = annotationClass.fir.declarations.firstIsInstanceOrNull<FirConstructor>() ?: return null
|
||||||
|
|
||||||
|
val builder = FirAnnotationCallBuilder().apply {
|
||||||
|
annotationTypeRef = buildResolvedTypeRef {
|
||||||
|
type = annotationClassId.toConeKotlinType()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return object : KotlinJvmBinaryClass.AnnotationArgumentVisitor {
|
||||||
|
private val arguments = HashMap<Name, FirExpression>()
|
||||||
|
|
||||||
|
override fun visit(name: Name?, value: Any?) {
|
||||||
|
if (name != null) {
|
||||||
|
arguments[name] = createConstant(name, value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun visitClassLiteral(name: Name, value: ClassLiteralValue) {
|
||||||
|
arguments[name] = buildClassLiteral(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun visitEnum(name: Name, enumClassId: ClassId, enumEntryName: Name) {
|
||||||
|
arguments[name] = buildEnum(enumClassId, enumEntryName)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun buildClassLiteral(value: ClassLiteralValue): FirExpression {
|
||||||
|
return buildGetClassCall {
|
||||||
|
arguments += buildResolvedQualifier {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun buildEnum(
|
||||||
|
enumClassId: ClassId,
|
||||||
|
enumEntryName: Name
|
||||||
|
): FirExpression {
|
||||||
|
return buildQualifiedAccessExpression {
|
||||||
|
typeRef = buildResolvedTypeRef {
|
||||||
|
type = enumClassId.toConeKotlinType()
|
||||||
|
}
|
||||||
|
calleeReference = buildResolvedNamedReference {
|
||||||
|
name = enumEntryName
|
||||||
|
resolvedSymbol = loadClass(enumClassId)!!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun visitArray(name: Name): KotlinJvmBinaryClass.AnnotationArrayArgumentVisitor? {
|
||||||
|
return object : KotlinJvmBinaryClass.AnnotationArrayArgumentVisitor {
|
||||||
|
private val elements = ArrayList<FirExpression>()
|
||||||
|
|
||||||
|
override fun visit(value: Any?) {
|
||||||
|
elements.add(createConstant(name, value))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun visitEnum(enumClassId: ClassId, enumEntryName: Name) {
|
||||||
|
elements.add(buildEnum(enumClassId, enumEntryName))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun visitClassLiteral(value: ClassLiteralValue) {
|
||||||
|
elements.add(buildClassLiteral(value))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun visitEnd() {
|
||||||
|
val parameter = annotationConstructor.valueParameters.firstOrNull { it.name == name }
|
||||||
|
if (parameter != null) {
|
||||||
|
arguments[name] = ConstantValueFactory.createArrayValue(elements.compact())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun visitAnnotation(name: Name, classId: ClassId): KotlinJvmBinaryClass.AnnotationArgumentVisitor? {
|
||||||
|
val list = ArrayList<FirAnnotationCall>()
|
||||||
|
val visitor = loadAnnotation(classId, list)!!
|
||||||
|
return object : KotlinJvmBinaryClass.AnnotationArgumentVisitor by visitor {
|
||||||
|
override fun visitEnd() {
|
||||||
|
visitor.visitEnd()
|
||||||
|
arguments[name] = list.single()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun visitEnd() {
|
||||||
|
result += builder.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun createConstant(name: Name?, value: Any?): FirExpression {
|
||||||
|
return ConstantValueFactory.createConstantValue(value)
|
||||||
|
?: buildErrorExpression {
|
||||||
|
diagnostic = FirSimpleDiagnostic("Unsupported annotation argument: $name")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+1
@@ -122,6 +122,7 @@ class KotlinDeserializedJvmSymbolsProvider(
|
|||||||
FirDeserializationContext.createForPackage(
|
FirDeserializationContext.createForPackage(
|
||||||
packageFqName, packageProto, nameResolver, session,
|
packageFqName, packageProto, nameResolver, session,
|
||||||
JvmBinaryAnnotationDeserializer(session),
|
JvmBinaryAnnotationDeserializer(session),
|
||||||
|
source
|
||||||
),
|
),
|
||||||
source,
|
source,
|
||||||
)
|
)
|
||||||
|
|||||||
+28
-7
@@ -31,46 +31,67 @@ import org.jetbrains.kotlin.metadata.ProtoBuf
|
|||||||
import org.jetbrains.kotlin.metadata.ProtoBuf.Annotation.Argument.Value.Type.*
|
import org.jetbrains.kotlin.metadata.ProtoBuf.Annotation.Argument.Value.Type.*
|
||||||
import org.jetbrains.kotlin.metadata.deserialization.Flags
|
import org.jetbrains.kotlin.metadata.deserialization.Flags
|
||||||
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
|
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
|
||||||
|
import org.jetbrains.kotlin.metadata.deserialization.TypeTable
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.builtins.BuiltInSerializerProtocol
|
import org.jetbrains.kotlin.serialization.deserialization.builtins.BuiltInSerializerProtocol
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.getClassId
|
import org.jetbrains.kotlin.serialization.deserialization.getClassId
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.getName
|
import org.jetbrains.kotlin.serialization.deserialization.getName
|
||||||
|
|
||||||
abstract class AbstractAnnotationDeserializer(
|
abstract class AbstractAnnotationDeserializer(
|
||||||
private val session: FirSession
|
protected val session: FirSession
|
||||||
) {
|
) {
|
||||||
protected val protocol = BuiltInSerializerProtocol
|
protected val protocol = BuiltInSerializerProtocol
|
||||||
|
|
||||||
fun loadClassAnnotations(classProto: ProtoBuf.Class, nameResolver: NameResolver): List<FirAnnotationCall> {
|
open fun loadClassAnnotations(classProto: ProtoBuf.Class, nameResolver: NameResolver): List<FirAnnotationCall> {
|
||||||
if (!Flags.HAS_ANNOTATIONS.get(classProto.flags)) return emptyList()
|
if (!Flags.HAS_ANNOTATIONS.get(classProto.flags)) return emptyList()
|
||||||
val annotations = classProto.getExtension(protocol.classAnnotation).orEmpty()
|
val annotations = classProto.getExtension(protocol.classAnnotation).orEmpty()
|
||||||
return annotations.map { deserializeAnnotation(it, nameResolver) }
|
return annotations.map { deserializeAnnotation(it, nameResolver) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun loadFunctionAnnotations(functionProto: ProtoBuf.Function, nameResolver: NameResolver): List<FirAnnotationCall> {
|
open fun loadFunctionAnnotations(
|
||||||
|
containingDeclaration: ProtoContainer,
|
||||||
|
functionProto: ProtoBuf.Function,
|
||||||
|
nameResolver: NameResolver,
|
||||||
|
typeTable: TypeTable
|
||||||
|
): List<FirAnnotationCall> {
|
||||||
if (!Flags.HAS_ANNOTATIONS.get(functionProto.flags)) return emptyList()
|
if (!Flags.HAS_ANNOTATIONS.get(functionProto.flags)) return emptyList()
|
||||||
val annotations = functionProto.getExtension(protocol.functionAnnotation).orEmpty()
|
val annotations = functionProto.getExtension(protocol.functionAnnotation).orEmpty()
|
||||||
return annotations.map { deserializeAnnotation(it, nameResolver) }
|
return annotations.map { deserializeAnnotation(it, nameResolver) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun loadPropertyAnnotations(propertyProto: ProtoBuf.Property, nameResolver: NameResolver): List<FirAnnotationCall> {
|
open fun loadPropertyAnnotations(
|
||||||
|
containingDeclaration: ProtoContainer,
|
||||||
|
propertyProto: ProtoBuf.Property,
|
||||||
|
nameResolver: NameResolver,
|
||||||
|
typeTable: TypeTable
|
||||||
|
): List<FirAnnotationCall> {
|
||||||
if (!Flags.HAS_ANNOTATIONS.get(propertyProto.flags)) return emptyList()
|
if (!Flags.HAS_ANNOTATIONS.get(propertyProto.flags)) return emptyList()
|
||||||
val annotations = propertyProto.getExtension(protocol.propertyAnnotation).orEmpty()
|
val annotations = propertyProto.getExtension(protocol.propertyAnnotation).orEmpty()
|
||||||
return annotations.map { deserializeAnnotation(it, nameResolver) }
|
return annotations.map { deserializeAnnotation(it, nameResolver) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun loadConstructorAnnotations(constructorProto: ProtoBuf.Constructor, nameResolver: NameResolver): List<FirAnnotationCall> {
|
open fun loadConstructorAnnotations(
|
||||||
|
containingDeclaration: ProtoContainer,
|
||||||
|
constructorProto: ProtoBuf.Constructor,
|
||||||
|
nameResolver: NameResolver,
|
||||||
|
typeTable: TypeTable
|
||||||
|
): List<FirAnnotationCall> {
|
||||||
if (!Flags.HAS_ANNOTATIONS.get(constructorProto.flags)) return emptyList()
|
if (!Flags.HAS_ANNOTATIONS.get(constructorProto.flags)) return emptyList()
|
||||||
val annotations = constructorProto.getExtension(protocol.constructorAnnotation).orEmpty()
|
val annotations = constructorProto.getExtension(protocol.constructorAnnotation).orEmpty()
|
||||||
return annotations.map { deserializeAnnotation(it, nameResolver) }
|
return annotations.map { deserializeAnnotation(it, nameResolver) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun loadValueParameterAnnotations(valueParameterProto: ProtoBuf.ValueParameter, nameResolver: NameResolver): List<FirAnnotationCall> {
|
open fun loadValueParameterAnnotations(
|
||||||
|
containingDeclaration: ProtoContainer,
|
||||||
|
valueParameterProto: ProtoBuf.ValueParameter,
|
||||||
|
nameResolver: NameResolver,
|
||||||
|
typeTable: TypeTable
|
||||||
|
): List<FirAnnotationCall> {
|
||||||
if (!Flags.HAS_ANNOTATIONS.get(valueParameterProto.flags)) return emptyList()
|
if (!Flags.HAS_ANNOTATIONS.get(valueParameterProto.flags)) return emptyList()
|
||||||
val annotations = valueParameterProto.getExtension(protocol.parameterAnnotation).orEmpty()
|
val annotations = valueParameterProto.getExtension(protocol.parameterAnnotation).orEmpty()
|
||||||
return annotations.map { deserializeAnnotation(it, nameResolver) }
|
return annotations.map { deserializeAnnotation(it, nameResolver) }
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract fun loadTypeAnnotations(typeProto: ProtoBuf.Type, nameResolver: NameResolver): List<FirAnnotationCall>
|
abstract fun loadTypeAnnotations(containingDeclaration: ProtoContainer, typeProto: ProtoBuf.Type, nameResolver: NameResolver, typeTable: TypeTable): List<FirAnnotationCall>
|
||||||
|
|
||||||
fun deserializeAnnotation(proto: ProtoBuf.Annotation, nameResolver: NameResolver): FirAnnotationCall {
|
fun deserializeAnnotation(proto: ProtoBuf.Annotation, nameResolver: NameResolver): FirAnnotationCall {
|
||||||
val classId = nameResolver.getClassId(proto.id)
|
val classId = nameResolver.getClassId(proto.id)
|
||||||
|
|||||||
+11
-2
@@ -63,9 +63,18 @@ fun deserializeClassToSymbol(
|
|||||||
classProto.typeParameterList,
|
classProto.typeParameterList,
|
||||||
nameResolver,
|
nameResolver,
|
||||||
TypeTable(classProto.typeTable),
|
TypeTable(classProto.typeTable),
|
||||||
classId.relativeClassName
|
classId.relativeClassName,
|
||||||
|
ProtoContainer.Class(
|
||||||
|
classProto,
|
||||||
|
parentContext.containingDeclaration as? ProtoContainer.Class,
|
||||||
|
classId,
|
||||||
|
null
|
||||||
|
)
|
||||||
) ?: FirDeserializationContext.createForClass(
|
) ?: FirDeserializationContext.createForClass(
|
||||||
classId, classProto, nameResolver, session,
|
classId,
|
||||||
|
classProto,
|
||||||
|
nameResolver,
|
||||||
|
session,
|
||||||
defaultAnnotationDeserializer ?: FirBuiltinAnnotationDeserializer(session)
|
defaultAnnotationDeserializer ?: FirBuiltinAnnotationDeserializer(session)
|
||||||
)
|
)
|
||||||
classBuilder.apply {
|
classBuilder.apply {
|
||||||
|
|||||||
+7
-1
@@ -10,12 +10,18 @@ import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
|
|||||||
import org.jetbrains.kotlin.metadata.ProtoBuf
|
import org.jetbrains.kotlin.metadata.ProtoBuf
|
||||||
import org.jetbrains.kotlin.metadata.deserialization.Flags
|
import org.jetbrains.kotlin.metadata.deserialization.Flags
|
||||||
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
|
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
|
||||||
|
import org.jetbrains.kotlin.metadata.deserialization.TypeTable
|
||||||
|
|
||||||
class FirBuiltinAnnotationDeserializer(
|
class FirBuiltinAnnotationDeserializer(
|
||||||
session: FirSession
|
session: FirSession
|
||||||
) : AbstractAnnotationDeserializer(session) {
|
) : AbstractAnnotationDeserializer(session) {
|
||||||
|
|
||||||
override fun loadTypeAnnotations(typeProto: ProtoBuf.Type, nameResolver: NameResolver): List<FirAnnotationCall> {
|
override fun loadTypeAnnotations(
|
||||||
|
containigDeclaration: ProtoContainer,
|
||||||
|
typeProto: ProtoBuf.Type,
|
||||||
|
nameResolver: NameResolver,
|
||||||
|
typeTable: TypeTable
|
||||||
|
): List<FirAnnotationCall> {
|
||||||
if (!Flags.HAS_ANNOTATIONS.get(typeProto.flags)) return emptyList()
|
if (!Flags.HAS_ANNOTATIONS.get(typeProto.flags)) return emptyList()
|
||||||
val annotations = typeProto.getExtension(protocol.typeAnnotation).orEmpty()
|
val annotations = typeProto.getExtension(protocol.typeAnnotation).orEmpty()
|
||||||
return annotations.map { deserializeAnnotation(it, nameResolver) }
|
return annotations.map { deserializeAnnotation(it, nameResolver) }
|
||||||
|
|||||||
+44
-14
@@ -6,11 +6,14 @@
|
|||||||
package org.jetbrains.kotlin.fir.deserialization
|
package org.jetbrains.kotlin.fir.deserialization
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.Modality
|
import org.jetbrains.kotlin.descriptors.Modality
|
||||||
|
import org.jetbrains.kotlin.descriptors.SourceElement
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||||
import org.jetbrains.kotlin.fir.FirSession
|
import org.jetbrains.kotlin.fir.FirSession
|
||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.builder.*
|
import org.jetbrains.kotlin.fir.declarations.builder.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.impl.*
|
import org.jetbrains.kotlin.fir.declarations.impl.FirDeclarationStatusImpl
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertyGetter
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertySetter
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||||
import org.jetbrains.kotlin.fir.expressions.builder.buildExpressionStub
|
import org.jetbrains.kotlin.fir.expressions.builder.buildExpressionStub
|
||||||
import org.jetbrains.kotlin.fir.symbols.CallableId
|
import org.jetbrains.kotlin.fir.symbols.CallableId
|
||||||
@@ -37,19 +40,21 @@ class FirDeserializationContext(
|
|||||||
val relativeClassName: FqName?,
|
val relativeClassName: FqName?,
|
||||||
val typeDeserializer: FirTypeDeserializer,
|
val typeDeserializer: FirTypeDeserializer,
|
||||||
val annotationDeserializer: AbstractAnnotationDeserializer,
|
val annotationDeserializer: AbstractAnnotationDeserializer,
|
||||||
val components: FirDeserializationComponents
|
val components: FirDeserializationComponents,
|
||||||
|
val containingDeclaration: ProtoContainer
|
||||||
) {
|
) {
|
||||||
fun childContext(
|
fun childContext(
|
||||||
typeParameterProtos: List<ProtoBuf.TypeParameter>,
|
typeParameterProtos: List<ProtoBuf.TypeParameter>,
|
||||||
nameResolver: NameResolver = this.nameResolver,
|
nameResolver: NameResolver = this.nameResolver,
|
||||||
typeTable: TypeTable = this.typeTable,
|
typeTable: TypeTable = this.typeTable,
|
||||||
relativeClassName: FqName? = this.relativeClassName
|
relativeClassName: FqName? = this.relativeClassName,
|
||||||
|
containingDeclaration: ProtoContainer = this.containingDeclaration
|
||||||
): FirDeserializationContext = FirDeserializationContext(
|
): FirDeserializationContext = FirDeserializationContext(
|
||||||
nameResolver, typeTable, versionRequirementTable, session, packageFqName, relativeClassName,
|
nameResolver, typeTable, versionRequirementTable, session, packageFqName, relativeClassName,
|
||||||
FirTypeDeserializer(
|
FirTypeDeserializer(
|
||||||
session, nameResolver, typeTable, typeParameterProtos, typeDeserializer
|
session, nameResolver, typeTable, typeParameterProtos, typeDeserializer
|
||||||
),
|
),
|
||||||
annotationDeserializer, components
|
annotationDeserializer, components, containingDeclaration
|
||||||
)
|
)
|
||||||
|
|
||||||
val memberDeserializer: FirMemberDeserializer = FirMemberDeserializer(this)
|
val memberDeserializer: FirMemberDeserializer = FirMemberDeserializer(this)
|
||||||
@@ -60,7 +65,8 @@ class FirDeserializationContext(
|
|||||||
packageProto: ProtoBuf.Package,
|
packageProto: ProtoBuf.Package,
|
||||||
nameResolver: NameResolver,
|
nameResolver: NameResolver,
|
||||||
session: FirSession,
|
session: FirSession,
|
||||||
annotationDeserializer: AbstractAnnotationDeserializer
|
annotationDeserializer: AbstractAnnotationDeserializer,
|
||||||
|
sourceElement: SourceElement?
|
||||||
) = createRootContext(
|
) = createRootContext(
|
||||||
nameResolver,
|
nameResolver,
|
||||||
TypeTable(packageProto.typeTable),
|
TypeTable(packageProto.typeTable),
|
||||||
@@ -68,7 +74,8 @@ class FirDeserializationContext(
|
|||||||
annotationDeserializer,
|
annotationDeserializer,
|
||||||
fqName,
|
fqName,
|
||||||
relativeClassName = null,
|
relativeClassName = null,
|
||||||
typeParameterProtos = emptyList()
|
typeParameterProtos = emptyList(),
|
||||||
|
ProtoContainer.Package(fqName, sourceElement)
|
||||||
)
|
)
|
||||||
|
|
||||||
fun createForClass(
|
fun createForClass(
|
||||||
@@ -84,7 +91,8 @@ class FirDeserializationContext(
|
|||||||
annotationDeserializer,
|
annotationDeserializer,
|
||||||
classId.packageFqName,
|
classId.packageFqName,
|
||||||
classId.relativeClassName,
|
classId.relativeClassName,
|
||||||
classProto.typeParameterList
|
classProto.typeParameterList,
|
||||||
|
ProtoContainer.Class(classProto, outerClass = null, classId, null)
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun createRootContext(
|
private fun createRootContext(
|
||||||
@@ -94,7 +102,8 @@ class FirDeserializationContext(
|
|||||||
annotationDeserializer: AbstractAnnotationDeserializer,
|
annotationDeserializer: AbstractAnnotationDeserializer,
|
||||||
packageFqName: FqName,
|
packageFqName: FqName,
|
||||||
relativeClassName: FqName?,
|
relativeClassName: FqName?,
|
||||||
typeParameterProtos: List<ProtoBuf.TypeParameter>
|
typeParameterProtos: List<ProtoBuf.TypeParameter>,
|
||||||
|
containingDeclaration: ProtoContainer
|
||||||
): FirDeserializationContext {
|
): FirDeserializationContext {
|
||||||
return FirDeserializationContext(
|
return FirDeserializationContext(
|
||||||
nameResolver, typeTable,
|
nameResolver, typeTable,
|
||||||
@@ -110,7 +119,8 @@ class FirDeserializationContext(
|
|||||||
null
|
null
|
||||||
),
|
),
|
||||||
annotationDeserializer,
|
annotationDeserializer,
|
||||||
FirDeserializationComponents()
|
FirDeserializationComponents(),
|
||||||
|
containingDeclaration
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -180,7 +190,12 @@ class FirMemberDeserializer(private val c: FirDeserializationContext) {
|
|||||||
|
|
||||||
resolvePhase = FirResolvePhase.ANALYZED_DEPENDENCIES
|
resolvePhase = FirResolvePhase.ANALYZED_DEPENDENCIES
|
||||||
typeParameters += local.typeDeserializer.ownTypeParameters.map { it.fir }
|
typeParameters += local.typeDeserializer.ownTypeParameters.map { it.fir }
|
||||||
annotations += c.annotationDeserializer.loadPropertyAnnotations(proto, local.nameResolver)
|
annotations += c.annotationDeserializer.loadPropertyAnnotations(
|
||||||
|
c.containingDeclaration,
|
||||||
|
proto,
|
||||||
|
local.nameResolver,
|
||||||
|
local.typeTable
|
||||||
|
)
|
||||||
getter = FirDefaultPropertyGetter(null, c.session, returnTypeRef, ProtoEnumFlags.visibility(Flags.VISIBILITY.get(getterFlags)))
|
getter = FirDefaultPropertyGetter(null, c.session, returnTypeRef, ProtoEnumFlags.visibility(Flags.VISIBILITY.get(getterFlags)))
|
||||||
setter = if (isVar) {
|
setter = if (isVar) {
|
||||||
FirDefaultPropertySetter(null, c.session, returnTypeRef, ProtoEnumFlags.visibility(Flags.VISIBILITY.get(setterFlags)))
|
FirDefaultPropertySetter(null, c.session, returnTypeRef, ProtoEnumFlags.visibility(Flags.VISIBILITY.get(setterFlags)))
|
||||||
@@ -228,7 +243,12 @@ class FirMemberDeserializer(private val c: FirDeserializationContext) {
|
|||||||
resolvePhase = FirResolvePhase.ANALYZED_DEPENDENCIES
|
resolvePhase = FirResolvePhase.ANALYZED_DEPENDENCIES
|
||||||
typeParameters += local.typeDeserializer.ownTypeParameters.map { it.fir }
|
typeParameters += local.typeDeserializer.ownTypeParameters.map { it.fir }
|
||||||
valueParameters += local.memberDeserializer.valueParameters(proto.valueParameterList)
|
valueParameters += local.memberDeserializer.valueParameters(proto.valueParameterList)
|
||||||
annotations += local.annotationDeserializer.loadFunctionAnnotations(proto, local.nameResolver)
|
annotations += local.annotationDeserializer.loadFunctionAnnotations(
|
||||||
|
c.containingDeclaration,
|
||||||
|
proto,
|
||||||
|
local.nameResolver,
|
||||||
|
local.typeTable
|
||||||
|
)
|
||||||
this.containerSource = containerSource
|
this.containerSource = containerSource
|
||||||
}
|
}
|
||||||
if (proto.hasContract()) {
|
if (proto.hasContract()) {
|
||||||
@@ -275,7 +295,7 @@ class FirMemberDeserializer(private val c: FirDeserializationContext) {
|
|||||||
valueParameters += local.memberDeserializer.valueParameters(
|
valueParameters += local.memberDeserializer.valueParameters(
|
||||||
proto.valueParameterList, addDefaultValue = classBuilder.symbol.classId == StandardClassIds.Enum
|
proto.valueParameterList, addDefaultValue = classBuilder.symbol.classId == StandardClassIds.Enum
|
||||||
)
|
)
|
||||||
annotations += local.annotationDeserializer.loadConstructorAnnotations(proto, local.nameResolver)
|
annotations += local.annotationDeserializer.loadConstructorAnnotations(c.containingDeclaration, proto, local.nameResolver, local.typeTable)
|
||||||
}.build()
|
}.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -305,7 +325,12 @@ class FirMemberDeserializer(private val c: FirDeserializationContext) {
|
|||||||
isCrossinline = Flags.IS_CROSSINLINE.get(flags)
|
isCrossinline = Flags.IS_CROSSINLINE.get(flags)
|
||||||
isNoinline = Flags.IS_NOINLINE.get(flags)
|
isNoinline = Flags.IS_NOINLINE.get(flags)
|
||||||
isVararg = proto.varargElementType(c.typeTable) != null
|
isVararg = proto.varargElementType(c.typeTable) != null
|
||||||
annotations += c.annotationDeserializer.loadValueParameterAnnotations(proto, c.nameResolver)
|
annotations += c.annotationDeserializer.loadValueParameterAnnotations(
|
||||||
|
c.containingDeclaration,
|
||||||
|
proto,
|
||||||
|
c.nameResolver,
|
||||||
|
c.typeTable
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}.toList()
|
}.toList()
|
||||||
}
|
}
|
||||||
@@ -313,7 +338,12 @@ class FirMemberDeserializer(private val c: FirDeserializationContext) {
|
|||||||
private fun ProtoBuf.Type.toTypeRef(context: FirDeserializationContext): FirTypeRef {
|
private fun ProtoBuf.Type.toTypeRef(context: FirDeserializationContext): FirTypeRef {
|
||||||
return buildResolvedTypeRef {
|
return buildResolvedTypeRef {
|
||||||
type = context.typeDeserializer.type(this@toTypeRef)
|
type = context.typeDeserializer.type(this@toTypeRef)
|
||||||
annotations += context.annotationDeserializer.loadTypeAnnotations(this@toTypeRef, context.nameResolver)
|
annotations += context.annotationDeserializer.loadTypeAnnotations(
|
||||||
|
c.containingDeclaration,
|
||||||
|
this@toTypeRef,
|
||||||
|
context.nameResolver,
|
||||||
|
context.typeTable
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.fir.deserialization
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.descriptors.SourceElement
|
||||||
|
import org.jetbrains.kotlin.metadata.ProtoBuf
|
||||||
|
import org.jetbrains.kotlin.metadata.deserialization.Flags
|
||||||
|
import org.jetbrains.kotlin.name.ClassId
|
||||||
|
import org.jetbrains.kotlin.name.FqName
|
||||||
|
|
||||||
|
sealed class ProtoContainer(
|
||||||
|
val sourceElement: SourceElement?
|
||||||
|
) {
|
||||||
|
class Class(
|
||||||
|
val classProto: ProtoBuf.Class,
|
||||||
|
val outerClass: Class?,
|
||||||
|
val classId: ClassId,
|
||||||
|
sourceElement: SourceElement?
|
||||||
|
) : ProtoContainer(sourceElement) {
|
||||||
|
val kind: ProtoBuf.Class.Kind = Flags.CLASS_KIND.get(classProto.flags) ?: ProtoBuf.Class.Kind
|
||||||
|
.CLASS
|
||||||
|
val isInner: Boolean = Flags.IS_INNER.get(classProto.flags)
|
||||||
|
|
||||||
|
override fun debugFqName(): FqName = classId.asSingleFqName()
|
||||||
|
}
|
||||||
|
|
||||||
|
class Package(
|
||||||
|
val fqName: FqName,
|
||||||
|
sourceElement: SourceElement?
|
||||||
|
) : ProtoContainer(sourceElement) {
|
||||||
|
override fun debugFqName(): FqName = fqName
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract fun debugFqName(): FqName
|
||||||
|
|
||||||
|
override fun toString() = "${this::class.java.simpleName}: ${debugFqName()}"
|
||||||
|
}
|
||||||
+1
-1
@@ -77,7 +77,7 @@ class FirBuiltinSymbolProvider(val session: FirSession, val kotlinScopeProvider:
|
|||||||
private val memberDeserializer by lazy {
|
private val memberDeserializer by lazy {
|
||||||
FirDeserializationContext.createForPackage(
|
FirDeserializationContext.createForPackage(
|
||||||
fqName, packageProto.`package`, nameResolver, session,
|
fqName, packageProto.`package`, nameResolver, session,
|
||||||
FirBuiltinAnnotationDeserializer(session),
|
FirBuiltinAnnotationDeserializer(session), null
|
||||||
).memberDeserializer
|
).memberDeserializer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
public final fun foo(): R|kotlin/Unit|
|
@R|test/Anno|() public final fun foo(): R|kotlin/Unit|
|
||||||
|
|
||||||
public final annotation class Anno : R|kotlin/Annotation| {
|
public final annotation class Anno : R|kotlin/Annotation| {
|
||||||
public final val t: R|java/lang/annotation/ElementType|
|
public final val t: R|java/lang/annotation/ElementType|
|
||||||
|
|||||||
Vendored
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
public final fun baz(): R|kotlin/Unit|
|
@R|test/Anno|() public final fun baz(): R|kotlin/Unit|
|
||||||
|
|
||||||
public final fun foo(): R|kotlin/Unit|
|
@R|test/Anno|() public final fun foo(): R|kotlin/Unit|
|
||||||
|
|
||||||
public final annotation class Anno : R|kotlin/Annotation| {
|
public final annotation class Anno : R|kotlin/Annotation| {
|
||||||
public final val t: R|kotlin/Array<out java/lang/annotation/ElementType>|
|
public final val t: R|kotlin/Array<out java/lang/annotation/ElementType>|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
public final fun function(): R|kotlin/Unit|
|
@R|test/Anno|() public final fun function(): R|kotlin/Unit|
|
||||||
|
|
||||||
public final annotation class Anno : R|kotlin/Annotation| {
|
public final annotation class Anno : R|kotlin/Annotation| {
|
||||||
public constructor(): R|test/Anno|
|
public constructor(): R|test/Anno|
|
||||||
|
|||||||
Vendored
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
public final fun baz(): R|kotlin/Unit|
|
@R|test/Anno|() public final fun baz(): R|kotlin/Unit|
|
||||||
|
|
||||||
public final fun foo(): R|kotlin/Unit|
|
@R|test/Anno|() public final fun foo(): R|kotlin/Unit|
|
||||||
|
|
||||||
public final annotation class Anno : R|kotlin/Annotation| {
|
public final annotation class Anno : R|kotlin/Annotation| {
|
||||||
public final val t: R|kotlin/Array<out kotlin/String>|
|
public final val t: R|kotlin/Array<out kotlin/String>|
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
class A {
|
||||||
|
val x by mutableMapOf<String, Int>()
|
||||||
|
val y: Int by mutableMapOf<String, Int>()
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
FILE: delegationByMap.kt
|
||||||
|
public final class A : R|kotlin/Any| {
|
||||||
|
public constructor(): R|A| {
|
||||||
|
super<R|kotlin/Any|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
public final val x: R|kotlin/Int|by R|kotlin/collections/mutableMapOf|<R|kotlin/String|, R|kotlin/Int|>()
|
||||||
|
public get(): R|kotlin/Int| {
|
||||||
|
^ D|/A.x|.R|kotlin/collections/getValue|<R|kotlin/Int|, R|kotlin/Int|>(this@R|/A|, ::R|/A.x|)
|
||||||
|
}
|
||||||
|
|
||||||
|
public final val y: R|kotlin/Int|by R|kotlin/collections/mutableMapOf|<R|kotlin/String|, R|kotlin/Int|>()
|
||||||
|
public get(): R|kotlin/Int| {
|
||||||
|
^ D|/A.y|.R|kotlin/collections/getValue|<R|kotlin/Int|, R|kotlin/Int|>(this@R|/A|, ::R|/A.y|)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+4
-4
@@ -41,14 +41,14 @@ FILE: delegateTypeMismatch.kt
|
|||||||
D|/A.classifierNamePolicy|.<Inapplicable(INAPPLICABLE): [kotlin/properties/ReadWriteProperty.setValue]>#(this@R|/A|, ::R|/A.classifierNamePolicy|, R|<local>/classifierNamePolicy|)
|
D|/A.classifierNamePolicy|.<Inapplicable(INAPPLICABLE): [kotlin/properties/ReadWriteProperty.setValue]>#(this@R|/A|, ::R|/A.classifierNamePolicy|, R|<local>/classifierNamePolicy|)
|
||||||
}
|
}
|
||||||
|
|
||||||
public final var typeNormalizer: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/getValue, kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>by <Inapplicable(INAPPLICABLE): [/A.property]>#<R|(KotlinType) -> KotlinType|>(property@fun <anonymous>(): R|ERROR CLASS: Unresolved name: it| {
|
public final var typeNormalizer: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>by <Inapplicable(INAPPLICABLE): [/A.property]>#<R|(KotlinType) -> KotlinType|>(property@fun <anonymous>(): R|ERROR CLASS: Unresolved name: it| {
|
||||||
^ <Unresolved name: it>#
|
^ <Unresolved name: it>#
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
public get(): <ERROR TYPE REF: Ambiguity: getValue, [kotlin/getValue, kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]> {
|
public get(): <ERROR TYPE REF: Ambiguity: getValue, [kotlin/getValue, kotlin/collections/getValue, kotlin/collections/getValue]> {
|
||||||
^ D|/A.typeNormalizer|.<Ambiguity: getValue, [kotlin/getValue, kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#(this@R|/A|, ::R|/A.typeNormalizer|)
|
^ D|/A.typeNormalizer|.<Ambiguity: getValue, [kotlin/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#(this@R|/A|, ::R|/A.typeNormalizer|)
|
||||||
}
|
}
|
||||||
public set(<set-?>: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/getValue, kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>): R|kotlin/Unit| {
|
public set(<set-?>: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>): R|kotlin/Unit| {
|
||||||
D|/A.typeNormalizer|.<Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#(this@R|/A|, ::R|/A.typeNormalizer|, R|<local>/typeNormalizer|)
|
D|/A.typeNormalizer|.<Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#(this@R|/A|, ::R|/A.typeNormalizer|, R|<local>/typeNormalizer|)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,19 +7,19 @@ FILE: simpleDelegatedToMap.kt
|
|||||||
public final val map: R|kotlin/collections/MutableMap<kotlin/String, kotlin/Any>| = R|<local>/map|
|
public final val map: R|kotlin/collections/MutableMap<kotlin/String, kotlin/Any>| = R|<local>/map|
|
||||||
public get(): R|kotlin/collections/MutableMap<kotlin/String, kotlin/Any>|
|
public get(): R|kotlin/collections/MutableMap<kotlin/String, kotlin/Any>|
|
||||||
|
|
||||||
public final var foo: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>by R|<local>/map|
|
public final var foo: R|kotlin/Any|by R|<local>/map|
|
||||||
public get(): <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]> {
|
public get(): R|kotlin/Any| {
|
||||||
^ D|/C.foo|.<Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#(this@R|/C|, ::R|/C.foo|)
|
^ D|/C.foo|.R|kotlin/collections/getValue|<R|kotlin/Any|, R|kotlin/Any|>(this@R|/C|, ::R|/C.foo|)
|
||||||
}
|
}
|
||||||
public set(<set-?>: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>): R|kotlin/Unit| {
|
public set(<set-?>: R|kotlin/Any|): R|kotlin/Unit| {
|
||||||
D|/C.foo|.<Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#(this@R|/C|, ::R|/C.foo|, R|<local>/foo|)
|
D|/C.foo|.R|kotlin/collections/setValue|<R|kotlin/Any|>(this@R|/C|, ::R|/C.foo|, R|<local>/foo|)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public final var bar: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>by R|kotlin/collections/hashMapOf|<R|kotlin/String|, R|kotlin/Any|>()
|
public final var bar: R|ft<kotlin/Any, kotlin/Any?>!|by R|kotlin/collections/hashMapOf|<R|kotlin/String|, R|kotlin/Any|>()
|
||||||
public get(): <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]> {
|
public get(): R|ft<kotlin/Any, kotlin/Any?>!| {
|
||||||
^ D|/bar|.<Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#(Null(null), ::R|/bar|)
|
^ D|/bar|.R|kotlin/collections/getValue|<R|ft<kotlin/Any, kotlin/Any?>!|, R|ft<kotlin/Any, kotlin/Any?>!|>(Null(null), ::R|/bar|)
|
||||||
}
|
}
|
||||||
public set(<set-?>: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>): R|kotlin/Unit| {
|
public set(<set-?>: R|ft<kotlin/Any, kotlin/Any?>!|): R|kotlin/Unit| {
|
||||||
D|/bar|.<Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#(Null(null), ::R|/bar|, R|<local>/bar|)
|
D|/bar|.R|kotlin/collections/setValue|<R|ft<kotlin/Any, kotlin/Any?>!|>(Null(null), ::R|/bar|, R|<local>/bar|)
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+5
@@ -83,6 +83,11 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic
|
|||||||
runTest("compiler/fir/resolve/testData/resolveWithStdlib/concurrentMapOfAliases.kt");
|
runTest("compiler/fir/resolve/testData/resolveWithStdlib/concurrentMapOfAliases.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("delegationByMap.kt")
|
||||||
|
public void testDelegationByMap() throws Exception {
|
||||||
|
runTest("compiler/fir/resolve/testData/resolveWithStdlib/delegationByMap.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("emptyArray.kt")
|
@TestMetadata("emptyArray.kt")
|
||||||
public void testEmptyArray() throws Exception {
|
public void testEmptyArray() throws Exception {
|
||||||
runTest("compiler/fir/resolve/testData/resolveWithStdlib/emptyArray.kt");
|
runTest("compiler/fir/resolve/testData/resolveWithStdlib/emptyArray.kt");
|
||||||
|
|||||||
@@ -109,23 +109,28 @@ FILE fqName:<root> fileName:/classLevelProperties.kt
|
|||||||
CALL 'public final fun hashMapOf <K, V> (): java.util.HashMap<K of kotlin.collections.hashMapOf, V of kotlin.collections.hashMapOf> [inline] declared in kotlin.collections' type=java.util.HashMap<kotlin.String, kotlin.Int> origin=null
|
CALL 'public final fun hashMapOf <K, V> (): java.util.HashMap<K of kotlin.collections.hashMapOf, V of kotlin.collections.hashMapOf> [inline] declared in kotlin.collections' type=java.util.HashMap<kotlin.String, kotlin.Int> origin=null
|
||||||
<K>: kotlin.String
|
<K>: kotlin.String
|
||||||
<V>: kotlin.Int
|
<V>: kotlin.Int
|
||||||
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-test8> visibility:public modality:FINAL <> ($this:<root>.C) returnType:IrErrorType
|
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-test8> visibility:public modality:FINAL <> ($this:<root>.C) returnType:kotlin.Int?
|
||||||
correspondingProperty: PROPERTY name:test8 visibility:public modality:FINAL [delegated,var]
|
correspondingProperty: PROPERTY name:test8 visibility:public modality:FINAL [delegated,var]
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.C
|
$this: VALUE_PARAMETER name:<this> type:<root>.C
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public final fun <get-test8> (): IrErrorType declared in <root>.C'
|
RETURN type=kotlin.Nothing from='public final fun <get-test8> (): kotlin.Int? declared in <root>.C'
|
||||||
ERROR_CALL 'Unresolved reference: <Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#' type=IrErrorType
|
CALL 'public final fun getValue <V, V1> (thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>): V1 of kotlin.collections.getValue [inline,operator] declared in kotlin.collections' type=kotlin.Int? origin=null
|
||||||
GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
|
<V>: kotlin.Int?
|
||||||
PROPERTY_REFERENCE 'public final test8: IrErrorType [delegated,var]' field='FIELD PROPERTY_DELEGATE name:test8$delegate type:java.util.HashMap<kotlin.String, kotlin.Int> visibility:private [final]' getter='public final fun <get-test8> (): IrErrorType declared in <root>.C' setter='public final fun <set-test8> (<set-?>: IrErrorType): kotlin.Unit declared in <root>.C' type=kotlin.reflect.KProperty<*> origin=null
|
<V1>: kotlin.Int?
|
||||||
FUN DELEGATED_PROPERTY_ACCESSOR name:<set-test8> visibility:public modality:FINAL <> ($this:<root>.C, <set-?>:IrErrorType) returnType:kotlin.Unit
|
$receiver: GET_FIELD 'FIELD PROPERTY_DELEGATE name:test8$delegate type:java.util.HashMap<kotlin.String, kotlin.Int> visibility:private [final]' type=java.util.HashMap<kotlin.String, kotlin.Int> origin=GET_PROPERTY
|
||||||
|
thisRef: GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
|
||||||
|
property: PROPERTY_REFERENCE 'public final test8: kotlin.Int? [delegated,var]' field='FIELD PROPERTY_DELEGATE name:test8$delegate type:java.util.HashMap<kotlin.String, kotlin.Int> visibility:private [final]' getter='public final fun <get-test8> (): kotlin.Int? declared in <root>.C' setter='public final fun <set-test8> (<set-?>: kotlin.Int?): kotlin.Unit declared in <root>.C' type=kotlin.reflect.KProperty<*> origin=null
|
||||||
|
FUN DELEGATED_PROPERTY_ACCESSOR name:<set-test8> visibility:public modality:FINAL <> ($this:<root>.C, <set-?>:kotlin.Int?) returnType:kotlin.Unit
|
||||||
correspondingProperty: PROPERTY name:test8 visibility:public modality:FINAL [delegated,var]
|
correspondingProperty: PROPERTY name:test8 visibility:public modality:FINAL [delegated,var]
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.C
|
$this: VALUE_PARAMETER name:<this> type:<root>.C
|
||||||
VALUE_PARAMETER name:<set-?> index:0 type:IrErrorType
|
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.Int?
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#' type=IrErrorType
|
CALL 'public final fun setValue <V> (thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>, value: V of kotlin.collections.setValue): kotlin.Unit [inline,operator] declared in kotlin.collections' type=kotlin.Unit origin=null
|
||||||
GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
|
<V>: kotlin.Int?
|
||||||
PROPERTY_REFERENCE 'public final test8: IrErrorType [delegated,var]' field='FIELD PROPERTY_DELEGATE name:test8$delegate type:java.util.HashMap<kotlin.String, kotlin.Int> visibility:private [final]' getter='public final fun <get-test8> (): IrErrorType declared in <root>.C' setter='public final fun <set-test8> (<set-?>: IrErrorType): kotlin.Unit declared in <root>.C' type=kotlin.reflect.KProperty<*> origin=null
|
$receiver: GET_FIELD 'FIELD PROPERTY_DELEGATE name:test8$delegate type:java.util.HashMap<kotlin.String, kotlin.Int> visibility:private [final]' type=java.util.HashMap<kotlin.String, kotlin.Int> origin=GET_PROPERTY
|
||||||
GET_VAR '<set-?>: IrErrorType declared in <root>.C.<set-test8>' type=IrErrorType origin=null
|
thisRef: GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
|
||||||
|
property: PROPERTY_REFERENCE 'public final test8: kotlin.Int? [delegated,var]' field='FIELD PROPERTY_DELEGATE name:test8$delegate type:java.util.HashMap<kotlin.String, kotlin.Int> visibility:private [final]' getter='public final fun <get-test8> (): kotlin.Int? declared in <root>.C' setter='public final fun <set-test8> (<set-?>: kotlin.Int?): kotlin.Unit declared in <root>.C' type=kotlin.reflect.KProperty<*> origin=null
|
||||||
|
value: GET_VAR '<set-?>: kotlin.Int? declared in <root>.C.<set-test8>' type=kotlin.Int? origin=null
|
||||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||||
overridden:
|
overridden:
|
||||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||||
|
|||||||
@@ -61,23 +61,28 @@ FILE fqName:<root> fileName:/delegatedProperties.kt
|
|||||||
FIELD PROPERTY_DELEGATE name:test3$delegate type:kotlin.collections.MutableMap<kotlin.String, kotlin.Any> visibility:private [final]
|
FIELD PROPERTY_DELEGATE name:test3$delegate type:kotlin.collections.MutableMap<kotlin.String, kotlin.Any> visibility:private [final]
|
||||||
EXPRESSION_BODY
|
EXPRESSION_BODY
|
||||||
GET_VAR 'map: kotlin.collections.MutableMap<kotlin.String, kotlin.Any> declared in <root>.C.<init>' type=kotlin.collections.MutableMap<kotlin.String, kotlin.Any> origin=null
|
GET_VAR 'map: kotlin.collections.MutableMap<kotlin.String, kotlin.Any> declared in <root>.C.<init>' type=kotlin.collections.MutableMap<kotlin.String, kotlin.Any> origin=null
|
||||||
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-test3> visibility:public modality:FINAL <> ($this:<root>.C) returnType:IrErrorType
|
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-test3> visibility:public modality:FINAL <> ($this:<root>.C) returnType:kotlin.Any
|
||||||
correspondingProperty: PROPERTY name:test3 visibility:public modality:FINAL [delegated,var]
|
correspondingProperty: PROPERTY name:test3 visibility:public modality:FINAL [delegated,var]
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.C
|
$this: VALUE_PARAMETER name:<this> type:<root>.C
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public final fun <get-test3> (): IrErrorType declared in <root>.C'
|
RETURN type=kotlin.Nothing from='public final fun <get-test3> (): kotlin.Any declared in <root>.C'
|
||||||
ERROR_CALL 'Unresolved reference: <Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#' type=IrErrorType
|
CALL 'public final fun getValue <V, V1> (thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>): V1 of kotlin.collections.getValue [inline,operator] declared in kotlin.collections' type=kotlin.Any origin=null
|
||||||
GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
|
<V>: kotlin.Any
|
||||||
PROPERTY_REFERENCE 'public final test3: IrErrorType [delegated,var]' field='FIELD PROPERTY_DELEGATE name:test3$delegate type:kotlin.collections.MutableMap<kotlin.String, kotlin.Any> visibility:private [final]' getter='public final fun <get-test3> (): IrErrorType declared in <root>.C' setter='public final fun <set-test3> (<set-?>: IrErrorType): kotlin.Unit declared in <root>.C' type=kotlin.reflect.KProperty<*> origin=null
|
<V1>: kotlin.Any
|
||||||
FUN DELEGATED_PROPERTY_ACCESSOR name:<set-test3> visibility:public modality:FINAL <> ($this:<root>.C, <set-?>:IrErrorType) returnType:kotlin.Unit
|
$receiver: GET_FIELD 'FIELD PROPERTY_DELEGATE name:test3$delegate type:kotlin.collections.MutableMap<kotlin.String, kotlin.Any> visibility:private [final]' type=kotlin.collections.MutableMap<kotlin.String, kotlin.Any> origin=GET_PROPERTY
|
||||||
|
thisRef: GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
|
||||||
|
property: PROPERTY_REFERENCE 'public final test3: kotlin.Any [delegated,var]' field='FIELD PROPERTY_DELEGATE name:test3$delegate type:kotlin.collections.MutableMap<kotlin.String, kotlin.Any> visibility:private [final]' getter='public final fun <get-test3> (): kotlin.Any declared in <root>.C' setter='public final fun <set-test3> (<set-?>: kotlin.Any): kotlin.Unit declared in <root>.C' type=kotlin.reflect.KProperty<*> origin=null
|
||||||
|
FUN DELEGATED_PROPERTY_ACCESSOR name:<set-test3> visibility:public modality:FINAL <> ($this:<root>.C, <set-?>:kotlin.Any) returnType:kotlin.Unit
|
||||||
correspondingProperty: PROPERTY name:test3 visibility:public modality:FINAL [delegated,var]
|
correspondingProperty: PROPERTY name:test3 visibility:public modality:FINAL [delegated,var]
|
||||||
$this: VALUE_PARAMETER name:<this> type:<root>.C
|
$this: VALUE_PARAMETER name:<this> type:<root>.C
|
||||||
VALUE_PARAMETER name:<set-?> index:0 type:IrErrorType
|
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.Any
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#' type=IrErrorType
|
CALL 'public final fun setValue <V> (thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>, value: V of kotlin.collections.setValue): kotlin.Unit [inline,operator] declared in kotlin.collections' type=kotlin.Unit origin=null
|
||||||
GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
|
<V>: kotlin.Any
|
||||||
PROPERTY_REFERENCE 'public final test3: IrErrorType [delegated,var]' field='FIELD PROPERTY_DELEGATE name:test3$delegate type:kotlin.collections.MutableMap<kotlin.String, kotlin.Any> visibility:private [final]' getter='public final fun <get-test3> (): IrErrorType declared in <root>.C' setter='public final fun <set-test3> (<set-?>: IrErrorType): kotlin.Unit declared in <root>.C' type=kotlin.reflect.KProperty<*> origin=null
|
$receiver: GET_FIELD 'FIELD PROPERTY_DELEGATE name:test3$delegate type:kotlin.collections.MutableMap<kotlin.String, kotlin.Any> visibility:private [final]' type=kotlin.collections.MutableMap<kotlin.String, kotlin.Any> origin=GET_PROPERTY
|
||||||
GET_VAR '<set-?>: IrErrorType declared in <root>.C.<set-test3>' type=IrErrorType origin=null
|
thisRef: GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
|
||||||
|
property: PROPERTY_REFERENCE 'public final test3: kotlin.Any [delegated,var]' field='FIELD PROPERTY_DELEGATE name:test3$delegate type:kotlin.collections.MutableMap<kotlin.String, kotlin.Any> visibility:private [final]' getter='public final fun <get-test3> (): kotlin.Any declared in <root>.C' setter='public final fun <set-test3> (<set-?>: kotlin.Any): kotlin.Unit declared in <root>.C' type=kotlin.reflect.KProperty<*> origin=null
|
||||||
|
value: GET_VAR '<set-?>: kotlin.Any declared in <root>.C.<set-test3>' type=kotlin.Any origin=null
|
||||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||||
overridden:
|
overridden:
|
||||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||||
@@ -97,18 +102,23 @@ FILE fqName:<root> fileName:/delegatedProperties.kt
|
|||||||
CALL 'public final fun hashMapOf <K, V> (): java.util.HashMap<K of kotlin.collections.hashMapOf, V of kotlin.collections.hashMapOf> [inline] declared in kotlin.collections' type=java.util.HashMap<kotlin.String, kotlin.Any> origin=null
|
CALL 'public final fun hashMapOf <K, V> (): java.util.HashMap<K of kotlin.collections.hashMapOf, V of kotlin.collections.hashMapOf> [inline] declared in kotlin.collections' type=java.util.HashMap<kotlin.String, kotlin.Any> origin=null
|
||||||
<K>: kotlin.String
|
<K>: kotlin.String
|
||||||
<V>: kotlin.Any
|
<V>: kotlin.Any
|
||||||
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-test4> visibility:public modality:FINAL <> () returnType:IrErrorType
|
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-test4> visibility:public modality:FINAL <> () returnType:kotlin.Any?
|
||||||
correspondingProperty: PROPERTY name:test4 visibility:public modality:FINAL [delegated,var]
|
correspondingProperty: PROPERTY name:test4 visibility:public modality:FINAL [delegated,var]
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public final fun <get-test4> (): IrErrorType declared in <root>'
|
RETURN type=kotlin.Nothing from='public final fun <get-test4> (): kotlin.Any? declared in <root>'
|
||||||
ERROR_CALL 'Unresolved reference: <Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#' type=IrErrorType
|
CALL 'public final fun getValue <V, V1> (thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>): V1 of kotlin.collections.getValue [inline,operator] declared in kotlin.collections' type=kotlin.Any? origin=null
|
||||||
CONST Null type=kotlin.Nothing? value=null
|
<V>: kotlin.Any?
|
||||||
PROPERTY_REFERENCE 'public final test4: IrErrorType [delegated,var]' field='FIELD PROPERTY_DELEGATE name:test4$delegate type:java.util.HashMap<kotlin.String, kotlin.Any> visibility:private [final,static]' getter='public final fun <get-test4> (): IrErrorType declared in <root>' setter='public final fun <set-test4> (<set-?>: IrErrorType): kotlin.Unit declared in <root>' type=kotlin.reflect.KProperty<*> origin=null
|
<V1>: kotlin.Any?
|
||||||
FUN DELEGATED_PROPERTY_ACCESSOR name:<set-test4> visibility:public modality:FINAL <> (<set-?>:IrErrorType) returnType:kotlin.Unit
|
$receiver: GET_FIELD 'FIELD PROPERTY_DELEGATE name:test4$delegate type:java.util.HashMap<kotlin.String, kotlin.Any> visibility:private [final,static]' type=java.util.HashMap<kotlin.String, kotlin.Any> origin=GET_PROPERTY
|
||||||
|
thisRef: CONST Null type=kotlin.Nothing? value=null
|
||||||
|
property: PROPERTY_REFERENCE 'public final test4: kotlin.Any? [delegated,var]' field='FIELD PROPERTY_DELEGATE name:test4$delegate type:java.util.HashMap<kotlin.String, kotlin.Any> visibility:private [final,static]' getter='public final fun <get-test4> (): kotlin.Any? declared in <root>' setter='public final fun <set-test4> (<set-?>: kotlin.Any?): kotlin.Unit declared in <root>' type=kotlin.reflect.KProperty<*> origin=null
|
||||||
|
FUN DELEGATED_PROPERTY_ACCESSOR name:<set-test4> visibility:public modality:FINAL <> (<set-?>:kotlin.Any?) returnType:kotlin.Unit
|
||||||
correspondingProperty: PROPERTY name:test4 visibility:public modality:FINAL [delegated,var]
|
correspondingProperty: PROPERTY name:test4 visibility:public modality:FINAL [delegated,var]
|
||||||
VALUE_PARAMETER name:<set-?> index:0 type:IrErrorType
|
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.Any?
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#' type=IrErrorType
|
CALL 'public final fun setValue <V> (thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>, value: V of kotlin.collections.setValue): kotlin.Unit [inline,operator] declared in kotlin.collections' type=kotlin.Unit origin=null
|
||||||
CONST Null type=kotlin.Nothing? value=null
|
<V>: kotlin.Any?
|
||||||
PROPERTY_REFERENCE 'public final test4: IrErrorType [delegated,var]' field='FIELD PROPERTY_DELEGATE name:test4$delegate type:java.util.HashMap<kotlin.String, kotlin.Any> visibility:private [final,static]' getter='public final fun <get-test4> (): IrErrorType declared in <root>' setter='public final fun <set-test4> (<set-?>: IrErrorType): kotlin.Unit declared in <root>' type=kotlin.reflect.KProperty<*> origin=null
|
$receiver: GET_FIELD 'FIELD PROPERTY_DELEGATE name:test4$delegate type:java.util.HashMap<kotlin.String, kotlin.Any> visibility:private [final,static]' type=java.util.HashMap<kotlin.String, kotlin.Any> origin=GET_PROPERTY
|
||||||
GET_VAR '<set-?>: IrErrorType declared in <root>.<set-test4>' type=IrErrorType origin=null
|
thisRef: CONST Null type=kotlin.Nothing? value=null
|
||||||
|
property: PROPERTY_REFERENCE 'public final test4: kotlin.Any? [delegated,var]' field='FIELD PROPERTY_DELEGATE name:test4$delegate type:java.util.HashMap<kotlin.String, kotlin.Any> visibility:private [final,static]' getter='public final fun <get-test4> (): kotlin.Any? declared in <root>' setter='public final fun <set-test4> (<set-?>: kotlin.Any?): kotlin.Unit declared in <root>' type=kotlin.reflect.KProperty<*> origin=null
|
||||||
|
value: GET_VAR '<set-?>: kotlin.Any? declared in <root>.<set-test4>' type=kotlin.Any? origin=null
|
||||||
|
|||||||
@@ -6,20 +6,18 @@ FILE fqName:<root> fileName:/localDelegatedProperties.kt
|
|||||||
message: GET_VAR 'val x: kotlin.Int [val] declared in <root>.test1' type=kotlin.Int origin=null
|
message: GET_VAR 'val x: kotlin.Int [val] declared in <root>.test1' type=kotlin.Int origin=null
|
||||||
FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
VAR name:x type:IrErrorType [var]
|
VAR name:x type:kotlin.Int? [var]
|
||||||
SET_VAR 'var x: IrErrorType [var] declared in <root>.test2' type=kotlin.Unit origin=null
|
SET_VAR 'var x: kotlin.Int? [var] declared in <root>.test2' type=kotlin.Unit origin=null
|
||||||
CONST Int type=kotlin.Int value=0
|
CONST Int type=kotlin.Int value=0
|
||||||
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val]
|
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val]
|
||||||
TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int
|
TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int
|
||||||
GET_VAR 'var x: IrErrorType [var] declared in <root>.test2' type=IrErrorType origin=null
|
GET_VAR 'var x: kotlin.Int? [var] declared in <root>.test2' type=kotlin.Int? origin=null
|
||||||
SET_VAR 'var x: IrErrorType [var] declared in <root>.test2' type=kotlin.Unit origin=null
|
SET_VAR 'var x: kotlin.Int? [var] declared in <root>.test2' type=kotlin.Unit origin=null
|
||||||
CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||||
$this: TYPE_OP type=IrErrorType origin=IMPLICIT_CAST typeOperand=IrErrorType
|
$this: GET_VAR 'val tmp_0: kotlin.Int [val] declared in <root>.test2' type=kotlin.Int origin=null
|
||||||
GET_VAR 'val tmp_0: kotlin.Int [val] declared in <root>.test2' type=kotlin.Int origin=null
|
GET_VAR 'val tmp_0: kotlin.Int [val] declared in <root>.test2' type=kotlin.Int origin=null
|
||||||
TYPE_OP type=IrErrorType origin=IMPLICIT_CAST typeOperand=IrErrorType
|
SET_VAR 'var x: kotlin.Int? [var] declared in <root>.test2' type=kotlin.Unit origin=null
|
||||||
GET_VAR 'val tmp_0: kotlin.Int [val] declared in <root>.test2' type=kotlin.Int origin=null
|
|
||||||
SET_VAR 'var x: IrErrorType [var] declared in <root>.test2' type=kotlin.Unit origin=null
|
|
||||||
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null
|
||||||
$this: TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int
|
$this: TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int
|
||||||
GET_VAR 'var x: IrErrorType [var] declared in <root>.test2' type=IrErrorType origin=null
|
GET_VAR 'var x: kotlin.Int? [var] declared in <root>.test2' type=kotlin.Int? origin=null
|
||||||
other: CONST Int type=kotlin.Int value=1
|
other: CONST Int type=kotlin.Int value=1
|
||||||
|
|||||||
@@ -87,18 +87,23 @@ FILE fqName:<root> fileName:/packageLevelProperties.kt
|
|||||||
CALL 'public final fun hashMapOf <K, V> (): java.util.HashMap<K of kotlin.collections.hashMapOf, V of kotlin.collections.hashMapOf> [inline] declared in kotlin.collections' type=java.util.HashMap<kotlin.String, kotlin.Int> origin=null
|
CALL 'public final fun hashMapOf <K, V> (): java.util.HashMap<K of kotlin.collections.hashMapOf, V of kotlin.collections.hashMapOf> [inline] declared in kotlin.collections' type=java.util.HashMap<kotlin.String, kotlin.Int> origin=null
|
||||||
<K>: kotlin.String
|
<K>: kotlin.String
|
||||||
<V>: kotlin.Int
|
<V>: kotlin.Int
|
||||||
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-test8> visibility:public modality:FINAL <> () returnType:IrErrorType
|
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-test8> visibility:public modality:FINAL <> () returnType:kotlin.Int?
|
||||||
correspondingProperty: PROPERTY name:test8 visibility:public modality:FINAL [delegated,var]
|
correspondingProperty: PROPERTY name:test8 visibility:public modality:FINAL [delegated,var]
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from='public final fun <get-test8> (): IrErrorType declared in <root>'
|
RETURN type=kotlin.Nothing from='public final fun <get-test8> (): kotlin.Int? declared in <root>'
|
||||||
ERROR_CALL 'Unresolved reference: <Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#' type=IrErrorType
|
CALL 'public final fun getValue <V, V1> (thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>): V1 of kotlin.collections.getValue [inline,operator] declared in kotlin.collections' type=kotlin.Int? origin=null
|
||||||
CONST Null type=kotlin.Nothing? value=null
|
<V>: kotlin.Int?
|
||||||
PROPERTY_REFERENCE 'public final test8: IrErrorType [delegated,var]' field='FIELD PROPERTY_DELEGATE name:test8$delegate type:java.util.HashMap<kotlin.String, kotlin.Int> visibility:private [final,static]' getter='public final fun <get-test8> (): IrErrorType declared in <root>' setter='public final fun <set-test8> (<set-?>: IrErrorType): kotlin.Unit declared in <root>' type=kotlin.reflect.KProperty<*> origin=null
|
<V1>: kotlin.Int?
|
||||||
FUN DELEGATED_PROPERTY_ACCESSOR name:<set-test8> visibility:public modality:FINAL <> (<set-?>:IrErrorType) returnType:kotlin.Unit
|
$receiver: GET_FIELD 'FIELD PROPERTY_DELEGATE name:test8$delegate type:java.util.HashMap<kotlin.String, kotlin.Int> visibility:private [final,static]' type=java.util.HashMap<kotlin.String, kotlin.Int> origin=GET_PROPERTY
|
||||||
|
thisRef: CONST Null type=kotlin.Nothing? value=null
|
||||||
|
property: PROPERTY_REFERENCE 'public final test8: kotlin.Int? [delegated,var]' field='FIELD PROPERTY_DELEGATE name:test8$delegate type:java.util.HashMap<kotlin.String, kotlin.Int> visibility:private [final,static]' getter='public final fun <get-test8> (): kotlin.Int? declared in <root>' setter='public final fun <set-test8> (<set-?>: kotlin.Int?): kotlin.Unit declared in <root>' type=kotlin.reflect.KProperty<*> origin=null
|
||||||
|
FUN DELEGATED_PROPERTY_ACCESSOR name:<set-test8> visibility:public modality:FINAL <> (<set-?>:kotlin.Int?) returnType:kotlin.Unit
|
||||||
correspondingProperty: PROPERTY name:test8 visibility:public modality:FINAL [delegated,var]
|
correspondingProperty: PROPERTY name:test8 visibility:public modality:FINAL [delegated,var]
|
||||||
VALUE_PARAMETER name:<set-?> index:0 type:IrErrorType
|
VALUE_PARAMETER name:<set-?> index:0 type:kotlin.Int?
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#' type=IrErrorType
|
CALL 'public final fun setValue <V> (thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>, value: V of kotlin.collections.setValue): kotlin.Unit [inline,operator] declared in kotlin.collections' type=kotlin.Unit origin=null
|
||||||
CONST Null type=kotlin.Nothing? value=null
|
<V>: kotlin.Int?
|
||||||
PROPERTY_REFERENCE 'public final test8: IrErrorType [delegated,var]' field='FIELD PROPERTY_DELEGATE name:test8$delegate type:java.util.HashMap<kotlin.String, kotlin.Int> visibility:private [final,static]' getter='public final fun <get-test8> (): IrErrorType declared in <root>' setter='public final fun <set-test8> (<set-?>: IrErrorType): kotlin.Unit declared in <root>' type=kotlin.reflect.KProperty<*> origin=null
|
$receiver: GET_FIELD 'FIELD PROPERTY_DELEGATE name:test8$delegate type:java.util.HashMap<kotlin.String, kotlin.Int> visibility:private [final,static]' type=java.util.HashMap<kotlin.String, kotlin.Int> origin=GET_PROPERTY
|
||||||
GET_VAR '<set-?>: IrErrorType declared in <root>.<set-test8>' type=IrErrorType origin=null
|
thisRef: CONST Null type=kotlin.Nothing? value=null
|
||||||
|
property: PROPERTY_REFERENCE 'public final test8: kotlin.Int? [delegated,var]' field='FIELD PROPERTY_DELEGATE name:test8$delegate type:java.util.HashMap<kotlin.String, kotlin.Int> visibility:private [final,static]' getter='public final fun <get-test8> (): kotlin.Int? declared in <root>' setter='public final fun <set-test8> (<set-?>: kotlin.Int?): kotlin.Unit declared in <root>' type=kotlin.reflect.KProperty<*> origin=null
|
||||||
|
value: GET_VAR '<set-?>: kotlin.Int? declared in <root>.<set-test8>' type=kotlin.Int? origin=null
|
||||||
|
|||||||
Reference in New Issue
Block a user