Revert "[FIR] Support deserialization of annotations on JVM"
This is needed because of that commit tragically decreases performance, so this changes will be delayed for now
This commit is contained in:
-44
@@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-332
@@ -5,349 +5,18 @@
|
|||||||
|
|
||||||
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) {
|
||||||
private val cache: MutableMap<KotlinJvmBinaryClass, Storage> = mutableMapOf()
|
override fun loadTypeAnnotations(typeProto: ProtoBuf.Type, nameResolver: NameResolver): List<FirAnnotationCall> {
|
||||||
|
|
||||||
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,7 +122,6 @@ class KotlinDeserializedJvmSymbolsProvider(
|
|||||||
FirDeserializationContext.createForPackage(
|
FirDeserializationContext.createForPackage(
|
||||||
packageFqName, packageProto, nameResolver, session,
|
packageFqName, packageProto, nameResolver, session,
|
||||||
JvmBinaryAnnotationDeserializer(session),
|
JvmBinaryAnnotationDeserializer(session),
|
||||||
source
|
|
||||||
),
|
),
|
||||||
source,
|
source,
|
||||||
)
|
)
|
||||||
|
|||||||
+7
-28
@@ -31,67 +31,46 @@ 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(
|
||||||
protected val session: FirSession
|
private val session: FirSession
|
||||||
) {
|
) {
|
||||||
protected val protocol = BuiltInSerializerProtocol
|
protected val protocol = BuiltInSerializerProtocol
|
||||||
|
|
||||||
open fun loadClassAnnotations(classProto: ProtoBuf.Class, nameResolver: NameResolver): List<FirAnnotationCall> {
|
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) }
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun loadFunctionAnnotations(
|
fun loadFunctionAnnotations(functionProto: ProtoBuf.Function, nameResolver: NameResolver): List<FirAnnotationCall> {
|
||||||
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) }
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun loadPropertyAnnotations(
|
fun loadPropertyAnnotations(propertyProto: ProtoBuf.Property, nameResolver: NameResolver): List<FirAnnotationCall> {
|
||||||
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) }
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun loadConstructorAnnotations(
|
fun loadConstructorAnnotations(constructorProto: ProtoBuf.Constructor, nameResolver: NameResolver): List<FirAnnotationCall> {
|
||||||
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) }
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun loadValueParameterAnnotations(
|
fun loadValueParameterAnnotations(valueParameterProto: ProtoBuf.ValueParameter, nameResolver: NameResolver): List<FirAnnotationCall> {
|
||||||
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(containingDeclaration: ProtoContainer, typeProto: ProtoBuf.Type, nameResolver: NameResolver, typeTable: TypeTable): List<FirAnnotationCall>
|
abstract fun loadTypeAnnotations(typeProto: ProtoBuf.Type, nameResolver: NameResolver): 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)
|
||||||
|
|||||||
+2
-11
@@ -63,18 +63,9 @@ 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,
|
classId, classProto, nameResolver, session,
|
||||||
classProto,
|
|
||||||
nameResolver,
|
|
||||||
session,
|
|
||||||
defaultAnnotationDeserializer ?: FirBuiltinAnnotationDeserializer(session)
|
defaultAnnotationDeserializer ?: FirBuiltinAnnotationDeserializer(session)
|
||||||
)
|
)
|
||||||
classBuilder.apply {
|
classBuilder.apply {
|
||||||
|
|||||||
+1
-7
@@ -10,18 +10,12 @@ 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(
|
override fun loadTypeAnnotations(typeProto: ProtoBuf.Type, nameResolver: NameResolver): List<FirAnnotationCall> {
|
||||||
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) }
|
||||||
|
|||||||
+14
-44
@@ -6,14 +6,11 @@
|
|||||||
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.FirDeclarationStatusImpl
|
import org.jetbrains.kotlin.fir.declarations.impl.*
|
||||||
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
|
||||||
@@ -40,21 +37,19 @@ 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, containingDeclaration
|
annotationDeserializer, components
|
||||||
)
|
)
|
||||||
|
|
||||||
val memberDeserializer: FirMemberDeserializer = FirMemberDeserializer(this)
|
val memberDeserializer: FirMemberDeserializer = FirMemberDeserializer(this)
|
||||||
@@ -65,8 +60,7 @@ 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),
|
||||||
@@ -74,8 +68,7 @@ class FirDeserializationContext(
|
|||||||
annotationDeserializer,
|
annotationDeserializer,
|
||||||
fqName,
|
fqName,
|
||||||
relativeClassName = null,
|
relativeClassName = null,
|
||||||
typeParameterProtos = emptyList(),
|
typeParameterProtos = emptyList()
|
||||||
ProtoContainer.Package(fqName, sourceElement)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
fun createForClass(
|
fun createForClass(
|
||||||
@@ -91,8 +84,7 @@ 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(
|
||||||
@@ -102,8 +94,7 @@ 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,
|
||||||
@@ -119,8 +110,7 @@ class FirDeserializationContext(
|
|||||||
null
|
null
|
||||||
),
|
),
|
||||||
annotationDeserializer,
|
annotationDeserializer,
|
||||||
FirDeserializationComponents(),
|
FirDeserializationComponents()
|
||||||
containingDeclaration
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -190,12 +180,7 @@ 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(
|
annotations += c.annotationDeserializer.loadPropertyAnnotations(proto, local.nameResolver)
|
||||||
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)))
|
||||||
@@ -243,12 +228,7 @@ 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(
|
annotations += local.annotationDeserializer.loadFunctionAnnotations(proto, local.nameResolver)
|
||||||
c.containingDeclaration,
|
|
||||||
proto,
|
|
||||||
local.nameResolver,
|
|
||||||
local.typeTable
|
|
||||||
)
|
|
||||||
this.containerSource = containerSource
|
this.containerSource = containerSource
|
||||||
}
|
}
|
||||||
if (proto.hasContract()) {
|
if (proto.hasContract()) {
|
||||||
@@ -295,7 +275,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(c.containingDeclaration, proto, local.nameResolver, local.typeTable)
|
annotations += local.annotationDeserializer.loadConstructorAnnotations(proto, local.nameResolver)
|
||||||
}.build()
|
}.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,12 +305,7 @@ 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(
|
annotations += c.annotationDeserializer.loadValueParameterAnnotations(proto, c.nameResolver)
|
||||||
c.containingDeclaration,
|
|
||||||
proto,
|
|
||||||
c.nameResolver,
|
|
||||||
c.typeTable
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}.toList()
|
}.toList()
|
||||||
}
|
}
|
||||||
@@ -338,12 +313,7 @@ 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(
|
annotations += context.annotationDeserializer.loadTypeAnnotations(this@toTypeRef, context.nameResolver)
|
||||||
c.containingDeclaration,
|
|
||||||
this@toTypeRef,
|
|
||||||
context.nameResolver,
|
|
||||||
context.typeTable
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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), null
|
FirBuiltinAnnotationDeserializer(session),
|
||||||
).memberDeserializer
|
).memberDeserializer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
@R|test/Anno|() public final fun foo(): R|kotlin/Unit|
|
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 @@
|
|||||||
@R|test/Anno|() public final fun baz(): R|kotlin/Unit|
|
public final fun baz(): R|kotlin/Unit|
|
||||||
|
|
||||||
@R|test/Anno|() public final fun foo(): R|kotlin/Unit|
|
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 @@
|
|||||||
@R|test/Anno|() public final fun function(): R|kotlin/Unit|
|
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 @@
|
|||||||
@R|test/Anno|() public final fun baz(): R|kotlin/Unit|
|
public final fun baz(): R|kotlin/Unit|
|
||||||
|
|
||||||
@R|test/Anno|() public final fun foo(): R|kotlin/Unit|
|
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>|
|
||||||
|
|||||||
@@ -41,14 +41,14 @@ FILE: delegateTypeMismatch.kt
|
|||||||
D|/A.classifierNamePolicy|.R|FakeOverride<kotlin/properties/ReadWriteProperty.setValue: R|kotlin/Unit|>|(this@R|/A|, ::R|/A.classifierNamePolicy|, R|<local>/classifierNamePolicy|)
|
D|/A.classifierNamePolicy|.R|FakeOverride<kotlin/properties/ReadWriteProperty.setValue: R|kotlin/Unit|>|(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]>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, 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]> {
|
public get(): <ERROR TYPE REF: Ambiguity: getValue, [kotlin/getValue, kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]> {
|
||||||
^ D|/A.typeNormalizer|.<Ambiguity: getValue, [kotlin/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, 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]>): R|kotlin/Unit| {
|
public set(<set-?>: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/getValue, kotlin/collections/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|)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
class A {
|
|
||||||
val x by mutableMapOf<String, Int>()
|
|
||||||
val y: Int by mutableMapOf<String, Int>()
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
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|)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -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: R|kotlin/Any|by R|<local>/map|
|
public final var foo: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>by R|<local>/map|
|
||||||
public get(): R|kotlin/Any| {
|
public get(): <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]> {
|
||||||
^ D|/C.foo|.R|kotlin/collections/getValue|<R|kotlin/Any|, R|kotlin/Any|>(this@R|/C|, ::R|/C.foo|)
|
^ D|/C.foo|.<Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#(this@R|/C|, ::R|/C.foo|)
|
||||||
}
|
}
|
||||||
public set(<set-?>: R|kotlin/Any|): R|kotlin/Unit| {
|
public set(<set-?>: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>): R|kotlin/Unit| {
|
||||||
D|/C.foo|.R|kotlin/collections/setValue|<R|kotlin/Any|>(this@R|/C|, ::R|/C.foo|, R|<local>/foo|)
|
D|/C.foo|.<Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#(this@R|/C|, ::R|/C.foo|, R|<local>/foo|)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public final var bar: R|ft<kotlin/Any, kotlin/Any?>!|by R|kotlin/collections/hashMapOf|<R|kotlin/String|, R|kotlin/Any|>()
|
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 get(): R|ft<kotlin/Any, kotlin/Any?>!| {
|
public get(): <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]> {
|
||||||
^ D|/bar|.R|kotlin/collections/getValue|<R|ft<kotlin/Any, kotlin/Any?>!|, R|ft<kotlin/Any, kotlin/Any?>!|>(Null(null), ::R|/bar|)
|
^ D|/bar|.<Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#(Null(null), ::R|/bar|)
|
||||||
}
|
}
|
||||||
public set(<set-?>: R|ft<kotlin/Any, kotlin/Any?>!|): R|kotlin/Unit| {
|
public set(<set-?>: <ERROR TYPE REF: Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>): R|kotlin/Unit| {
|
||||||
D|/bar|.R|kotlin/collections/setValue|<R|ft<kotlin/Any, kotlin/Any?>!|>(Null(null), ::R|/bar|, R|<local>/bar|)
|
D|/bar|.<Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#(Null(null), ::R|/bar|, R|<local>/bar|)
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
-5
@@ -93,11 +93,6 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic
|
|||||||
runTest("compiler/fir/resolve/testData/resolveWithStdlib/delegateWithAnonymousObject.kt");
|
runTest("compiler/fir/resolve/testData/resolveWithStdlib/delegateWithAnonymousObject.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");
|
||||||
|
|||||||
@@ -108,28 +108,23 @@ 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:kotlin.Int?
|
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-test8> visibility:public modality:FINAL <> ($this:<root>.C) returnType:IrErrorType
|
||||||
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> (): kotlin.Int? declared in <root>.C'
|
RETURN type=kotlin.Nothing from='public final fun <get-test8> (): IrErrorType declared in <root>.C'
|
||||||
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
|
ERROR_CALL 'Unresolved reference: <Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#' type=IrErrorType
|
||||||
<V>: kotlin.Int?
|
GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
|
||||||
<V1>: 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
|
FUN DELEGATED_PROPERTY_ACCESSOR name:<set-test8> visibility:public modality:FINAL <> ($this:<root>.C, <set-?>:IrErrorType) returnType:kotlin.Unit
|
||||||
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:kotlin.Int?
|
VALUE_PARAMETER name:<set-?> index:0 type:IrErrorType
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
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
|
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#' type=IrErrorType
|
||||||
<V>: kotlin.Int?
|
GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C 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
|
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
|
||||||
thisRef: GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
|
GET_VAR '<set-?>: IrErrorType declared in <root>.C.<set-test8>' type=IrErrorType 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
|
||||||
|
|||||||
@@ -60,28 +60,23 @@ 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:kotlin.Any
|
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-test3> visibility:public modality:FINAL <> ($this:<root>.C) returnType:IrErrorType
|
||||||
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> (): kotlin.Any declared in <root>.C'
|
RETURN type=kotlin.Nothing from='public final fun <get-test3> (): IrErrorType declared in <root>.C'
|
||||||
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
|
ERROR_CALL 'Unresolved reference: <Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#' type=IrErrorType
|
||||||
<V>: kotlin.Any
|
GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
|
||||||
<V1>: 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
|
FUN DELEGATED_PROPERTY_ACCESSOR name:<set-test3> visibility:public modality:FINAL <> ($this:<root>.C, <set-?>:IrErrorType) returnType:kotlin.Unit
|
||||||
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:kotlin.Any
|
VALUE_PARAMETER name:<set-?> index:0 type:IrErrorType
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
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
|
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#' type=IrErrorType
|
||||||
<V>: kotlin.Any
|
GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C 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
|
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
|
||||||
thisRef: GET_VAR '<this>: <root>.C declared in <root>.C' type=<root>.C origin=null
|
GET_VAR '<set-?>: IrErrorType declared in <root>.C.<set-test3>' type=IrErrorType 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
|
||||||
@@ -101,23 +96,18 @@ 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:kotlin.Any?
|
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-test4> visibility:public modality:FINAL <> () returnType:IrErrorType
|
||||||
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> (): kotlin.Any? declared in <root>'
|
RETURN type=kotlin.Nothing from='public final fun <get-test4> (): IrErrorType declared in <root>'
|
||||||
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
|
ERROR_CALL 'Unresolved reference: <Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#' type=IrErrorType
|
||||||
<V>: kotlin.Any?
|
CONST Null type=kotlin.Nothing? value=null
|
||||||
<V1>: 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
|
FUN DELEGATED_PROPERTY_ACCESSOR name:<set-test4> visibility:public modality:FINAL <> (<set-?>:IrErrorType) returnType:kotlin.Unit
|
||||||
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:kotlin.Any?
|
VALUE_PARAMETER name:<set-?> index:0 type:IrErrorType
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
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
|
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#' type=IrErrorType
|
||||||
<V>: kotlin.Any?
|
CONST Null type=kotlin.Nothing? value=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
|
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
|
||||||
thisRef: CONST Null type=kotlin.Nothing? value=null
|
GET_VAR '<set-?>: IrErrorType declared in <root>.<set-test4>' type=IrErrorType origin=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,18 +6,20 @@ 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:kotlin.Int? [var]
|
VAR name:x type:IrErrorType [var]
|
||||||
SET_VAR 'var x: kotlin.Int? [var] declared in <root>.test2' type=kotlin.Unit origin=null
|
SET_VAR 'var x: IrErrorType [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: kotlin.Int? [var] declared in <root>.test2' type=kotlin.Int? origin=null
|
GET_VAR 'var x: IrErrorType [var] declared in <root>.test2' type=IrErrorType origin=null
|
||||||
SET_VAR 'var x: kotlin.Int? [var] declared in <root>.test2' type=kotlin.Unit origin=null
|
SET_VAR 'var x: IrErrorType [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: GET_VAR 'val tmp_0: kotlin.Int [val] declared in <root>.test2' type=kotlin.Int origin=null
|
$this: TYPE_OP type=IrErrorType origin=IMPLICIT_CAST typeOperand=IrErrorType
|
||||||
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
|
||||||
SET_VAR 'var x: kotlin.Int? [var] declared in <root>.test2' type=kotlin.Unit origin=null
|
TYPE_OP type=IrErrorType origin=IMPLICIT_CAST typeOperand=IrErrorType
|
||||||
|
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: kotlin.Int? [var] declared in <root>.test2' type=kotlin.Int? origin=null
|
GET_VAR 'var x: IrErrorType [var] declared in <root>.test2' type=IrErrorType origin=null
|
||||||
other: CONST Int type=kotlin.Int value=1
|
other: CONST Int type=kotlin.Int value=1
|
||||||
|
|||||||
@@ -87,23 +87,18 @@ 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:kotlin.Int?
|
FUN DELEGATED_PROPERTY_ACCESSOR name:<get-test8> visibility:public modality:FINAL <> () returnType:IrErrorType
|
||||||
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> (): kotlin.Int? declared in <root>'
|
RETURN type=kotlin.Nothing from='public final fun <get-test8> (): IrErrorType declared in <root>'
|
||||||
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
|
ERROR_CALL 'Unresolved reference: <Ambiguity: getValue, [kotlin/collections/getValue, kotlin/collections/getValue, kotlin/collections/getValue]>#' type=IrErrorType
|
||||||
<V>: kotlin.Int?
|
CONST Null type=kotlin.Nothing? value=null
|
||||||
<V1>: 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
|
FUN DELEGATED_PROPERTY_ACCESSOR name:<set-test8> visibility:public modality:FINAL <> (<set-?>:IrErrorType) returnType:kotlin.Unit
|
||||||
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:kotlin.Int?
|
VALUE_PARAMETER name:<set-?> index:0 type:IrErrorType
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
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
|
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [kotlin/collections/setValue]>#' type=IrErrorType
|
||||||
<V>: kotlin.Int?
|
CONST Null type=kotlin.Nothing? value=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
|
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
|
||||||
thisRef: CONST Null type=kotlin.Nothing? value=null
|
GET_VAR '<set-?>: IrErrorType declared in <root>.<set-test8>' type=IrErrorType 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,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