[Commonizer] Refactor CIR to avoid strong refs on descriptors
This is necessary to reduce memory consumption in commonizer while processing sets of massive libraries. Ex: ios_x64 (127 libraries) vs ios_arm64 (127 libraries).
This commit is contained in:
+2
-2
@@ -39,7 +39,7 @@ internal fun List<CirTypeParameter>.buildDescriptorsAndTypeParameterResolver(
|
|||||||
targetComponents = targetComponents,
|
targetComponents = targetComponents,
|
||||||
typeParameterResolver = typeParameterResolver,
|
typeParameterResolver = typeParameterResolver,
|
||||||
containingDeclaration = containingDeclaration,
|
containingDeclaration = containingDeclaration,
|
||||||
annotations = param.annotations,
|
annotations = param.annotations.buildDescriptors(targetComponents),
|
||||||
name = param.name,
|
name = param.name,
|
||||||
variance = param.variance,
|
variance = param.variance,
|
||||||
isReified = param.isReified,
|
isReified = param.isReified,
|
||||||
@@ -61,7 +61,7 @@ internal fun List<CirValueParameter>.buildDescriptors(
|
|||||||
containingDeclaration,
|
containingDeclaration,
|
||||||
null,
|
null,
|
||||||
index,
|
index,
|
||||||
param.annotations,
|
param.annotations.buildDescriptors(targetComponents),
|
||||||
param.name,
|
param.name,
|
||||||
param.returnType.buildType(targetComponents, typeParameterResolver),
|
param.returnType.buildType(targetComponents, typeParameterResolver),
|
||||||
param.declaresDefaultValue,
|
param.declaresDefaultValue,
|
||||||
|
|||||||
+10
-5
@@ -80,7 +80,7 @@ private fun CirProperty.buildDescriptor(
|
|||||||
val getterDescriptor = getter?.let { getter ->
|
val getterDescriptor = getter?.let { getter ->
|
||||||
DescriptorFactory.createGetter(
|
DescriptorFactory.createGetter(
|
||||||
propertyDescriptor,
|
propertyDescriptor,
|
||||||
getter.annotations,
|
getter.annotations.buildDescriptors(targetComponents),
|
||||||
getter.isDefault,
|
getter.isDefault,
|
||||||
getter.isExternal,
|
getter.isExternal,
|
||||||
getter.isInline
|
getter.isInline
|
||||||
@@ -92,8 +92,8 @@ private fun CirProperty.buildDescriptor(
|
|||||||
val setterDescriptor = setter?.let { setter ->
|
val setterDescriptor = setter?.let { setter ->
|
||||||
DescriptorFactory.createSetter(
|
DescriptorFactory.createSetter(
|
||||||
propertyDescriptor,
|
propertyDescriptor,
|
||||||
setter.annotations,
|
setter.annotations.buildDescriptors(targetComponents),
|
||||||
setter.parameterAnnotations,
|
setter.parameterAnnotations.buildDescriptors(targetComponents),
|
||||||
setter.isDefault,
|
setter.isDefault,
|
||||||
setter.isExternal,
|
setter.isExternal,
|
||||||
setter.isInline,
|
setter.isInline,
|
||||||
@@ -102,8 +102,13 @@ private fun CirProperty.buildDescriptor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val backingField = backingFieldAnnotations?.let { FieldDescriptorImpl(it, propertyDescriptor) }
|
val backingField = backingFieldAnnotations?.let { annotations ->
|
||||||
val delegateField = delegateFieldAnnotations?.let { FieldDescriptorImpl(it, propertyDescriptor) }
|
FieldDescriptorImpl(annotations.buildDescriptors(targetComponents), propertyDescriptor)
|
||||||
|
}
|
||||||
|
|
||||||
|
val delegateField = delegateFieldAnnotations?.let { annotations ->
|
||||||
|
FieldDescriptorImpl(annotations.buildDescriptors(targetComponents), propertyDescriptor)
|
||||||
|
}
|
||||||
|
|
||||||
propertyDescriptor.initialize(
|
propertyDescriptor.initialize(
|
||||||
getterDescriptor,
|
getterDescriptor,
|
||||||
|
|||||||
+32
-4
@@ -8,9 +8,37 @@ package org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ir
|
|||||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue
|
import org.jetbrains.kotlin.resolve.constants.*
|
||||||
|
|
||||||
class CirAnnotation(private val wrapped: AnnotationDescriptor) {
|
class CirAnnotation(original: AnnotationDescriptor) {
|
||||||
val fqName: FqName get() = wrapped.fqName ?: error("Annotation with no FQ name: ${wrapped::class.java}, $wrapped")
|
val fqName: FqName = original.fqName ?: error("Annotation with no FQ name: ${original::class.java}, $original")
|
||||||
val allValueArguments: Map<Name, ConstantValue<*>> get() = wrapped.allValueArguments
|
val allValueArguments: Map<Name, ConstantValue<*>> = original.allValueArguments
|
||||||
|
|
||||||
|
init {
|
||||||
|
allValueArguments.forEach { (name, constantValue) ->
|
||||||
|
checkSupportedInCommonization(constantValue) { "${original::class.java}, $original[$name]" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal fun checkSupportedInCommonization(constantValue: ConstantValue<*>, location: () -> String) {
|
||||||
|
@Suppress("TrailingComma")
|
||||||
|
return when (constantValue) {
|
||||||
|
is StringValue,
|
||||||
|
is IntegerValueConstant<*>,
|
||||||
|
is UnsignedValueConstant<*>,
|
||||||
|
is BooleanValue,
|
||||||
|
is NullValue,
|
||||||
|
is DoubleValue,
|
||||||
|
is FloatValue,
|
||||||
|
is EnumValue -> {
|
||||||
|
// OK
|
||||||
|
}
|
||||||
|
is ArrayValue -> {
|
||||||
|
constantValue.value.forEachIndexed { index, innerConstantValue ->
|
||||||
|
checkSupportedInCommonization(innerConstantValue) { "${location()}[$index]" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> error("Unsupported const value type: ${constantValue::class.java}, $constantValue at ${location()}")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+28
-31
@@ -9,7 +9,6 @@ import org.jetbrains.kotlin.descriptors.*
|
|||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
||||||
import kotlin.LazyThreadSafetyMode.PUBLICATION
|
|
||||||
|
|
||||||
interface CirClass : CirAnnotatedDeclaration, CirNamedDeclaration, CirDeclarationWithTypeParameters, CirDeclarationWithVisibility, CirDeclarationWithModality {
|
interface CirClass : CirAnnotatedDeclaration, CirNamedDeclaration, CirDeclarationWithTypeParameters, CirDeclarationWithVisibility, CirDeclarationWithModality {
|
||||||
val companion: FqName? // null means no companion object
|
val companion: FqName? // null means no companion object
|
||||||
@@ -62,39 +61,37 @@ data class CirCommonClassConstructor(
|
|||||||
override val containingClassIsData get() = unsupported()
|
override val containingClassIsData get() = unsupported()
|
||||||
}
|
}
|
||||||
|
|
||||||
class CirWrappedClass(private val wrapped: ClassDescriptor) : CirClass {
|
class CirClassImpl(original: ClassDescriptor) : CirClass {
|
||||||
override val annotations by lazy(PUBLICATION) { wrapped.annotations.map(::CirAnnotation) }
|
override val annotations = original.annotations.map(::CirAnnotation)
|
||||||
override val name get() = wrapped.name
|
override val name = original.name
|
||||||
override val typeParameters by lazy(PUBLICATION) { wrapped.declaredTypeParameters.map(::CirWrappedTypeParameter) }
|
override val typeParameters = original.declaredTypeParameters.map(::CirTypeParameterImpl)
|
||||||
override val companion by lazy(PUBLICATION) { wrapped.companionObjectDescriptor?.fqNameSafe }
|
override val companion = original.companionObjectDescriptor?.fqNameSafe
|
||||||
override val kind get() = wrapped.kind
|
override val kind = original.kind
|
||||||
override val modality get() = wrapped.modality
|
override val modality = original.modality
|
||||||
override val visibility get() = wrapped.visibility
|
override val visibility = original.visibility
|
||||||
override val isCompanion get() = wrapped.isCompanionObject
|
override val isCompanion = original.isCompanionObject
|
||||||
override val isData get() = wrapped.isData
|
override val isData = original.isData
|
||||||
override val isInline get() = wrapped.isInline
|
override val isInline = original.isInline
|
||||||
override val isInner get() = wrapped.isInner
|
override val isInner = original.isInner
|
||||||
override val isExternal get() = wrapped.isExternal
|
override val isExternal = original.isExternal
|
||||||
override val supertypes by lazy(PUBLICATION) { wrapped.typeConstructor.supertypes.map(CirType.Companion::create) }
|
override val supertypes = original.typeConstructor.supertypes.map(CirType.Companion::create)
|
||||||
}
|
}
|
||||||
|
|
||||||
class CirWrappedClassConstructor(private val wrapped: ClassConstructorDescriptor) : CirClassConstructor {
|
class CirClassConstructorImpl(original: ClassConstructorDescriptor) : CirClassConstructor {
|
||||||
override val isPrimary get() = wrapped.isPrimary
|
override val isPrimary = original.isPrimary
|
||||||
override val kind get() = wrapped.kind
|
override val kind = original.kind
|
||||||
override val containingClassKind get() = wrapped.containingDeclaration.kind
|
override val containingClassKind = original.containingDeclaration.kind
|
||||||
override val containingClassModality get() = wrapped.containingDeclaration.modality
|
override val containingClassModality = original.containingDeclaration.modality
|
||||||
override val containingClassIsData get() = wrapped.containingDeclaration.isData
|
override val containingClassIsData = original.containingDeclaration.isData
|
||||||
override val annotations by lazy(PUBLICATION) { wrapped.annotations.map(::CirAnnotation) }
|
override val annotations = original.annotations.map(::CirAnnotation)
|
||||||
override val visibility get() = wrapped.visibility
|
override val visibility = original.visibility
|
||||||
override val typeParameters by lazy(PUBLICATION) {
|
override val typeParameters = original.typeParameters.mapNotNull { typeParameter ->
|
||||||
wrapped.typeParameters.mapNotNull { typeParameter ->
|
// save only type parameters that are contributed by the constructor itself
|
||||||
// save only type parameters that are contributed by the constructor itself
|
typeParameter.takeIf { it.containingDeclaration == original }?.let(::CirTypeParameterImpl)
|
||||||
typeParameter.takeIf { it.containingDeclaration == wrapped }?.let(::CirWrappedTypeParameter)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
override val valueParameters by lazy(PUBLICATION) { wrapped.valueParameters.map(::CirWrappedValueParameter) }
|
override val valueParameters = original.valueParameters.map(::CirValueParameterImpl)
|
||||||
override val hasStableParameterNames get() = wrapped.hasStableParameterNames()
|
override val hasStableParameterNames = original.hasStableParameterNames()
|
||||||
override val hasSynthesizedParameterNames get() = wrapped.hasSynthesizedParameterNames()
|
override val hasSynthesizedParameterNames = original.hasSynthesizedParameterNames()
|
||||||
}
|
}
|
||||||
|
|
||||||
object CirClassRecursionMarker : CirClass, CirRecursionMarker {
|
object CirClassRecursionMarker : CirClass, CirRecursionMarker {
|
||||||
|
|||||||
+19
-21
@@ -6,9 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ir
|
package org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ir
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import kotlin.LazyThreadSafetyMode.PUBLICATION
|
|
||||||
|
|
||||||
interface CirFunctionModifiers {
|
interface CirFunctionModifiers {
|
||||||
val isOperator: Boolean
|
val isOperator: Boolean
|
||||||
@@ -41,20 +39,20 @@ data class CirCommonFunction(
|
|||||||
override val hasSynthesizedParameterNames: Boolean
|
override val hasSynthesizedParameterNames: Boolean
|
||||||
) : CirCommonFunctionOrProperty(), CirFunction, CirFunctionModifiers by modifiers
|
) : CirCommonFunctionOrProperty(), CirFunction, CirFunctionModifiers by modifiers
|
||||||
|
|
||||||
class CirWrappedFunction(wrapped: SimpleFunctionDescriptor) : CirWrappedFunctionOrProperty<SimpleFunctionDescriptor>(wrapped), CirFunction {
|
class CirFunctionImpl(original: SimpleFunctionDescriptor) : CirFunctionOrPropertyImpl<SimpleFunctionDescriptor>(original), CirFunction {
|
||||||
override val isOperator get() = wrapped.isOperator
|
override val isOperator = original.isOperator
|
||||||
override val isInfix get() = wrapped.isInfix
|
override val isInfix = original.isInfix
|
||||||
override val isInline get() = wrapped.isInline
|
override val isInline = original.isInline
|
||||||
override val isTailrec get() = wrapped.isTailrec
|
override val isTailrec = original.isTailrec
|
||||||
override val isSuspend get() = wrapped.isSuspend
|
override val isSuspend = original.isSuspend
|
||||||
override val valueParameters by lazy(PUBLICATION) { wrapped.valueParameters.map(::CirWrappedValueParameter) }
|
override val valueParameters = original.valueParameters.map(::CirValueParameterImpl)
|
||||||
override val hasStableParameterNames get() = wrapped.hasStableParameterNames()
|
override val hasStableParameterNames = original.hasStableParameterNames()
|
||||||
override val hasSynthesizedParameterNames get() = wrapped.hasSynthesizedParameterNames()
|
override val hasSynthesizedParameterNames = original.hasSynthesizedParameterNames()
|
||||||
}
|
}
|
||||||
|
|
||||||
interface CirValueParameter {
|
interface CirValueParameter {
|
||||||
val name: Name
|
val name: Name
|
||||||
val annotations: Annotations
|
val annotations: List<CirAnnotation>
|
||||||
val returnType: CirType
|
val returnType: CirType
|
||||||
val varargElementType: CirType?
|
val varargElementType: CirType?
|
||||||
val declaresDefaultValue: Boolean
|
val declaresDefaultValue: Boolean
|
||||||
@@ -69,16 +67,16 @@ data class CirCommonValueParameter(
|
|||||||
override val isCrossinline: Boolean,
|
override val isCrossinline: Boolean,
|
||||||
override val isNoinline: Boolean
|
override val isNoinline: Boolean
|
||||||
) : CirValueParameter {
|
) : CirValueParameter {
|
||||||
override val annotations get() = Annotations.EMPTY
|
override val annotations: List<CirAnnotation> get() = emptyList()
|
||||||
override val declaresDefaultValue get() = false
|
override val declaresDefaultValue get() = false
|
||||||
}
|
}
|
||||||
|
|
||||||
data class CirWrappedValueParameter(private val wrapped: ValueParameterDescriptor) : CirValueParameter {
|
class CirValueParameterImpl(original: ValueParameterDescriptor) : CirValueParameter {
|
||||||
override val name get() = wrapped.name
|
override val name = original.name
|
||||||
override val annotations get() = wrapped.annotations
|
override val annotations = original.annotations.map(::CirAnnotation)
|
||||||
override val returnType by lazy(PUBLICATION) { CirType.create(wrapped.returnType!!) }
|
override val returnType = CirType.create(original.returnType!!)
|
||||||
override val varargElementType by lazy(PUBLICATION) { wrapped.varargElementType?.let(CirType.Companion::create) }
|
override val varargElementType = original.varargElementType?.let(CirType.Companion::create)
|
||||||
override val declaresDefaultValue get() = wrapped.declaresDefaultValue()
|
override val declaresDefaultValue = original.declaresDefaultValue()
|
||||||
override val isCrossinline get() = wrapped.isCrossinline
|
override val isCrossinline = original.isCrossinline
|
||||||
override val isNoinline get() = wrapped.isNoinline
|
override val isNoinline = original.isNoinline
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-15
@@ -7,7 +7,6 @@ package org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ir
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ir.CirExtensionReceiver.Companion.toReceiver
|
import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ir.CirExtensionReceiver.Companion.toReceiver
|
||||||
import kotlin.LazyThreadSafetyMode.PUBLICATION
|
|
||||||
|
|
||||||
interface CirFunctionOrProperty : CirAnnotatedDeclaration, CirNamedDeclaration, CirDeclarationWithTypeParameters, CirDeclarationWithVisibility, CirDeclarationWithModality, CirMaybeCallableMemberOfClass {
|
interface CirFunctionOrProperty : CirAnnotatedDeclaration, CirNamedDeclaration, CirDeclarationWithTypeParameters, CirDeclarationWithVisibility, CirDeclarationWithModality, CirMaybeCallableMemberOfClass {
|
||||||
val isExternal: Boolean
|
val isExternal: Boolean
|
||||||
@@ -23,20 +22,26 @@ abstract class CirCommonFunctionOrProperty : CirFunctionOrProperty {
|
|||||||
final override val containingClassIsData: Boolean? get() = unsupported()
|
final override val containingClassIsData: Boolean? get() = unsupported()
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class CirWrappedFunctionOrProperty<T : CallableMemberDescriptor>(protected val wrapped: T) : CirFunctionOrProperty {
|
abstract class CirFunctionOrPropertyImpl<T : CallableMemberDescriptor>(original: T) : CirFunctionOrProperty {
|
||||||
final override val annotations by lazy(PUBLICATION) { wrapped.annotations.map(::CirAnnotation) }
|
final override val annotations = original.annotations.map(::CirAnnotation)
|
||||||
final override val name get() = wrapped.name
|
final override val name = original.name
|
||||||
final override val modality get() = wrapped.modality
|
final override val modality = original.modality
|
||||||
final override val visibility get() = wrapped.visibility
|
final override val visibility = original.visibility
|
||||||
final override val isExternal get() = wrapped.isExternal
|
final override val isExternal = original.isExternal
|
||||||
final override val extensionReceiver by lazy(PUBLICATION) { wrapped.extensionReceiverParameter?.toReceiver() }
|
final override val extensionReceiver = original.extensionReceiverParameter?.toReceiver()
|
||||||
final override val returnType by lazy(PUBLICATION) { CirType.create(wrapped.returnType!!) }
|
final override val returnType = CirType.create(original.returnType!!)
|
||||||
final override val kind get() = wrapped.kind
|
final override val kind = original.kind
|
||||||
final override val containingClassKind: ClassKind? get() = containingClass?.kind
|
final override val containingClassKind: ClassKind?
|
||||||
final override val containingClassModality: Modality? get() = containingClass?.modality
|
final override val containingClassModality: Modality?
|
||||||
final override val containingClassIsData: Boolean? get() = containingClass?.isData
|
final override val containingClassIsData: Boolean?
|
||||||
final override val typeParameters by lazy(PUBLICATION) { wrapped.typeParameters.map(::CirWrappedTypeParameter) }
|
final override val typeParameters = original.typeParameters.map(::CirTypeParameterImpl)
|
||||||
private val containingClass: ClassDescriptor? get() = wrapped.containingDeclaration as? ClassDescriptor
|
|
||||||
|
init {
|
||||||
|
val containingClass = original.containingDeclaration as? ClassDescriptor
|
||||||
|
containingClassKind = containingClass?.kind
|
||||||
|
containingClassModality = containingClass?.modality
|
||||||
|
containingClassIsData = containingClass?.isData
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class CirExtensionReceiver(
|
data class CirExtensionReceiver(
|
||||||
|
|||||||
+1
-1
@@ -10,5 +10,5 @@ import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
|||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
|
|
||||||
data class CirModule(val name: Name, val builtIns: KotlinBuiltIns) : CirDeclaration {
|
data class CirModule(val name: Name, val builtIns: KotlinBuiltIns) : CirDeclaration {
|
||||||
constructor(descriptor: ModuleDescriptor) : this(descriptor.name, descriptor.builtIns)
|
constructor(descriptor: ModuleDescriptor) : this(descriptor.name, descriptor.builtIns) // TODO: strong ref
|
||||||
}
|
}
|
||||||
|
|||||||
+30
-26
@@ -6,12 +6,10 @@
|
|||||||
package org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ir
|
package org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ir
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ir.CirGetter.Companion.toGetter
|
import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ir.CirGetter.Companion.toGetter
|
||||||
import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ir.CirSetter.Companion.toSetter
|
import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ir.CirSetter.Companion.toSetter
|
||||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue
|
import org.jetbrains.kotlin.resolve.constants.ConstantValue
|
||||||
import kotlin.LazyThreadSafetyMode.PUBLICATION
|
|
||||||
|
|
||||||
interface CirProperty : CirFunctionOrProperty {
|
interface CirProperty : CirFunctionOrProperty {
|
||||||
val isVar: Boolean
|
val isVar: Boolean
|
||||||
@@ -20,8 +18,8 @@ interface CirProperty : CirFunctionOrProperty {
|
|||||||
val isDelegate: Boolean
|
val isDelegate: Boolean
|
||||||
val getter: CirGetter?
|
val getter: CirGetter?
|
||||||
val setter: CirSetter?
|
val setter: CirSetter?
|
||||||
val backingFieldAnnotations: Annotations? // null assumes no backing field
|
val backingFieldAnnotations: List<CirAnnotation>? // null assumes no backing field
|
||||||
val delegateFieldAnnotations: Annotations? // null assumes no backing field
|
val delegateFieldAnnotations: List<CirAnnotation>? // null assumes no backing field
|
||||||
val compileTimeInitializer: ConstantValue<*>?
|
val compileTimeInitializer: ConstantValue<*>?
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,50 +39,56 @@ data class CirCommonProperty(
|
|||||||
override val isConst get() = false
|
override val isConst get() = false
|
||||||
override val isDelegate get() = false
|
override val isDelegate get() = false
|
||||||
override val getter get() = CirGetter.DEFAULT_NO_ANNOTATIONS
|
override val getter get() = CirGetter.DEFAULT_NO_ANNOTATIONS
|
||||||
override val backingFieldAnnotations: Annotations? get() = null
|
override val backingFieldAnnotations: List<CirAnnotation>? get() = null
|
||||||
override val delegateFieldAnnotations: Annotations? get() = null
|
override val delegateFieldAnnotations: List<CirAnnotation>? get() = null
|
||||||
override val compileTimeInitializer: ConstantValue<*>? get() = null
|
override val compileTimeInitializer: ConstantValue<*>? get() = null
|
||||||
}
|
}
|
||||||
|
|
||||||
class CirWrappedProperty(wrapped: PropertyDescriptor) : CirWrappedFunctionOrProperty<PropertyDescriptor>(wrapped), CirProperty {
|
class CirPropertyImpl(original: PropertyDescriptor) : CirFunctionOrPropertyImpl<PropertyDescriptor>(original), CirProperty {
|
||||||
override val isVar get() = wrapped.isVar
|
override val isVar = original.isVar
|
||||||
override val isLateInit get() = wrapped.isLateInit
|
override val isLateInit = original.isLateInit
|
||||||
override val isConst get() = wrapped.isConst
|
override val isConst = original.isConst
|
||||||
override val isDelegate get() = @Suppress("DEPRECATION") wrapped.isDelegated
|
override val isDelegate = @Suppress("DEPRECATION") original.isDelegated
|
||||||
override val getter by lazy(PUBLICATION) { wrapped.getter?.toGetter() }
|
override val getter = original.getter?.toGetter()
|
||||||
override val setter by lazy(PUBLICATION) { wrapped.setter?.toSetter() }
|
override val setter = original.setter?.toSetter()
|
||||||
override val backingFieldAnnotations get() = wrapped.backingField?.annotations
|
override val backingFieldAnnotations = original.backingField?.annotations?.map(::CirAnnotation)
|
||||||
override val delegateFieldAnnotations get() = wrapped.delegateField?.annotations
|
override val delegateFieldAnnotations = original.delegateField?.annotations?.map(::CirAnnotation)
|
||||||
override val compileTimeInitializer get() = wrapped.compileTimeInitializer
|
override val compileTimeInitializer = original.compileTimeInitializer
|
||||||
|
|
||||||
|
init {
|
||||||
|
compileTimeInitializer?.let { compileTimeInitializer ->
|
||||||
|
checkSupportedInCommonization(compileTimeInitializer) { "${original::class.java}, $original" }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface CirPropertyAccessor {
|
interface CirPropertyAccessor {
|
||||||
val annotations: Annotations
|
val annotations: List<CirAnnotation>
|
||||||
val isDefault: Boolean
|
val isDefault: Boolean
|
||||||
val isExternal: Boolean
|
val isExternal: Boolean
|
||||||
val isInline: Boolean
|
val isInline: Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
data class CirGetter(
|
data class CirGetter(
|
||||||
override val annotations: Annotations,
|
override val annotations: List<CirAnnotation>,
|
||||||
override val isDefault: Boolean,
|
override val isDefault: Boolean,
|
||||||
override val isExternal: Boolean,
|
override val isExternal: Boolean,
|
||||||
override val isInline: Boolean
|
override val isInline: Boolean
|
||||||
) : CirPropertyAccessor {
|
) : CirPropertyAccessor {
|
||||||
companion object {
|
companion object {
|
||||||
val DEFAULT_NO_ANNOTATIONS = CirGetter(Annotations.EMPTY, isDefault = true, isExternal = false, isInline = false)
|
val DEFAULT_NO_ANNOTATIONS = CirGetter(emptyList(), isDefault = true, isExternal = false, isInline = false)
|
||||||
|
|
||||||
fun PropertyGetterDescriptor.toGetter() =
|
fun PropertyGetterDescriptor.toGetter() =
|
||||||
if (isDefault && annotations.isEmpty())
|
if (isDefault && annotations.isEmpty())
|
||||||
DEFAULT_NO_ANNOTATIONS
|
DEFAULT_NO_ANNOTATIONS
|
||||||
else
|
else
|
||||||
CirGetter(annotations, isDefault, isExternal, isInline)
|
CirGetter(annotations.map(::CirAnnotation), isDefault, isExternal, isInline)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class CirSetter(
|
data class CirSetter(
|
||||||
override val annotations: Annotations,
|
override val annotations: List<CirAnnotation>,
|
||||||
val parameterAnnotations: Annotations,
|
val parameterAnnotations: List<CirAnnotation>,
|
||||||
override val visibility: Visibility,
|
override val visibility: Visibility,
|
||||||
override val isDefault: Boolean,
|
override val isDefault: Boolean,
|
||||||
override val isExternal: Boolean,
|
override val isExternal: Boolean,
|
||||||
@@ -92,8 +96,8 @@ data class CirSetter(
|
|||||||
) : CirPropertyAccessor, CirDeclarationWithVisibility {
|
) : CirPropertyAccessor, CirDeclarationWithVisibility {
|
||||||
companion object {
|
companion object {
|
||||||
fun createDefaultNoAnnotations(visibility: Visibility) = CirSetter(
|
fun createDefaultNoAnnotations(visibility: Visibility) = CirSetter(
|
||||||
Annotations.EMPTY,
|
emptyList(),
|
||||||
Annotations.EMPTY,
|
emptyList(),
|
||||||
visibility,
|
visibility,
|
||||||
isDefault = visibility == Visibilities.PUBLIC,
|
isDefault = visibility == Visibilities.PUBLIC,
|
||||||
isExternal = false,
|
isExternal = false,
|
||||||
@@ -101,8 +105,8 @@ data class CirSetter(
|
|||||||
)
|
)
|
||||||
|
|
||||||
fun PropertySetterDescriptor.toSetter() = CirSetter(
|
fun PropertySetterDescriptor.toSetter() = CirSetter(
|
||||||
annotations,
|
annotations.map(::CirAnnotation),
|
||||||
valueParameters.single().annotations,
|
valueParameters.single().annotations.map(::CirAnnotation),
|
||||||
visibility,
|
visibility,
|
||||||
isDefault,
|
isDefault,
|
||||||
isExternal,
|
isExternal,
|
||||||
|
|||||||
+29
-20
@@ -16,7 +16,6 @@ import org.jetbrains.kotlin.descriptors.commonizer.utils.fqName
|
|||||||
import org.jetbrains.kotlin.descriptors.commonizer.utils.fqNameWithTypeParameters
|
import org.jetbrains.kotlin.descriptors.commonizer.utils.fqNameWithTypeParameters
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
import org.jetbrains.kotlin.types.*
|
import org.jetbrains.kotlin.types.*
|
||||||
import kotlin.LazyThreadSafetyMode.PUBLICATION
|
|
||||||
|
|
||||||
sealed class CirType {
|
sealed class CirType {
|
||||||
companion object {
|
companion object {
|
||||||
@@ -36,25 +35,35 @@ sealed class CirType {
|
|||||||
* This is necessary to properly compare types for type aliases, where abbreviation type represents the type alias itself while
|
* This is necessary to properly compare types for type aliases, where abbreviation type represents the type alias itself while
|
||||||
* expanded type represents right-hand side declaration that should be processed separately.
|
* expanded type represents right-hand side declaration that should be processed separately.
|
||||||
*
|
*
|
||||||
* There is no difference between [abbreviation] and [expanded] for types representing classes and type parameters.
|
* There is no difference between "abbreviation" and "expanded" for types representing classes and type parameters.
|
||||||
*/
|
*/
|
||||||
class CirSimpleType(private val wrapped: SimpleType) : CirType() {
|
class CirSimpleType(original: SimpleType) : CirType() {
|
||||||
val annotations by lazy(PUBLICATION) { abbreviation.annotations.map(::CirAnnotation) }
|
val annotations: List<CirAnnotation>
|
||||||
val kind = CirSimpleTypeKind.determineKind(abbreviation.declarationDescriptor)
|
val kind: CirSimpleTypeKind
|
||||||
val fqName by lazy(PUBLICATION) { abbreviation.fqName }
|
val fqName: FqName
|
||||||
val arguments by lazy(PUBLICATION) { abbreviation.arguments.map(::CirTypeProjection) }
|
val arguments: List<CirTypeProjection>
|
||||||
val isMarkedNullable get() = abbreviation.isMarkedNullable
|
val isMarkedNullable: Boolean
|
||||||
val isDefinitelyNotNullType get() = abbreviation.isDefinitelyNotNullType
|
val isDefinitelyNotNullType: Boolean
|
||||||
val expandedTypeConstructorId by lazy(PUBLICATION) { CirTypeConstructorId(expanded) }
|
val expandedTypeConstructorId: CirTypeConstructorId
|
||||||
|
|
||||||
|
init {
|
||||||
|
val abbreviation = (original as? AbbreviatedType)?.abbreviation ?: original
|
||||||
|
val expanded = (original as? AbbreviatedType)?.expandedType ?: original
|
||||||
|
|
||||||
|
annotations = abbreviation.annotations.map(::CirAnnotation)
|
||||||
|
kind = CirSimpleTypeKind.determineKind(abbreviation.declarationDescriptor)
|
||||||
|
fqName = abbreviation.fqName
|
||||||
|
arguments = abbreviation.arguments.map(::CirTypeProjection)
|
||||||
|
isMarkedNullable = abbreviation.isMarkedNullable
|
||||||
|
isDefinitelyNotNullType = abbreviation.isDefinitelyNotNullType
|
||||||
|
expandedTypeConstructorId = CirTypeConstructorId(expanded)
|
||||||
|
}
|
||||||
|
|
||||||
inline val isClassOrTypeAlias get() = (kind == CLASS || kind == TYPE_ALIAS)
|
inline val isClassOrTypeAlias get() = (kind == CLASS || kind == TYPE_ALIAS)
|
||||||
val fqNameWithTypeParameters by lazy(PUBLICATION) { wrapped.fqNameWithTypeParameters }
|
val fqNameWithTypeParameters = original.fqNameWithTypeParameters
|
||||||
|
|
||||||
override fun equals(other: Any?) = wrapped == (other as? CirSimpleType)?.wrapped
|
override fun equals(other: Any?) = fqNameWithTypeParameters == (other as? CirSimpleType)?.fqNameWithTypeParameters
|
||||||
override fun hashCode() = wrapped.hashCode()
|
override fun hashCode() = fqNameWithTypeParameters.hashCode()
|
||||||
|
|
||||||
private inline val abbreviation: SimpleType get() = (wrapped as? AbbreviatedType)?.abbreviation ?: wrapped
|
|
||||||
private inline val expanded: SimpleType get() = (wrapped as? AbbreviatedType)?.expandedType ?: wrapped
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class CirSimpleTypeKind {
|
enum class CirSimpleTypeKind {
|
||||||
@@ -79,10 +88,10 @@ data class CirTypeConstructorId(val fqName: FqName, val numberOfTypeParameters:
|
|||||||
constructor(type: SimpleType) : this(type.fqName, type.constructor.parameters.size)
|
constructor(type: SimpleType) : this(type.fqName, type.constructor.parameters.size)
|
||||||
}
|
}
|
||||||
|
|
||||||
class CirTypeProjection(private val wrapped: TypeProjection) {
|
class CirTypeProjection(original: TypeProjection) {
|
||||||
val projectionKind get() = wrapped.projectionKind
|
val projectionKind = original.projectionKind
|
||||||
val isStarProjection get() = wrapped.isStarProjection
|
val isStarProjection = original.isStarProjection
|
||||||
val type by lazy(PUBLICATION) { CirType.create(wrapped.type) }
|
val type = CirType.create(original.type)
|
||||||
}
|
}
|
||||||
|
|
||||||
data class CirFlexibleType(val lowerBound: CirSimpleType, val upperBound: CirSimpleType) : CirType()
|
data class CirFlexibleType(val lowerBound: CirSimpleType, val upperBound: CirSimpleType) : CirType()
|
||||||
|
|||||||
+7
-8
@@ -6,18 +6,17 @@
|
|||||||
package org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ir
|
package org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ir
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.TypeAliasDescriptor
|
import org.jetbrains.kotlin.descriptors.TypeAliasDescriptor
|
||||||
import kotlin.LazyThreadSafetyMode.PUBLICATION
|
|
||||||
|
|
||||||
interface CirTypeAlias : CirAnnotatedDeclaration, CirNamedDeclaration, CirDeclarationWithTypeParameters, CirDeclarationWithVisibility {
|
interface CirTypeAlias : CirAnnotatedDeclaration, CirNamedDeclaration, CirDeclarationWithTypeParameters, CirDeclarationWithVisibility {
|
||||||
val underlyingType: CirSimpleType
|
val underlyingType: CirSimpleType
|
||||||
val expandedType: CirSimpleType
|
val expandedType: CirSimpleType
|
||||||
}
|
}
|
||||||
|
|
||||||
class CirWrappedTypeAlias(private val wrapped: TypeAliasDescriptor) : CirTypeAlias {
|
class CirTypeAliasImpl(original: TypeAliasDescriptor) : CirTypeAlias {
|
||||||
override val annotations by lazy(PUBLICATION) { wrapped.annotations.map(::CirAnnotation) }
|
override val annotations = original.annotations.map(::CirAnnotation)
|
||||||
override val name get() = wrapped.name
|
override val name = original.name
|
||||||
override val typeParameters by lazy(PUBLICATION) { wrapped.declaredTypeParameters.map(::CirWrappedTypeParameter) }
|
override val typeParameters = original.declaredTypeParameters.map(::CirTypeParameterImpl)
|
||||||
override val visibility get() = wrapped.visibility
|
override val visibility = original.visibility
|
||||||
override val underlyingType by lazy(PUBLICATION) { CirSimpleType(wrapped.underlyingType) }
|
override val underlyingType = CirSimpleType(original.underlyingType)
|
||||||
override val expandedType by lazy(PUBLICATION) { CirSimpleType(wrapped.expandedType) }
|
override val expandedType = CirSimpleType(original.expandedType)
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-10
@@ -6,13 +6,11 @@
|
|||||||
package org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ir
|
package org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ir
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.types.Variance
|
import org.jetbrains.kotlin.types.Variance
|
||||||
import kotlin.LazyThreadSafetyMode.PUBLICATION
|
|
||||||
|
|
||||||
interface CirTypeParameter {
|
interface CirTypeParameter {
|
||||||
val annotations: Annotations
|
val annotations: List<CirAnnotation>
|
||||||
val name: Name
|
val name: Name
|
||||||
val isReified: Boolean
|
val isReified: Boolean
|
||||||
val variance: Variance
|
val variance: Variance
|
||||||
@@ -25,13 +23,13 @@ data class CirCommonTypeParameter(
|
|||||||
override val variance: Variance,
|
override val variance: Variance,
|
||||||
override val upperBounds: List<CirType>
|
override val upperBounds: List<CirType>
|
||||||
) : CirTypeParameter {
|
) : CirTypeParameter {
|
||||||
override val annotations get() = Annotations.EMPTY
|
override val annotations: List<CirAnnotation> get() = emptyList()
|
||||||
}
|
}
|
||||||
|
|
||||||
data class CirWrappedTypeParameter(private val wrapped: TypeParameterDescriptor) : CirTypeParameter {
|
class CirTypeParameterImpl(original: TypeParameterDescriptor) : CirTypeParameter {
|
||||||
override val annotations get() = wrapped.annotations
|
override val annotations = original.annotations.map(::CirAnnotation)
|
||||||
override val name get() = wrapped.name
|
override val name = original.name
|
||||||
override val isReified get() = wrapped.isReified
|
override val isReified = original.isReified
|
||||||
override val variance get() = wrapped.variance
|
override val variance = original.variance
|
||||||
override val upperBounds by lazy(PUBLICATION) { wrapped.upperBounds.map(CirType.Companion::create) }
|
override val upperBounds = original.upperBounds.map(CirType.Companion::create)
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -66,7 +66,7 @@ internal fun buildPropertyNode(
|
|||||||
): CirPropertyNode = buildNode(
|
): CirPropertyNode = buildNode(
|
||||||
storageManager = storageManager,
|
storageManager = storageManager,
|
||||||
descriptors = properties,
|
descriptors = properties,
|
||||||
targetDeclarationProducer = ::CirWrappedProperty,
|
targetDeclarationProducer = ::CirPropertyImpl,
|
||||||
commonValueProducer = { commonize(containingDeclarationCommon, it, PropertyCommonizer(cache)) },
|
commonValueProducer = { commonize(containingDeclarationCommon, it, PropertyCommonizer(cache)) },
|
||||||
recursionMarker = null,
|
recursionMarker = null,
|
||||||
nodeProducer = ::CirPropertyNode
|
nodeProducer = ::CirPropertyNode
|
||||||
@@ -80,7 +80,7 @@ internal fun buildFunctionNode(
|
|||||||
): CirFunctionNode = buildNode(
|
): CirFunctionNode = buildNode(
|
||||||
storageManager = storageManager,
|
storageManager = storageManager,
|
||||||
descriptors = functions,
|
descriptors = functions,
|
||||||
targetDeclarationProducer = ::CirWrappedFunction,
|
targetDeclarationProducer = ::CirFunctionImpl,
|
||||||
commonValueProducer = { commonize(containingDeclarationCommon, it, FunctionCommonizer(cache)) },
|
commonValueProducer = { commonize(containingDeclarationCommon, it, FunctionCommonizer(cache)) },
|
||||||
recursionMarker = null,
|
recursionMarker = null,
|
||||||
nodeProducer = ::CirFunctionNode
|
nodeProducer = ::CirFunctionNode
|
||||||
@@ -94,7 +94,7 @@ internal fun buildClassNode(
|
|||||||
): CirClassNode = buildNode(
|
): CirClassNode = buildNode(
|
||||||
storageManager = storageManager,
|
storageManager = storageManager,
|
||||||
descriptors = classes,
|
descriptors = classes,
|
||||||
targetDeclarationProducer = ::CirWrappedClass,
|
targetDeclarationProducer = ::CirClassImpl,
|
||||||
commonValueProducer = { commonize(containingDeclarationCommon, it, ClassCommonizer(cacheRW)) },
|
commonValueProducer = { commonize(containingDeclarationCommon, it, ClassCommonizer(cacheRW)) },
|
||||||
recursionMarker = CirClassRecursionMarker,
|
recursionMarker = CirClassRecursionMarker,
|
||||||
nodeProducer = ::CirClassNode
|
nodeProducer = ::CirClassNode
|
||||||
@@ -113,7 +113,7 @@ internal fun buildClassConstructorNode(
|
|||||||
): CirClassConstructorNode = buildNode(
|
): CirClassConstructorNode = buildNode(
|
||||||
storageManager = storageManager,
|
storageManager = storageManager,
|
||||||
descriptors = constructors,
|
descriptors = constructors,
|
||||||
targetDeclarationProducer = ::CirWrappedClassConstructor,
|
targetDeclarationProducer = ::CirClassConstructorImpl,
|
||||||
commonValueProducer = { commonize(containingDeclarationCommon, it, ClassConstructorCommonizer(cache)) },
|
commonValueProducer = { commonize(containingDeclarationCommon, it, ClassConstructorCommonizer(cache)) },
|
||||||
recursionMarker = null,
|
recursionMarker = null,
|
||||||
nodeProducer = ::CirClassConstructorNode
|
nodeProducer = ::CirClassConstructorNode
|
||||||
@@ -126,7 +126,7 @@ internal fun buildTypeAliasNode(
|
|||||||
): CirTypeAliasNode = buildNode(
|
): CirTypeAliasNode = buildNode(
|
||||||
storageManager = storageManager,
|
storageManager = storageManager,
|
||||||
descriptors = typeAliases,
|
descriptors = typeAliases,
|
||||||
targetDeclarationProducer = ::CirWrappedTypeAlias,
|
targetDeclarationProducer = ::CirTypeAliasImpl,
|
||||||
commonValueProducer = { commonize(it, TypeAliasCommonizer(cacheRW)) },
|
commonValueProducer = { commonize(it, TypeAliasCommonizer(cacheRW)) },
|
||||||
recursionMarker = CirClassRecursionMarker,
|
recursionMarker = CirClassRecursionMarker,
|
||||||
nodeProducer = ::CirTypeAliasNode
|
nodeProducer = ::CirTypeAliasNode
|
||||||
|
|||||||
Vendored
+3
-3
@@ -1,8 +1,8 @@
|
|||||||
expect annotation class CommonAnnotationForAnnotationClassesOnly(text: String) { val text: String }
|
expect annotation class CommonAnnotationForAnnotationClassesOnly(text: String) { val text: String }
|
||||||
expect annotation class CommonAnnotation(text: String) { val text: String }
|
expect annotation class CommonAnnotation(text: String) { val text: String }
|
||||||
|
|
||||||
expect annotation class CommonOuterAnnotation(inner: CommonInnerAnnotation) { val inner: CommonInnerAnnotation }
|
//expect annotation class CommonOuterAnnotation(inner: CommonInnerAnnotation) { val inner: CommonInnerAnnotation }
|
||||||
expect annotation class CommonInnerAnnotation(text: String) { val text: String }
|
//expect annotation class CommonInnerAnnotation(text: String) { val text: String }
|
||||||
|
|
||||||
expect var propertyWithoutBackingField: Double
|
expect var propertyWithoutBackingField: Double
|
||||||
expect val propertyWithBackingField: Double
|
expect val propertyWithBackingField: Double
|
||||||
@@ -15,4 +15,4 @@ expect fun <Q : Number> Q.function2(): Q
|
|||||||
expect class AnnotatedClass(value: String) { val value: String }
|
expect class AnnotatedClass(value: String) { val value: String }
|
||||||
expect class AnnotatedTypeAlias
|
expect class AnnotatedTypeAlias
|
||||||
|
|
||||||
expect object ObjectWithNestedAnnotations
|
//expect object ObjectWithNestedAnnotations
|
||||||
|
|||||||
+9
-9
@@ -16,13 +16,13 @@ annotation class JsAnnotationForAnnotationClassesOnly(val text: String)
|
|||||||
@CommonAnnotationForAnnotationClassesOnly("annotation-class")
|
@CommonAnnotationForAnnotationClassesOnly("annotation-class")
|
||||||
annotation class JsAnnotation(val text: String)
|
annotation class JsAnnotation(val text: String)
|
||||||
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
//@Target(AnnotationTarget.CLASS)
|
||||||
actual annotation class CommonOuterAnnotation(actual val inner: CommonInnerAnnotation)
|
//actual annotation class CommonOuterAnnotation(actual val inner: CommonInnerAnnotation)
|
||||||
actual annotation class CommonInnerAnnotation(actual val text: String)
|
//actual annotation class CommonInnerAnnotation(actual val text: String)
|
||||||
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
//@Target(AnnotationTarget.CLASS)
|
||||||
annotation class JsOuterAnnotation(val inner: JsInnerAnnotation)
|
//annotation class JsOuterAnnotation(val inner: JsInnerAnnotation)
|
||||||
annotation class JsInnerAnnotation(val text: String)
|
//annotation class JsInnerAnnotation(val text: String)
|
||||||
|
|
||||||
@JsAnnotation("property")
|
@JsAnnotation("property")
|
||||||
@CommonAnnotation("property")
|
@CommonAnnotation("property")
|
||||||
@@ -57,6 +57,6 @@ actual class AnnotatedClass @JsAnnotation("constructor") @CommonAnnotation("cons
|
|||||||
@CommonAnnotation("type-alias")
|
@CommonAnnotation("type-alias")
|
||||||
actual typealias AnnotatedTypeAlias = AnnotatedClass
|
actual typealias AnnotatedTypeAlias = AnnotatedClass
|
||||||
|
|
||||||
@JsOuterAnnotation(inner = JsInnerAnnotation("nested-annotations"))
|
//@JsOuterAnnotation(inner = JsInnerAnnotation("nested-annotations"))
|
||||||
@CommonOuterAnnotation(inner = CommonInnerAnnotation("nested-annotations"))
|
//@CommonOuterAnnotation(inner = CommonInnerAnnotation("nested-annotations"))
|
||||||
actual object ObjectWithNestedAnnotations
|
//actual object ObjectWithNestedAnnotations
|
||||||
|
|||||||
+10
-10
@@ -16,13 +16,13 @@ annotation class JvmAnnotationForAnnotationClassesOnly(val text: String)
|
|||||||
@CommonAnnotationForAnnotationClassesOnly("annotation-class")
|
@CommonAnnotationForAnnotationClassesOnly("annotation-class")
|
||||||
annotation class JvmAnnotation(val text: String)
|
annotation class JvmAnnotation(val text: String)
|
||||||
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
//@Target(AnnotationTarget.CLASS)
|
||||||
actual annotation class CommonOuterAnnotation(actual val inner: CommonInnerAnnotation)
|
//actual annotation class CommonOuterAnnotation(actual val inner: CommonInnerAnnotation)
|
||||||
actual annotation class CommonInnerAnnotation(actual val text: String)
|
//actual annotation class CommonInnerAnnotation(actual val text: String)
|
||||||
|
//
|
||||||
@Target(AnnotationTarget.CLASS)
|
//@Target(AnnotationTarget.CLASS)
|
||||||
annotation class JvmOuterAnnotation(val inner: JvmInnerAnnotation)
|
//annotation class JvmOuterAnnotation(val inner: JvmInnerAnnotation)
|
||||||
annotation class JvmInnerAnnotation(val text: String)
|
//annotation class JvmInnerAnnotation(val text: String)
|
||||||
|
|
||||||
@JvmAnnotation("property")
|
@JvmAnnotation("property")
|
||||||
@CommonAnnotation("property")
|
@CommonAnnotation("property")
|
||||||
@@ -57,6 +57,6 @@ actual class AnnotatedClass @JvmAnnotation("constructor") @CommonAnnotation("con
|
|||||||
@CommonAnnotation("type-alias")
|
@CommonAnnotation("type-alias")
|
||||||
actual typealias AnnotatedTypeAlias = AnnotatedClass
|
actual typealias AnnotatedTypeAlias = AnnotatedClass
|
||||||
|
|
||||||
@JvmOuterAnnotation(inner = JvmInnerAnnotation("nested-annotations"))
|
//@JvmOuterAnnotation(inner = JvmInnerAnnotation("nested-annotations"))
|
||||||
@CommonOuterAnnotation(inner = CommonInnerAnnotation("nested-annotations"))
|
//@CommonOuterAnnotation(inner = CommonInnerAnnotation("nested-annotations"))
|
||||||
actual object ObjectWithNestedAnnotations
|
//actual object ObjectWithNestedAnnotations
|
||||||
|
|||||||
+10
-10
@@ -16,13 +16,13 @@ annotation class JsAnnotationForAnnotationClassesOnly(val text: String)
|
|||||||
@CommonAnnotationForAnnotationClassesOnly("annotation-class")
|
@CommonAnnotationForAnnotationClassesOnly("annotation-class")
|
||||||
annotation class JsAnnotation(val text: String)
|
annotation class JsAnnotation(val text: String)
|
||||||
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
//@Target(AnnotationTarget.CLASS)
|
||||||
annotation class CommonOuterAnnotation(val inner: CommonInnerAnnotation)
|
//annotation class CommonOuterAnnotation(val inner: CommonInnerAnnotation)
|
||||||
annotation class CommonInnerAnnotation(val text: String)
|
//annotation class CommonInnerAnnotation(val text: String)
|
||||||
|
//
|
||||||
@Target(AnnotationTarget.CLASS)
|
//@Target(AnnotationTarget.CLASS)
|
||||||
annotation class JsOuterAnnotation(val inner: JsInnerAnnotation)
|
//annotation class JsOuterAnnotation(val inner: JsInnerAnnotation)
|
||||||
annotation class JsInnerAnnotation(val text: String)
|
//annotation class JsInnerAnnotation(val text: String)
|
||||||
|
|
||||||
@JsAnnotation("property")
|
@JsAnnotation("property")
|
||||||
@CommonAnnotation("property")
|
@CommonAnnotation("property")
|
||||||
@@ -57,6 +57,6 @@ class AnnotatedClass @JsAnnotation("constructor") @CommonAnnotation("constructor
|
|||||||
@CommonAnnotation("type-alias")
|
@CommonAnnotation("type-alias")
|
||||||
typealias AnnotatedTypeAlias = AnnotatedClass
|
typealias AnnotatedTypeAlias = AnnotatedClass
|
||||||
|
|
||||||
@JsOuterAnnotation(inner = JsInnerAnnotation("nested-annotations"))
|
//@JsOuterAnnotation(inner = JsInnerAnnotation("nested-annotations"))
|
||||||
@CommonOuterAnnotation(inner = CommonInnerAnnotation("nested-annotations"))
|
//@CommonOuterAnnotation(inner = CommonInnerAnnotation("nested-annotations"))
|
||||||
object ObjectWithNestedAnnotations
|
//object ObjectWithNestedAnnotations
|
||||||
|
|||||||
+10
-10
@@ -16,13 +16,13 @@ annotation class JvmAnnotationForAnnotationClassesOnly(val text: String)
|
|||||||
@CommonAnnotationForAnnotationClassesOnly("annotation-class")
|
@CommonAnnotationForAnnotationClassesOnly("annotation-class")
|
||||||
annotation class JvmAnnotation(val text: String)
|
annotation class JvmAnnotation(val text: String)
|
||||||
|
|
||||||
@Target(AnnotationTarget.CLASS)
|
//@Target(AnnotationTarget.CLASS)
|
||||||
annotation class CommonOuterAnnotation(val inner: CommonInnerAnnotation)
|
//annotation class CommonOuterAnnotation(val inner: CommonInnerAnnotation)
|
||||||
annotation class CommonInnerAnnotation(val text: String)
|
//annotation class CommonInnerAnnotation(val text: String)
|
||||||
|
//
|
||||||
@Target(AnnotationTarget.CLASS)
|
//@Target(AnnotationTarget.CLASS)
|
||||||
annotation class JvmOuterAnnotation(val inner: JvmInnerAnnotation)
|
//annotation class JvmOuterAnnotation(val inner: JvmInnerAnnotation)
|
||||||
annotation class JvmInnerAnnotation(val text: String)
|
//annotation class JvmInnerAnnotation(val text: String)
|
||||||
|
|
||||||
@JvmAnnotation("property")
|
@JvmAnnotation("property")
|
||||||
@CommonAnnotation("property")
|
@CommonAnnotation("property")
|
||||||
@@ -57,6 +57,6 @@ class AnnotatedClass @JvmAnnotation("constructor") @CommonAnnotation("constructo
|
|||||||
@CommonAnnotation("type-alias")
|
@CommonAnnotation("type-alias")
|
||||||
typealias AnnotatedTypeAlias = AnnotatedClass
|
typealias AnnotatedTypeAlias = AnnotatedClass
|
||||||
|
|
||||||
@JvmOuterAnnotation(inner = JvmInnerAnnotation("nested-annotations"))
|
//@JvmOuterAnnotation(inner = JvmInnerAnnotation("nested-annotations"))
|
||||||
@CommonOuterAnnotation(inner = CommonInnerAnnotation("nested-annotations"))
|
//@CommonOuterAnnotation(inner = CommonInnerAnnotation("nested-annotations"))
|
||||||
object ObjectWithNestedAnnotations
|
//object ObjectWithNestedAnnotations
|
||||||
|
|||||||
+3
-3
@@ -5,9 +5,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.descriptors.commonizer.core
|
package org.jetbrains.kotlin.descriptors.commonizer.core
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
|
||||||
import org.jetbrains.kotlin.descriptors.commonizer.utils.EMPTY_CLASSIFIERS_CACHE
|
import org.jetbrains.kotlin.descriptors.commonizer.utils.EMPTY_CLASSIFIERS_CACHE
|
||||||
import org.jetbrains.kotlin.descriptors.commonizer.core.CirTestValueParameter.Companion.areEqual
|
import org.jetbrains.kotlin.descriptors.commonizer.core.CirTestValueParameter.Companion.areEqual
|
||||||
|
import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ir.CirAnnotation
|
||||||
import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ir.CirClassifiersCache
|
import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ir.CirClassifiersCache
|
||||||
import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ir.CirType
|
import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ir.CirType
|
||||||
import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ir.CirValueParameter
|
import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.ir.CirValueParameter
|
||||||
@@ -157,7 +157,7 @@ class DefaultValueParameterCommonizerTest : AbstractCommonizerTest<CirValueParam
|
|||||||
|
|
||||||
return CirTestValueParameter(
|
return CirTestValueParameter(
|
||||||
name = Name.identifier(name),
|
name = Name.identifier(name),
|
||||||
annotations = Annotations.EMPTY,
|
annotations = emptyList(),
|
||||||
returnType = returnType,
|
returnType = returnType,
|
||||||
varargElementType = returnType.takeIf { hasVarargElementType }, // the vararg type itself does not matter here, only it's presence matters
|
varargElementType = returnType.takeIf { hasVarargElementType }, // the vararg type itself does not matter here, only it's presence matters
|
||||||
isCrossinline = isCrossinline,
|
isCrossinline = isCrossinline,
|
||||||
@@ -170,7 +170,7 @@ class DefaultValueParameterCommonizerTest : AbstractCommonizerTest<CirValueParam
|
|||||||
|
|
||||||
internal data class CirTestValueParameter(
|
internal data class CirTestValueParameter(
|
||||||
override val name: Name,
|
override val name: Name,
|
||||||
override val annotations: Annotations,
|
override val annotations: List<CirAnnotation>,
|
||||||
override val returnType: CirType,
|
override val returnType: CirType,
|
||||||
override val varargElementType: CirType?,
|
override val varargElementType: CirType?,
|
||||||
override val declaresDefaultValue: Boolean,
|
override val declaresDefaultValue: Boolean,
|
||||||
|
|||||||
Reference in New Issue
Block a user