diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/linkage/partial/PartialLinkageCase.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/linkage/partial/PartialLinkageCase.kt index 230746f8ca8..69fd2603fa0 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/linkage/partial/PartialLinkageCase.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/linkage/partial/PartialLinkageCase.kt @@ -151,4 +151,14 @@ sealed interface PartialLinkageCase { * Applicable to: Declarations (functions, properties). */ class UnimplementedAbstractCallable(val callable: IrOverridableDeclaration<*>) : PartialLinkageCase + + /** + * Unusable instance of annotation. The annotation itself is removed from the holder [IrDeclaration]. + * + * Applicable to: Declarations. + */ + class UnusableAnnotation( + val annotationConstructorSymbol: IrConstructorSymbol, + val holderDeclarationSymbol: IrSymbol + ) : PartialLinkageCase } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/ConstantValueGenerator.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/ConstantValueGenerator.kt index 6ae7aa8d246..4edce16dc8f 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/ConstantValueGenerator.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/ConstantValueGenerator.kt @@ -109,33 +109,43 @@ abstract class ConstantValueGenerator( // TODO: in `annotationWithKotlinProperty`, `@Foo(KotlinClass.FOO_INT)` is parsed as if `KotlinClass.FOO_INT` // is an EnumValue when it's a read of a `const val` with an Int type. Not using `expectedType` somewhat masks // that - we silently fail to translate the argument because `enumEntryDescriptor` is an error class. - val enumEntryDescriptor = - constantValueType.memberScope.getContributedClassifier(constantValue.enumEntryName, NoLookupLocation.FROM_BACKEND) - ?: throw AssertionError("No such enum entry ${constantValue.enumEntryName} in $constantType") - if (enumEntryDescriptor !is ClassDescriptor) { - throw AssertionError("Enum entry $enumEntryDescriptor should be a ClassDescriptor") - } - if (!DescriptorUtils.isEnumEntry(enumEntryDescriptor)) { - // Error class descriptor for an unresolved entry. - // TODO this `null` may actually reach codegen if the annotation is on an interface member's default implementation, - // as any bridge generated in an implementation of that interface will have a copy of the annotation. See - // `missingEnumReferencedInAnnotationArgumentIr` in `testData/compileKotlinAgainstCustomBinaries`: replace - // `open class B` with `interface B` and watch things break. (`KClassValue` below likely has a similar problem.) - return null - } - IrGetEnumValueImpl( - startOffset, endOffset, - constantType, - symbolTable.referenceEnumEntry(enumEntryDescriptor) + val enumEntryDescriptor = constantValueType.memberScope.getContributedClassifier( + constantValue.enumEntryName, + NoLookupLocation.FROM_BACKEND ) + + when { + enumEntryDescriptor == null -> { + // Missing enum entry. Probably it's gone in newer version of the library. + return null + } + enumEntryDescriptor !is ClassDescriptor -> { + throw AssertionError("Enum entry $enumEntryDescriptor should be a ClassDescriptor") + } + !DescriptorUtils.isEnumEntry(enumEntryDescriptor) -> { + // Error class descriptor for an unresolved entry. + // TODO this `null` may actually reach codegen if the annotation is on an interface member's default implementation, + // as any bridge generated in an implementation of that interface will have a copy of the annotation. See + // `missingEnumReferencedInAnnotationArgumentIr` in `testData/compileKotlinAgainstCustomBinaries`: replace + // `open class B` with `interface B` and watch things break. (`KClassValue` below likely has a similar problem.) + return null + } + else -> IrGetEnumValueImpl( + startOffset, endOffset, + constantType, + symbolTable.referenceEnumEntry(enumEntryDescriptor) + ) + } } is AnnotationValue -> generateAnnotationConstructorCall(constantValue.value, constantKtType) is KClassValue -> { val classifierKtType = constantValue.getArgumentType(moduleDescriptor) - if (classifierKtType.isError) null - else { + if (classifierKtType.isError) { + // The classifier type contains error class descriptor. Probably the classifier is gone in newer version of the library. + null + } else { val classifierDescriptor = classifierKtType.constructor.declarationDescriptor ?: throw AssertionError("Unexpected KClassValue: $classifierKtType") diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/partial/PartialLinkageErrorMessages.kt b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/partial/PartialLinkageErrorMessages.kt index 6e41dddb1cc..1f199e8ac87 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/partial/PartialLinkageErrorMessages.kt +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/partial/PartialLinkageErrorMessages.kt @@ -73,6 +73,7 @@ internal fun PartialLinkageCase.renderLinkageError(): String = buildString { is AbstractClassInstantiation -> expression(constructorCall) { cantInstantiateAbstractClass(classSymbol) } is UnimplementedAbstractCallable -> unimplementedAbstractCallable(callable) + is UnusableAnnotation -> unusableAnnotation(annotationConstructorSymbol, holderDeclarationSymbol) } } @@ -552,6 +553,10 @@ private fun Appendable.unimplementedAbstractCallable(callable: IrOverridableDecl append("Abstract ").declarationKindName(callable.symbol, capitalized = false) .append(" is not implemented in non-abstract ").declarationKindName(callable.parentAsClass.symbol, capitalized = false) +private fun Appendable.unusableAnnotation(annotationConstructorSymbol: IrConstructorSymbol, holderDeclarationSymbol: IrSymbol): Appendable = + append("Unusable annotation ").declarationName(annotationConstructorSymbol) + .append(" has been removed from ").declarationKindName(holderDeclarationSymbol, capitalized = false) + private fun Appendable.appendCapitalized(text: String, capitalized: Boolean): Appendable { if (capitalized && text.isNotEmpty()) { val firstChar = text[0] diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/partial/PartialLinkageSupportForLoweringsImpl.kt b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/partial/PartialLinkageSupportForLoweringsImpl.kt index c6c548d42e7..8be878c4ae6 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/partial/PartialLinkageSupportForLoweringsImpl.kt +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/partial/PartialLinkageSupportForLoweringsImpl.kt @@ -34,6 +34,13 @@ internal class PartialLinkageSupportForLoweringsImpl( ) : PartialLinkageSupportForLowerings { override val isEnabled get() = true + // N.B. errorMessagesRendered is always >= than throwExpressionsGenerated. + var throwExpressionsGenerated = 0 // Track each generate `throw` expression. + private set + + var errorMessagesRendered = 0 // Track each rendered error message. + private set + private val irLoggerSeverity = when (logLevel) { PartialLinkageLogLevel.INFO -> IrMessageLogger.Severity.INFO PartialLinkageLogLevel.WARNING -> IrMessageLogger.Severity.WARNING @@ -47,10 +54,12 @@ internal class PartialLinkageSupportForLoweringsImpl( doNotLog: Boolean ): IrCall { val errorMessage = if (doNotLog) - partialLinkageCase.renderLinkageError() // Just render a message. + renderLinkageError(partialLinkageCase) // Just render a message. else renderAndLogLinkageError(partialLinkageCase, element, file) // Render + log with the appropriate severity. + throwExpressionsGenerated++ // Track each generate `throw` expression. + return IrCallImpl( startOffset = element.startOffset, endOffset = element.endOffset, @@ -65,7 +74,7 @@ internal class PartialLinkageSupportForLoweringsImpl( } fun renderAndLogLinkageError(partialLinkageCase: PartialLinkageCase, element: IrElement, file: PLFile): String { - val errorMessage = partialLinkageCase.renderLinkageError() + val errorMessage = renderLinkageError(partialLinkageCase) val locationInSourceCode = file.computeLocationForOffset(element.startOffsetOfFirstDenotableIrElement()) messageLogger.report(irLoggerSeverity, errorMessage, locationInSourceCode) // It's OK. We log it as a warning. @@ -73,6 +82,11 @@ internal class PartialLinkageSupportForLoweringsImpl( return errorMessage } + private fun renderLinkageError(partialLinkageCase: PartialLinkageCase): String { + errorMessagesRendered++ // Track each rendered error message. + return partialLinkageCase.renderLinkageError() + } + companion object { private tailrec fun IrElement.startOffsetOfFirstDenotableIrElement(): Int = when (this) { is IrPackageFragment -> UNDEFINED_OFFSET diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/partial/PartialLinkageUtils.kt b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/partial/PartialLinkageUtils.kt index f72aa7445cf..09bc14d44d4 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/partial/PartialLinkageUtils.kt +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/partial/PartialLinkageUtils.kt @@ -83,12 +83,17 @@ internal abstract class FileAwareIrElementTransformerVoid(startingFile: PLFile?) private var _currentFile: PLFile? = startingFile val currentFile: PLFile get() = _currentFile ?: error("No information about current file") - final override fun visitFile(declaration: IrFile): IrFile { - _currentFile = PLFile.IrBased(declaration) - return try { - super.visitFile(declaration) + protected fun runInFile(file: PLFile, block: () -> T): T { + val previousFile = _currentFile + _currentFile = file + try { + return block() } finally { - _currentFile = null + _currentFile = previousFile } } + + final override fun visitFile(declaration: IrFile) = runInFile(PLFile.IrBased(declaration)) { + super.visitFile(declaration) + } } diff --git a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/partial/PartiallyLinkedIrTreePatcher.kt b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/partial/PartiallyLinkedIrTreePatcher.kt index 4c8c70de332..16698382c03 100644 --- a/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/partial/PartiallyLinkedIrTreePatcher.kt +++ b/compiler/ir/serialization.common/src/org/jetbrains/kotlin/backend/common/linkage/partial/PartiallyLinkedIrTreePatcher.kt @@ -446,7 +446,7 @@ internal class PartiallyLinkedIrTreePatcher( supportForLowerings.throwLinkageError(this, declaration, currentFile, doNotLog) } - private inner class ExpressionTransformer(startingFile: PLFile?) : FileAwareIrElementTransformerVoid(startingFile) { + private open inner class ExpressionTransformer(startingFile: PLFile?) : FileAwareIrElementTransformerVoid(startingFile) { override fun visitPackageFragment(declaration: IrPackageFragment): IrPackageFragment { (declaration as? IrFile)?.filterUnusableAnnotations() return super.visitPackageFragment(declaration) @@ -503,40 +503,37 @@ internal class PartiallyLinkedIrTreePatcher( checkReferencedDeclaration(symbol) ?: checkReferencedDeclaration(superQualifierSymbol) ?: checkExpressionTypeArguments() - ?: checkArgumentsAndValueParameters(symbol.owner) + ?: checkArgumentsAndValueParameters() } override fun visitConstructorCall(expression: IrConstructorCall) = expression.maybeThrowLinkageError { checkReferencedDeclaration(symbol) ?: checkNotAbstractClass() ?: checkExpressionTypeArguments() - ?: checkReferencedDeclarationType(expression.symbol.owner.parentAsClass, "regular class") { constructedClass -> - constructedClass.kind == ClassKind.CLASS || constructedClass.kind == ClassKind.ANNOTATION_CLASS - } - ?: checkArgumentsAndValueParameters(symbol.owner) + ?: customConstructorCallChecks() } override fun visitEnumConstructorCall(expression: IrEnumConstructorCall) = expression.maybeThrowLinkageError { checkReferencedDeclaration(symbol) ?: checkExpressionTypeArguments() - ?: checkReferencedDeclarationType(expression.symbol.owner.parentAsClass, "enum class") { constructedClass -> + ?: checkReferencedDeclarationType(symbol.owner.parentAsClass, "enum class") { constructedClass -> constructedClass.kind == ClassKind.ENUM_CLASS || constructedClass.kind == ClassKind.ENUM_ENTRY || constructedClass.symbol == builtIns.enumClass } - ?: checkArgumentsAndValueParameters(symbol.owner) + ?: checkArgumentsAndValueParameters() } override fun visitDelegatingConstructorCall(expression: IrDelegatingConstructorCall) = expression.maybeThrowLinkageError { checkReferencedDeclaration(symbol) ?: checkExpressionTypeArguments() - ?: checkArgumentsAndValueParameters(symbol.owner) + ?: checkArgumentsAndValueParameters() } override fun visitFunctionReference(expression: IrFunctionReference) = expression.maybeThrowLinkageError { checkReferencedDeclaration(symbol) ?: checkReferencedDeclaration(reflectionTarget) ?: checkExpressionTypeArguments() - ?: checkArgumentsAndValueParameters(symbol.owner) + ?: checkArgumentsAndValueParameters() } override fun visitPropertyReference(expression: IrPropertyReference) = expression.maybeThrowLinkageError { @@ -547,7 +544,7 @@ internal class PartiallyLinkedIrTreePatcher( ?: checkExpressionTypeArguments() } - // Never patch instance initializers. Otherwise this will break a lot of lowerings. + // Never patch instance initializers. Otherwise, this will break a lot of lowerings. override fun visitInstanceInitializerCall(expression: IrInstanceInitializerCall) = expression override fun visitExpression(expression: IrExpression) = expression.maybeThrowLinkageError { null } @@ -555,7 +552,10 @@ internal class PartiallyLinkedIrTreePatcher( private inline fun T.maybeThrowLinkageError(computePartialLinkageCase: T.() -> PartialLinkageCase?): IrExpression = maybeThrowLinkageError(transformer = this@ExpressionTransformer) { computePartialLinkageCase() ?: checkExpressionType(type) // Check something that is always present in every expression. - } + }.also { onAfterMaybeThrowLinkageError() } + + // Custom post-check. Can be overridden. + protected open fun IrExpression.onAfterMaybeThrowLinkageError() = Unit private fun IrExpression.checkExpressionType(type: IrType): PartialLinkageCase? { return ExpressionWithUnusableClassifier(this, type.explore() ?: return null) @@ -635,7 +635,11 @@ internal class PartiallyLinkedIrTreePatcher( return null } - val declaration = symbol.owner as? IrDeclarationWithVisibility ?: return null + val declaration: IrDeclarationWithVisibility = when (val symbolOwner = symbol.owner) { + is IrDeclarationWithVisibility -> symbolOwner + is IrEnumEntry -> symbolOwner.parent as? IrClass ?: return null + else -> return null + } val containingModule = PLModule.determineModuleFor(declaration) return when { @@ -672,7 +676,7 @@ internal class PartiallyLinkedIrTreePatcher( private fun List.precalculatedUnusableClassifier(): ExploredClassifier.Unusable? = firstNotNullOfOrNull { it.precalculatedUnusableClassifier() } - private fun IrExpression.checkReferencedDeclarationType( + protected fun IrExpression.checkReferencedDeclarationType( declaration: D, expectedDeclarationDescription: String, checkDeclarationType: (D) -> Boolean @@ -682,7 +686,11 @@ internal class PartiallyLinkedIrTreePatcher( else null } - private fun IrMemberAccessExpression.checkArgumentsAndValueParameters(function: D): PartialLinkageCase? { + protected inline fun IrMemberAccessExpression.checkArgumentsAndValueParameters( + usedDefaultArgumentsConsumer: (IrExpressionBody) -> Unit = {} + ): PartialLinkageCase? { + val function = symbol.owner + val expressionEffectivelyHasDispatchReceiver = when { dispatchReceiver != null -> true this is IrFunctionReference -> run { @@ -780,9 +788,15 @@ internal class PartiallyLinkedIrTreePatcher( } val expressionValueArgumentCount = (0 until valueArgumentsCount).count { index -> - getValueArgument(index) != null - || function.valueParameters.getOrNull(index)?.isVararg == true - || functionsToCheckDefaultValues.any { it.valueParameters.getOrNull(index)?.defaultValue != null } + if (getValueArgument(index) != null) + return@count true + + val defaultArgumentExpressionBody = functionsToCheckDefaultValues.firstNotNullOfOrNull { + it.valueParameters.getOrNull(index)?.defaultValue + } + defaultArgumentExpressionBody?.let(usedDefaultArgumentsConsumer) + + return@count defaultArgumentExpressionBody != null || function.valueParameters.getOrNull(index)?.isVararg == true } val functionValueParameterCount = function.valueParameters.size @@ -806,26 +820,84 @@ internal class PartiallyLinkedIrTreePatcher( null } - private fun T.filterUnusableAnnotations() where T : IrMutableAnnotationContainer, T : IrElement { + // Custom checks for constructor call. Can be overridden. + protected open fun IrConstructorCall.customConstructorCallChecks(): PartialLinkageCase? = + checkReferencedDeclarationType(symbol.owner.parentAsClass, "class") { constructedClass -> + constructedClass.kind == ClassKind.CLASS || constructedClass.kind == ClassKind.ANNOTATION_CLASS + } ?: checkArgumentsAndValueParameters() + + private fun T.filterUnusableAnnotations() where T : IrMutableAnnotationContainer, T : IrSymbolOwner { if (annotations.isNotEmpty()) { annotations = annotations.filterTo(ArrayList(annotations.size)) { annotation -> - val partialLinkageCase = with(annotation) { - checkReferencedDeclaration(symbol) - ?: checkExpressionTypeArguments() - ?: checkReferencedDeclarationType(symbol.owner.parentAsClass, "annotation class") { constructedClass -> - constructedClass.kind == ClassKind.ANNOTATION_CLASS - } - } ?: return@filterTo true + // Visit the annotation as an expression. + val checker = AnnotationChecker(currentFile) + annotation.transformVoid(checker) - // Just log a warning. Do not throw a linkage error as this would produce broken IR. - supportForLowerings.renderAndLogLinkageError(partialLinkageCase, this, currentFile) + if (checker.isUsableAnnotation) { + true // No PL errors have been found. + } else { + // Just log a warning. Do not throw a linkage error as this would produce broken IR. + supportForLowerings.renderAndLogLinkageError( + partialLinkageCase = UnusableAnnotation(annotation.symbol, holderDeclarationSymbol = symbol), + element = this, + file = currentFile + ) - false // Drop it. + false // Drop the annotation. + } }.compact() } } } + private inner class AnnotationChecker(currentFile: PLFile) : ExpressionTransformer(currentFile) { + private val currentErrorMessagesCount get() = supportForLowerings.errorMessagesRendered + private val initialErrorMessagesCount = currentErrorMessagesCount // Memoize the number of PL errors generated to this moment. + + var isUsableAnnotation = true + private set + + override fun IrExpression.onAfterMaybeThrowLinkageError() { + if (isUsableAnnotation) + isUsableAnnotation = initialErrorMessagesCount == currentErrorMessagesCount && !isPartialLinkageRuntimeError() + } + + override fun visitConst(expression: IrConst<*>): IrExpression = expression // Nothing can be unlinked here. + + override fun IrConstructorCall.customConstructorCallChecks(): PartialLinkageCase? = + checkReferencedDeclarationType(symbol.owner.parentAsClass, "annotation class") { constructedClass -> + constructedClass.kind == ClassKind.ANNOTATION_CLASS + } ?: run { + val annotationFile by lazy { PLFile.determineFileFor(symbol.owner) } + + checkArgumentsAndValueParameters { defaultArgumentExpressionBody -> + val defaultArgument = defaultArgumentExpressionBody.expression + when { + defaultArgument is IrConst<*> -> { + // Nothing can be unlinked here. + } + defaultArgument is IrErrorExpression -> { + // Such expression is used as a placeholder for a real default value in Lazy IR. + // Nothing to check here specifically. + } + defaultArgument.isPartialLinkageRuntimeError() -> { + // Default arg has already been processed by ExpressionsTransformer, and it is known to be a PL error. + isUsableAnnotation = false + } + annotationFile.module.shouldBeSkipped -> { + // It does not make sense to check the default arguments in annotation classes from stdlib. + } + else -> { + // WARNING: Jump to (probably) another file and patch the default argument expression right there. + runInFile(annotationFile) { + defaultArgumentExpressionBody.transformVoid(this@AnnotationChecker) + } + } + } + } + } + } + private fun IrClassifierSymbol.explore(): ExploredClassifier.Unusable? = classifierExplorer.exploreSymbol(this) private fun IrType.explore(): ExploredClassifier.Unusable? = classifierExplorer.exploreType(this) diff --git a/compiler/testData/klibABI/changeFunctionVisibility/lib1/l1.kt b/compiler/testData/klibABI/changeFunctionVisibility/lib1/l1.kt index 146703ae43b..b0c910c641d 100644 --- a/compiler/testData/klibABI/changeFunctionVisibility/lib1/l1.kt +++ b/compiler/testData/klibABI/changeFunctionVisibility/lib1/l1.kt @@ -33,3 +33,11 @@ open class Container { // @PublishedApi internal open fun newOpenInternalPAFunction() = "Container.newOpenInternalPAFunction.v1" // private fun newPrivateFunction() = "Container.newPrivateFunction.v1" } + +private fun privateTopLevelFun() = "privateTopLevelFun.v1" +fun publicTopLevelFunWithPrivateDefaultArgument(value: String = privateTopLevelFun()) = "publicTopLevelFunWithPrivateDefaultArgument.v1($value)" + +object TopLevel { + private fun privateNestedFun() = "privateNestedFun.v1" + fun publicNestedFunWithPrivateDefaultArgument(value: String = privateNestedFun()) = "publicNestedFunWithPrivateDefaultArgument.v1($value)" +} diff --git a/compiler/testData/klibABI/changeFunctionVisibility/lib1/l1.kt.1 b/compiler/testData/klibABI/changeFunctionVisibility/lib1/l1.kt.1 index fb4a2ea76eb..3e6cc406c46 100644 --- a/compiler/testData/klibABI/changeFunctionVisibility/lib1/l1.kt.1 +++ b/compiler/testData/klibABI/changeFunctionVisibility/lib1/l1.kt.1 @@ -33,3 +33,11 @@ open class Container { @PublishedApi internal open fun newOpenInternalPAFunction() = "Container.newOpenInternalPAFunction.v2" private fun newPrivateFunction() = "Container.newPrivateFunction.v2" } + +private fun privateTopLevelFun() = "privateTopLevelFun.v2" +fun publicTopLevelFunWithPrivateDefaultArgument(value: String = privateTopLevelFun()) = "publicTopLevelFunWithPrivateDefaultArgument.v2($value)" + +object TopLevel { + private fun privateNestedFun() = "privateNestedFun.v2" + fun publicNestedFunWithPrivateDefaultArgument(value: String = privateNestedFun()) = "publicNestedFunWithPrivateDefaultArgument.v2($value)" +} diff --git a/compiler/testData/klibABI/changeFunctionVisibility/main/m.kt b/compiler/testData/klibABI/changeFunctionVisibility/main/m.kt index 1cb093aeaac..60ca3a1dd67 100644 --- a/compiler/testData/klibABI/changeFunctionVisibility/main/m.kt +++ b/compiler/testData/klibABI/changeFunctionVisibility/main/m.kt @@ -46,6 +46,9 @@ fun box() = abiTest { success("ContainerImpl.newInternalPAFunction") { ci.newInternalPAFunctionAccess() } success("ContainerImpl.newOpenInternalPAFunction") { ci.newOpenInternalPAFunctionAccess() } success("ContainerImpl.newPrivateFunction") { ci.newPrivateFunctionAccess() } + + success("publicTopLevelFunWithPrivateDefaultArgument.v2(privateTopLevelFun.v2)") { publicTopLevelFunWithPrivateDefaultArgument() } + success("publicNestedFunWithPrivateDefaultArgument.v2(privateNestedFun.v2)") { TopLevel.publicNestedFunWithPrivateDefaultArgument() } } // Shortcuts: diff --git a/compiler/testData/klibABI/classTransformations/lib1/l1.kt b/compiler/testData/klibABI/classTransformations/lib1/l1.kt index 08dc484467f..f44431a1eef 100644 --- a/compiler/testData/klibABI/classTransformations/lib1/l1.kt +++ b/compiler/testData/klibABI/classTransformations/lib1/l1.kt @@ -141,3 +141,12 @@ class ClassToAbstractClass { var name: String = "Alice" fun getGreeting() = "Hello, $name!" } + +class RemovedClass +enum class EnumClassWithDisappearingEntry { UNCHANGED, REMOVED } + +object PublicTopLevelLib1 { + annotation class AnnotationClassThatBecomesPrivate + class ClassThatBecomesPrivate + enum class EnumClassThatBecomesPrivate { ENTRY } +} diff --git a/compiler/testData/klibABI/classTransformations/lib1/l1.kt.1 b/compiler/testData/klibABI/classTransformations/lib1/l1.kt.1 index 16693bfd338..2828d5757b0 100644 --- a/compiler/testData/klibABI/classTransformations/lib1/l1.kt.1 +++ b/compiler/testData/klibABI/classTransformations/lib1/l1.kt.1 @@ -141,3 +141,12 @@ abstract class ClassToAbstractClass { abstract var name: String fun getGreeting() = "Hello, $name!" } + +//class RemovedClass +enum class EnumClassWithDisappearingEntry { UNCHANGED, /*REMOVED*/ } + +object PublicTopLevelLib1 { + private annotation class AnnotationClassThatBecomesPrivate + private class ClassThatBecomesPrivate + private enum class EnumClassThatBecomesPrivate { ENTRY } +} diff --git a/compiler/testData/klibABI/classTransformations/lib2/l2.kt b/compiler/testData/klibABI/classTransformations/lib2/l2.kt index 317093e6860..acfba6fe90b 100644 --- a/compiler/testData/klibABI/classTransformations/lib2/l2.kt +++ b/compiler/testData/klibABI/classTransformations/lib2/l2.kt @@ -120,6 +120,25 @@ annotation class AnnotationClassWithParameterThatBecomesRegularClass(val x: Anno annotation class AnnotationClassWithParameterOfParameterThatBecomesRegularClass(val x: AnnotationClassWithParameterThatBecomesRegularClass) annotation class AnnotationClassWithParameterThatDisappears(val x: AnnotationClassThatDisappears) annotation class AnnotationClassWithParameterOfParameterThatDisappears(val x: AnnotationClassWithParameterThatDisappears) +annotation class AnnotationClassWithClassReferenceParameterThatDisappears1(val x: kotlin.reflect.KClass = RemovedClass::class) +annotation class AnnotationClassWithClassReferenceParameterThatDisappears2(val x: kotlin.reflect.KClass<*> = RemovedClass::class) +annotation class AnnotationClassWithClassReferenceParameterOfParameterThatDisappears1(val x: AnnotationClassWithClassReferenceParameterThatDisappears1 = AnnotationClassWithClassReferenceParameterThatDisappears1()) +annotation class AnnotationClassWithClassReferenceParameterOfParameterThatDisappears2(val x: AnnotationClassWithClassReferenceParameterThatDisappears2 = AnnotationClassWithClassReferenceParameterThatDisappears2()) +annotation class AnnotationClassWithRemovedEnumEntryParameter(val x: EnumClassWithDisappearingEntry = EnumClassWithDisappearingEntry.REMOVED) +annotation class AnnotationClassWithRemovedEnumEntryParameterOfParameter(val x: AnnotationClassWithRemovedEnumEntryParameter = AnnotationClassWithRemovedEnumEntryParameter()) +annotation class AnnotationClassWithParameterThatBecomesPrivate1(val x: PublicTopLevelLib1.AnnotationClassThatBecomesPrivate = PublicTopLevelLib1.AnnotationClassThatBecomesPrivate()) +annotation class AnnotationClassWithParameterThatBecomesPrivate2(val x: kotlin.reflect.KClass = PublicTopLevelLib1.ClassThatBecomesPrivate::class) +annotation class AnnotationClassWithParameterOfParameterThatBecomesPrivate2(val x: AnnotationClassWithParameterThatBecomesPrivate2 = AnnotationClassWithParameterThatBecomesPrivate2()) +annotation class AnnotationClassWithParameterThatBecomesPrivate3(val x: kotlin.reflect.KClass<*> = PublicTopLevelLib1.ClassThatBecomesPrivate::class) +annotation class AnnotationClassWithParameterOfParameterThatBecomesPrivate3(val x: AnnotationClassWithParameterThatBecomesPrivate3 = AnnotationClassWithParameterThatBecomesPrivate3()) +annotation class AnnotationClassWithParameterThatBecomesPrivate4(val x: PublicTopLevelLib1.EnumClassThatBecomesPrivate = PublicTopLevelLib1.EnumClassThatBecomesPrivate.ENTRY) +annotation class AnnotationClassWithParameterOfParameterThatBecomesPrivate4(val x: AnnotationClassWithParameterThatBecomesPrivate4 = AnnotationClassWithParameterThatBecomesPrivate4()) + +object PublicTopLevelLib2 { + private class PrivateClass + annotation class AnnotationClassWithParameterWithPrivateDefaultValue(val x: kotlin.reflect.KClass<*> = PrivateClass::class) + annotation class AnnotationClassWithParameterOfParameterWithPrivateDefaultValue(val x: AnnotationClassWithParameterWithPrivateDefaultValue = AnnotationClassWithParameterWithPrivateDefaultValue()) +} fun getAnnotationClassWithChangedParameterType(): AnnotationClassWithChangedParameterType = AnnotationClassWithChangedParameterType(101) inline fun getAnnotationClassWithChangedParameterTypeInline(): AnnotationClassWithChangedParameterType = AnnotationClassWithChangedParameterType(102) @@ -162,6 +181,93 @@ inline fun getAnnotationClassWithNewParameterInline(): AnnotationClassWithNewPar fun getAnnotationClassWithNewParameterAsAny(): Any = AnnotationClassWithNewParameter(139) inline fun getAnnotationClassWithNewParameterAsAnyInline(): Any = AnnotationClassWithNewParameter(140) +fun getAnnotationClassWithClassReferenceParameterThatDisappears1(): AnnotationClassWithClassReferenceParameterThatDisappears1 = AnnotationClassWithClassReferenceParameterThatDisappears1(RemovedClass::class) +inline fun getAnnotationClassWithClassReferenceParameterThatDisappears1Inline(): AnnotationClassWithClassReferenceParameterThatDisappears1 = AnnotationClassWithClassReferenceParameterThatDisappears1(RemovedClass::class) +fun getAnnotationClassWithClassReferenceParameterThatDisappears1AsAny(): Any = AnnotationClassWithClassReferenceParameterThatDisappears1(RemovedClass::class) +inline fun getAnnotationClassWithClassReferenceParameterThatDisappears1AsAnyInline(): Any = AnnotationClassWithClassReferenceParameterThatDisappears1(RemovedClass::class) +fun getAnnotationClassWithDefaultClassReferenceParameterThatDisappears1(): AnnotationClassWithClassReferenceParameterThatDisappears1 = AnnotationClassWithClassReferenceParameterThatDisappears1() +inline fun getAnnotationClassWithDefaultClassReferenceParameterThatDisappears1Inline(): AnnotationClassWithClassReferenceParameterThatDisappears1 = AnnotationClassWithClassReferenceParameterThatDisappears1() +fun getAnnotationClassWithDefaultClassReferenceParameterThatDisappears1AsAny(): Any = AnnotationClassWithClassReferenceParameterThatDisappears1() +inline fun getAnnotationClassWithDefaultClassReferenceParameterThatDisappears1AsAnyInline(): Any = AnnotationClassWithClassReferenceParameterThatDisappears1() +fun getAnnotationClassWithClassReferenceParameterThatDisappears2(): AnnotationClassWithClassReferenceParameterThatDisappears2 = AnnotationClassWithClassReferenceParameterThatDisappears2(RemovedClass::class) +inline fun getAnnotationClassWithClassReferenceParameterThatDisappears2Inline(): AnnotationClassWithClassReferenceParameterThatDisappears2 = AnnotationClassWithClassReferenceParameterThatDisappears2(RemovedClass::class) +fun getAnnotationClassWithClassReferenceParameterThatDisappears2AsAny(): Any = AnnotationClassWithClassReferenceParameterThatDisappears2(RemovedClass::class) +inline fun getAnnotationClassWithClassReferenceParameterThatDisappears2AsAnyInline(): Any = AnnotationClassWithClassReferenceParameterThatDisappears2(RemovedClass::class) +fun getAnnotationClassWithDefaultClassReferenceParameterThatDisappears2(): AnnotationClassWithClassReferenceParameterThatDisappears2 = AnnotationClassWithClassReferenceParameterThatDisappears2() +inline fun getAnnotationClassWithDefaultClassReferenceParameterThatDisappears2Inline(): AnnotationClassWithClassReferenceParameterThatDisappears2 = AnnotationClassWithClassReferenceParameterThatDisappears2() +fun getAnnotationClassWithDefaultClassReferenceParameterThatDisappears2AsAny(): Any = AnnotationClassWithClassReferenceParameterThatDisappears2() +inline fun getAnnotationClassWithDefaultClassReferenceParameterThatDisappears2AsAnyInline(): Any = AnnotationClassWithClassReferenceParameterThatDisappears2() + +fun getAnnotationClassWithClassReferenceParameterOfParameterThatDisappears1(): AnnotationClassWithClassReferenceParameterOfParameterThatDisappears1 = AnnotationClassWithClassReferenceParameterOfParameterThatDisappears1(AnnotationClassWithClassReferenceParameterThatDisappears1(RemovedClass::class)) +inline fun getAnnotationClassWithClassReferenceParameterOfParameterThatDisappears1Inline(): AnnotationClassWithClassReferenceParameterOfParameterThatDisappears1 = AnnotationClassWithClassReferenceParameterOfParameterThatDisappears1(AnnotationClassWithClassReferenceParameterThatDisappears1(RemovedClass::class)) +fun getAnnotationClassWithClassReferenceParameterOfParameterThatDisappears1AsAny(): Any = AnnotationClassWithClassReferenceParameterOfParameterThatDisappears1(AnnotationClassWithClassReferenceParameterThatDisappears1(RemovedClass::class)) +inline fun getAnnotationClassWithClassReferenceParameterOfParameterThatDisappears1AsAnyInline(): Any = AnnotationClassWithClassReferenceParameterOfParameterThatDisappears1(AnnotationClassWithClassReferenceParameterThatDisappears1(RemovedClass::class)) +fun getAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears1(): AnnotationClassWithClassReferenceParameterOfParameterThatDisappears1 = AnnotationClassWithClassReferenceParameterOfParameterThatDisappears1() +inline fun getAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears1Inline(): AnnotationClassWithClassReferenceParameterOfParameterThatDisappears1 = AnnotationClassWithClassReferenceParameterOfParameterThatDisappears1() +fun getAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears1AsAny(): Any = AnnotationClassWithClassReferenceParameterOfParameterThatDisappears1() +inline fun getAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears1AsAnyInline(): Any = AnnotationClassWithClassReferenceParameterOfParameterThatDisappears1() +fun getAnnotationClassWithClassReferenceParameterOfParameterThatDisappears2(): AnnotationClassWithClassReferenceParameterOfParameterThatDisappears2 = AnnotationClassWithClassReferenceParameterOfParameterThatDisappears2(AnnotationClassWithClassReferenceParameterThatDisappears2(RemovedClass::class)) +inline fun getAnnotationClassWithClassReferenceParameterOfParameterThatDisappears2Inline(): AnnotationClassWithClassReferenceParameterOfParameterThatDisappears2 = AnnotationClassWithClassReferenceParameterOfParameterThatDisappears2(AnnotationClassWithClassReferenceParameterThatDisappears2(RemovedClass::class)) +fun getAnnotationClassWithClassReferenceParameterOfParameterThatDisappears2AsAny(): Any = AnnotationClassWithClassReferenceParameterOfParameterThatDisappears2(AnnotationClassWithClassReferenceParameterThatDisappears2(RemovedClass::class)) +inline fun getAnnotationClassWithClassReferenceParameterOfParameterThatDisappears2AsAnyInline(): Any = AnnotationClassWithClassReferenceParameterOfParameterThatDisappears2(AnnotationClassWithClassReferenceParameterThatDisappears2(RemovedClass::class)) +fun getAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears2(): AnnotationClassWithClassReferenceParameterOfParameterThatDisappears2 = AnnotationClassWithClassReferenceParameterOfParameterThatDisappears2() +inline fun getAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears2Inline(): AnnotationClassWithClassReferenceParameterOfParameterThatDisappears2 = AnnotationClassWithClassReferenceParameterOfParameterThatDisappears2() +fun getAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears2AsAny(): Any = AnnotationClassWithClassReferenceParameterOfParameterThatDisappears2() +inline fun getAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears2AsAnyInline(): Any = AnnotationClassWithClassReferenceParameterOfParameterThatDisappears2() +fun getAnnotationClassWithRemovedEnumEntryParameter(): AnnotationClassWithRemovedEnumEntryParameter = AnnotationClassWithRemovedEnumEntryParameter(EnumClassWithDisappearingEntry.REMOVED) +inline fun getAnnotationClassWithRemovedEnumEntryParameterInline(): AnnotationClassWithRemovedEnumEntryParameter = AnnotationClassWithRemovedEnumEntryParameter(EnumClassWithDisappearingEntry.REMOVED) +fun getAnnotationClassWithRemovedEnumEntryParameterAsAny(): Any = AnnotationClassWithRemovedEnumEntryParameter(EnumClassWithDisappearingEntry.REMOVED) +inline fun getAnnotationClassWithRemovedEnumEntryParameterAsAnyInline(): Any = AnnotationClassWithRemovedEnumEntryParameter(EnumClassWithDisappearingEntry.REMOVED) +fun getAnnotationClassWithDefaultRemovedEnumEntryParameter(): AnnotationClassWithRemovedEnumEntryParameter = AnnotationClassWithRemovedEnumEntryParameter() +inline fun getAnnotationClassWithDefaultRemovedEnumEntryParameterInline(): AnnotationClassWithRemovedEnumEntryParameter = AnnotationClassWithRemovedEnumEntryParameter() +fun getAnnotationClassWithDefaultRemovedEnumEntryParameterAsAny(): Any = AnnotationClassWithRemovedEnumEntryParameter() +inline fun getAnnotationClassWithDefaultRemovedEnumEntryParameterAsAnyInline(): Any = AnnotationClassWithRemovedEnumEntryParameter() +fun getAnnotationClassWithRemovedEnumEntryParameterOfParameter(): AnnotationClassWithRemovedEnumEntryParameterOfParameter = AnnotationClassWithRemovedEnumEntryParameterOfParameter(AnnotationClassWithRemovedEnumEntryParameter(EnumClassWithDisappearingEntry.REMOVED)) +inline fun getAnnotationClassWithRemovedEnumEntryParameterOfParameterInline(): AnnotationClassWithRemovedEnumEntryParameterOfParameter = AnnotationClassWithRemovedEnumEntryParameterOfParameter(AnnotationClassWithRemovedEnumEntryParameter(EnumClassWithDisappearingEntry.REMOVED)) +fun getAnnotationClassWithRemovedEnumEntryParameterOfParameterAsAny(): Any = AnnotationClassWithRemovedEnumEntryParameterOfParameter(AnnotationClassWithRemovedEnumEntryParameter(EnumClassWithDisappearingEntry.REMOVED)) +inline fun getAnnotationClassWithRemovedEnumEntryParameterOfParameterAsAnyInline(): Any = AnnotationClassWithRemovedEnumEntryParameterOfParameter(AnnotationClassWithRemovedEnumEntryParameter(EnumClassWithDisappearingEntry.REMOVED)) +fun getAnnotationClassWithDefaultRemovedEnumEntryParameterOfParameter(): AnnotationClassWithRemovedEnumEntryParameterOfParameter = AnnotationClassWithRemovedEnumEntryParameterOfParameter() +inline fun getAnnotationClassWithDefaultRemovedEnumEntryParameterOfParameterInline(): AnnotationClassWithRemovedEnumEntryParameterOfParameter = AnnotationClassWithRemovedEnumEntryParameterOfParameter() +fun getAnnotationClassWithDefaultRemovedEnumEntryParameterOfParameterAsAny(): Any = AnnotationClassWithRemovedEnumEntryParameterOfParameter() +inline fun getAnnotationClassWithDefaultRemovedEnumEntryParameterOfParameterAsAnyInline(): Any = AnnotationClassWithRemovedEnumEntryParameterOfParameter() + +fun getAnnotationClassWithParameterThatBecomesPrivate1(): AnnotationClassWithParameterThatBecomesPrivate1 = AnnotationClassWithParameterThatBecomesPrivate1() +inline fun getAnnotationClassWithParameterThatBecomesPrivate1Inline(): AnnotationClassWithParameterThatBecomesPrivate1 = AnnotationClassWithParameterThatBecomesPrivate1() +fun getAnnotationClassWithParameterThatBecomesPrivate1AsAny(): Any = AnnotationClassWithParameterThatBecomesPrivate1() +inline fun getAnnotationClassWithParameterThatBecomesPrivate1AsAnyInline(): Any = AnnotationClassWithParameterThatBecomesPrivate1() +fun getAnnotationClassWithParameterThatBecomesPrivate2(): AnnotationClassWithParameterThatBecomesPrivate2 = AnnotationClassWithParameterThatBecomesPrivate2() +inline fun getAnnotationClassWithParameterThatBecomesPrivate2Inline(): AnnotationClassWithParameterThatBecomesPrivate2 = AnnotationClassWithParameterThatBecomesPrivate2() +fun getAnnotationClassWithParameterThatBecomesPrivate2AsAny(): Any = AnnotationClassWithParameterThatBecomesPrivate2() +inline fun getAnnotationClassWithParameterThatBecomesPrivate2AsAnyInline(): Any = AnnotationClassWithParameterThatBecomesPrivate2() +fun getAnnotationClassWithParameterOfParameterThatBecomesPrivate2(): AnnotationClassWithParameterOfParameterThatBecomesPrivate2 = AnnotationClassWithParameterOfParameterThatBecomesPrivate2() +inline fun getAnnotationClassWithParameterOfParameterThatBecomesPrivate2Inline(): AnnotationClassWithParameterOfParameterThatBecomesPrivate2 = AnnotationClassWithParameterOfParameterThatBecomesPrivate2() +fun getAnnotationClassWithParameterOfParameterThatBecomesPrivate2AsAny(): Any = AnnotationClassWithParameterOfParameterThatBecomesPrivate2() +inline fun getAnnotationClassWithParameterOfParameterThatBecomesPrivate2AsAnyInline(): Any = AnnotationClassWithParameterOfParameterThatBecomesPrivate2() +fun getAnnotationClassWithParameterThatBecomesPrivate3(): AnnotationClassWithParameterThatBecomesPrivate3 = AnnotationClassWithParameterThatBecomesPrivate3() +inline fun getAnnotationClassWithParameterThatBecomesPrivate3Inline(): AnnotationClassWithParameterThatBecomesPrivate3 = AnnotationClassWithParameterThatBecomesPrivate3() +fun getAnnotationClassWithParameterThatBecomesPrivate3AsAny(): Any = AnnotationClassWithParameterThatBecomesPrivate3() +inline fun getAnnotationClassWithParameterThatBecomesPrivate3AsAnyInline(): Any = AnnotationClassWithParameterThatBecomesPrivate3() +fun getAnnotationClassWithParameterOfParameterThatBecomesPrivate3(): AnnotationClassWithParameterOfParameterThatBecomesPrivate3 = AnnotationClassWithParameterOfParameterThatBecomesPrivate3() +inline fun getAnnotationClassWithParameterOfParameterThatBecomesPrivate3Inline(): AnnotationClassWithParameterOfParameterThatBecomesPrivate3 = AnnotationClassWithParameterOfParameterThatBecomesPrivate3() +fun getAnnotationClassWithParameterOfParameterThatBecomesPrivate3AsAny(): Any = AnnotationClassWithParameterOfParameterThatBecomesPrivate3() +inline fun getAnnotationClassWithParameterOfParameterThatBecomesPrivate3AsAnyInline(): Any = AnnotationClassWithParameterOfParameterThatBecomesPrivate3() +fun getAnnotationClassWithParameterThatBecomesPrivate4(): AnnotationClassWithParameterThatBecomesPrivate4 = AnnotationClassWithParameterThatBecomesPrivate4() +inline fun getAnnotationClassWithParameterThatBecomesPrivate4Inline(): AnnotationClassWithParameterThatBecomesPrivate4 = AnnotationClassWithParameterThatBecomesPrivate4() +fun getAnnotationClassWithParameterThatBecomesPrivate4AsAny(): Any = AnnotationClassWithParameterThatBecomesPrivate4() +inline fun getAnnotationClassWithParameterThatBecomesPrivate4AsAnyInline(): Any = AnnotationClassWithParameterThatBecomesPrivate4() +fun getAnnotationClassWithParameterOfParameterThatBecomesPrivate4(): AnnotationClassWithParameterOfParameterThatBecomesPrivate4 = AnnotationClassWithParameterOfParameterThatBecomesPrivate4() +inline fun getAnnotationClassWithParameterOfParameterThatBecomesPrivate4Inline(): AnnotationClassWithParameterOfParameterThatBecomesPrivate4 = AnnotationClassWithParameterOfParameterThatBecomesPrivate4() +fun getAnnotationClassWithParameterOfParameterThatBecomesPrivate4AsAny(): Any = AnnotationClassWithParameterOfParameterThatBecomesPrivate4() +inline fun getAnnotationClassWithParameterOfParameterThatBecomesPrivate4AsAnyInline(): Any = AnnotationClassWithParameterOfParameterThatBecomesPrivate4() +fun getAnnotationClassWithParameterWithPrivateDefaultValue(): PublicTopLevelLib2.AnnotationClassWithParameterWithPrivateDefaultValue = PublicTopLevelLib2.AnnotationClassWithParameterWithPrivateDefaultValue() +inline fun getAnnotationClassWithParameterWithPrivateDefaultValueInline(): PublicTopLevelLib2.AnnotationClassWithParameterWithPrivateDefaultValue = PublicTopLevelLib2.AnnotationClassWithParameterWithPrivateDefaultValue() +fun getAnnotationClassWithParameterWithPrivateDefaultValueAsAny(): Any = PublicTopLevelLib2.AnnotationClassWithParameterWithPrivateDefaultValue() +inline fun getAnnotationClassWithParameterWithPrivateDefaultValueInlineAsAny(): Any = PublicTopLevelLib2.AnnotationClassWithParameterWithPrivateDefaultValue() +fun getAnnotationClassWithParameterOfParameterWithPrivateDefaultValue(): PublicTopLevelLib2.AnnotationClassWithParameterOfParameterWithPrivateDefaultValue = PublicTopLevelLib2.AnnotationClassWithParameterOfParameterWithPrivateDefaultValue() +inline fun getAnnotationClassWithParameterOfParameterWithPrivateDefaultValueInline(): PublicTopLevelLib2.AnnotationClassWithParameterOfParameterWithPrivateDefaultValue = PublicTopLevelLib2.AnnotationClassWithParameterOfParameterWithPrivateDefaultValue() +fun getAnnotationClassWithParameterOfParameterWithPrivateDefaultValueAsAny(): Any = PublicTopLevelLib2.AnnotationClassWithParameterOfParameterWithPrivateDefaultValue() +inline fun getAnnotationClassWithParameterOfParameterWithPrivateDefaultValueInlineAsAny(): Any = PublicTopLevelLib2.AnnotationClassWithParameterOfParameterWithPrivateDefaultValue() + @AnnotationClassWithChangedParameterType(1) class HolderOfAnnotationClassWithChangedParameterType { override fun toString() = "HolderOfAnnotationClassWithChangedParameterType" } @AnnotationClassThatBecomesRegularClass(2) class HolderOfAnnotationClassThatBecomesRegularClass { override fun toString() = "HolderOfAnnotationClassThatBecomesRegularClass" } @AnnotationClassWithParameterThatBecomesRegularClass(AnnotationClassThatBecomesRegularClass(3)) class HolderOfAnnotationClassWithParameterThatBecomesRegularClass { override fun toString() = "HolderOfAnnotationClassWithParameterThatBecomesRegularClass" } @@ -172,6 +278,27 @@ inline fun getAnnotationClassWithNewParameterAsAnyInline(): Any = AnnotationClas @AnnotationClassWithRenamedParameters(8, "Grape") class HolderOfAnnotationClassWithRenamedParameters { override fun toString() = "HolderOfAnnotationClassWithRenamedParameters" } @AnnotationClassWithReorderedParameters(9, "Figs") class HolderOfAnnotationClassWithReorderedParameters { override fun toString() = "HolderOfAnnotationClassWithReorderedParameters" } @AnnotationClassWithNewParameter(10) class HolderOfAnnotationClassWithNewParameter { override fun toString() = "HolderOfAnnotationClassWithNewParameter" } +@AnnotationClassWithClassReferenceParameterThatDisappears1(RemovedClass::class) class HolderOfAnnotationClassWithClassReferenceParameterThatDisappears1 { override fun toString() = "HolderOfAnnotationClassWithClassReferenceParameterThatDisappears1" } +@AnnotationClassWithClassReferenceParameterThatDisappears1() class HolderOfAnnotationClassWithDefaultClassReferenceParameterThatDisappears1 { override fun toString() = "HolderOfAnnotationClassWithDefaultClassReferenceParameterThatDisappears1" } +@AnnotationClassWithClassReferenceParameterThatDisappears2(RemovedClass::class) class HolderOfAnnotationClassWithClassReferenceParameterThatDisappears2 { override fun toString() = "HolderOfAnnotationClassWithClassReferenceParameterThatDisappears2" } +@AnnotationClassWithClassReferenceParameterThatDisappears2() class HolderOfAnnotationClassWithDefaultClassReferenceParameterThatDisappears2 { override fun toString() = "HolderOfAnnotationClassWithDefaultClassReferenceParameterThatDisappears2" } +@AnnotationClassWithClassReferenceParameterOfParameterThatDisappears1(AnnotationClassWithClassReferenceParameterThatDisappears1(RemovedClass::class)) class HolderOfAnnotationClassWithClassReferenceParameterOfParameterThatDisappears1 { override fun toString() = "HolderOfAnnotationClassWithClassReferenceParameterOfParameterThatDisappears1" } +@AnnotationClassWithClassReferenceParameterOfParameterThatDisappears1() class HolderOfAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears1 { override fun toString() = "HolderOfAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears1" } +@AnnotationClassWithClassReferenceParameterOfParameterThatDisappears2(AnnotationClassWithClassReferenceParameterThatDisappears2(RemovedClass::class)) class HolderOfAnnotationClassWithClassReferenceParameterOfParameterThatDisappears2 { override fun toString() = "HolderOfAnnotationClassWithClassReferenceParameterOfParameterThatDisappears2" } +@AnnotationClassWithClassReferenceParameterOfParameterThatDisappears2() class HolderOfAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears2 { override fun toString() = "HolderOfAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears2" } +@AnnotationClassWithRemovedEnumEntryParameter(EnumClassWithDisappearingEntry.REMOVED) class HolderOfAnnotationClassWithRemovedEnumEntryParameter { override fun toString() = "HolderOfAnnotationClassWithRemovedEnumEntryParameter" } +@AnnotationClassWithRemovedEnumEntryParameter() class HolderOfAnnotationClassWithDefaultRemovedEnumEntryParameter { override fun toString() = "HolderOfAnnotationClassWithDefaultRemovedEnumEntryParameter" } +@AnnotationClassWithRemovedEnumEntryParameterOfParameter(AnnotationClassWithRemovedEnumEntryParameter(EnumClassWithDisappearingEntry.REMOVED)) class HolderOfAnnotationClassWithRemovedEnumEntryParameterOfParameter { override fun toString() = "HolderOfAnnotationClassWithRemovedEnumEntryParameterOfParameter" } +@AnnotationClassWithRemovedEnumEntryParameterOfParameter() class HolderOfAnnotationClassWithDefaultRemovedEnumEntryParameterOfParameter { override fun toString() = "HolderOfAnnotationClassWithDefaultRemovedEnumEntryParameterOfParameter" } +@AnnotationClassWithParameterThatBecomesPrivate1 class HolderOfAnnotationClassWithParameterThatBecomesPrivate1 { override fun toString() = "HolderOfAnnotationClassWithParameterThatBecomesPrivate1" } +@AnnotationClassWithParameterThatBecomesPrivate2 class HolderOfAnnotationClassWithParameterThatBecomesPrivate2 { override fun toString() = "HolderOfAnnotationClassWithParameterThatBecomesPrivate2" } +@AnnotationClassWithParameterOfParameterThatBecomesPrivate2 class HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate2 { override fun toString() = "HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate2" } +@AnnotationClassWithParameterThatBecomesPrivate3 class HolderOfAnnotationClassWithParameterThatBecomesPrivate3 { override fun toString() = "HolderOfAnnotationClassWithParameterThatBecomesPrivate3" } +@AnnotationClassWithParameterOfParameterThatBecomesPrivate3 class HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate3 { override fun toString() = "HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate3" } +@AnnotationClassWithParameterThatBecomesPrivate4 class HolderOfAnnotationClassWithParameterThatBecomesPrivate4 { override fun toString() = "HolderOfAnnotationClassWithParameterThatBecomesPrivate4" } +@AnnotationClassWithParameterOfParameterThatBecomesPrivate4 class HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate4 { override fun toString() = "HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate4" } +@PublicTopLevelLib2.AnnotationClassWithParameterWithPrivateDefaultValue class HolderOfAnnotationClassWithParameterWithPrivateDefaultValue { override fun toString() = "HolderOfAnnotationClassWithParameterWithPrivateDefaultValue" } +@PublicTopLevelLib2.AnnotationClassWithParameterOfParameterWithPrivateDefaultValue class HolderOfAnnotationClassWithParameterOfParameterWithPrivateDefaultValue { override fun toString() = "HolderOfAnnotationClassWithParameterOfParameterWithPrivateDefaultValue" } fun getHolderOfAnnotationClassWithChangedParameterType() = HolderOfAnnotationClassWithChangedParameterType() inline fun getHolderOfAnnotationClassWithChangedParameterTypeInline() = HolderOfAnnotationClassWithChangedParameterType() @@ -193,6 +320,48 @@ fun getHolderOfAnnotationClassWithReorderedParameters() = HolderOfAnnotationClas inline fun getHolderOfAnnotationClassWithReorderedParametersInline() = HolderOfAnnotationClassWithReorderedParameters() fun getHolderOfAnnotationClassWithNewParameter() = HolderOfAnnotationClassWithNewParameter() inline fun getHolderOfAnnotationClassWithNewParameterInline() = HolderOfAnnotationClassWithNewParameter() +fun getHolderOfAnnotationClassWithClassReferenceParameterThatDisappears1() = HolderOfAnnotationClassWithClassReferenceParameterThatDisappears1() +inline fun getHolderOfAnnotationClassWithClassReferenceParameterThatDisappears1Inline() = HolderOfAnnotationClassWithClassReferenceParameterThatDisappears1() +fun getHolderOfAnnotationClassWithDefaultClassReferenceParameterThatDisappears1() = HolderOfAnnotationClassWithDefaultClassReferenceParameterThatDisappears1() +inline fun getHolderOfAnnotationClassWithDefaultClassReferenceParameterThatDisappears1Inline() = HolderOfAnnotationClassWithDefaultClassReferenceParameterThatDisappears1() +fun getHolderOfAnnotationClassWithClassReferenceParameterThatDisappears2() = HolderOfAnnotationClassWithClassReferenceParameterThatDisappears2() +inline fun getHolderOfAnnotationClassWithClassReferenceParameterThatDisappears2Inline() = HolderOfAnnotationClassWithClassReferenceParameterThatDisappears2() +fun getHolderOfAnnotationClassWithDefaultClassReferenceParameterThatDisappears2() = HolderOfAnnotationClassWithDefaultClassReferenceParameterThatDisappears2() +inline fun getHolderOfAnnotationClassWithDefaultClassReferenceParameterThatDisappears2Inline() = HolderOfAnnotationClassWithDefaultClassReferenceParameterThatDisappears2() +fun getHolderOfAnnotationClassWithClassReferenceParameterOfParameterThatDisappears1() = HolderOfAnnotationClassWithClassReferenceParameterOfParameterThatDisappears1() +inline fun getHolderOfAnnotationClassWithClassReferenceParameterOfParameterThatDisappears1Inline() = HolderOfAnnotationClassWithClassReferenceParameterOfParameterThatDisappears1() +fun getHolderOfAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears1() = HolderOfAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears1() +inline fun getHolderOfAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears1Inline() = HolderOfAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears1() +fun getHolderOfAnnotationClassWithClassReferenceParameterOfParameterThatDisappears2() = HolderOfAnnotationClassWithClassReferenceParameterOfParameterThatDisappears2() +inline fun getHolderOfAnnotationClassWithClassReferenceParameterOfParameterThatDisappears2Inline() = HolderOfAnnotationClassWithClassReferenceParameterOfParameterThatDisappears2() +fun getHolderOfAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears2() = HolderOfAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears2() +inline fun getHolderOfAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears2Inline() = HolderOfAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears2() +fun getHolderOfAnnotationClassWithRemovedEnumEntryParameter() = HolderOfAnnotationClassWithRemovedEnumEntryParameter() +inline fun getHolderOfAnnotationClassWithRemovedEnumEntryParameterInline() = HolderOfAnnotationClassWithRemovedEnumEntryParameter() +fun getHolderOfAnnotationClassWithDefaultRemovedEnumEntryParameter() = HolderOfAnnotationClassWithDefaultRemovedEnumEntryParameter() +inline fun getHolderOfAnnotationClassWithDefaultRemovedEnumEntryParameterInline() = HolderOfAnnotationClassWithDefaultRemovedEnumEntryParameter() +fun getHolderOfAnnotationClassWithRemovedEnumEntryParameterOfParameter() = HolderOfAnnotationClassWithRemovedEnumEntryParameterOfParameter() +inline fun getHolderOfAnnotationClassWithRemovedEnumEntryParameterOfParameterInline() = HolderOfAnnotationClassWithRemovedEnumEntryParameterOfParameter() +fun getHolderOfAnnotationClassWithDefaultRemovedEnumEntryParameterOfParameter() = HolderOfAnnotationClassWithDefaultRemovedEnumEntryParameterOfParameter() +inline fun getHolderOfAnnotationClassWithDefaultRemovedEnumEntryParameterOfParameterInline() = HolderOfAnnotationClassWithDefaultRemovedEnumEntryParameterOfParameter() +fun getHolderOfAnnotationClassWithParameterThatBecomesPrivate1(): HolderOfAnnotationClassWithParameterThatBecomesPrivate1 = HolderOfAnnotationClassWithParameterThatBecomesPrivate1() +inline fun getHolderOfAnnotationClassWithParameterThatBecomesPrivate1Inline(): HolderOfAnnotationClassWithParameterThatBecomesPrivate1 = HolderOfAnnotationClassWithParameterThatBecomesPrivate1() +fun getHolderOfAnnotationClassWithParameterThatBecomesPrivate2(): HolderOfAnnotationClassWithParameterThatBecomesPrivate2 = HolderOfAnnotationClassWithParameterThatBecomesPrivate2() +inline fun getHolderOfAnnotationClassWithParameterThatBecomesPrivate2Inline(): HolderOfAnnotationClassWithParameterThatBecomesPrivate2 = HolderOfAnnotationClassWithParameterThatBecomesPrivate2() +fun getHolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate2(): HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate2 = HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate2() +inline fun getHolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate2Inline(): HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate2 = HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate2() +fun getHolderOfAnnotationClassWithParameterThatBecomesPrivate3(): HolderOfAnnotationClassWithParameterThatBecomesPrivate3 = HolderOfAnnotationClassWithParameterThatBecomesPrivate3() +inline fun getHolderOfAnnotationClassWithParameterThatBecomesPrivate3Inline(): HolderOfAnnotationClassWithParameterThatBecomesPrivate3 = HolderOfAnnotationClassWithParameterThatBecomesPrivate3() +fun getHolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate3(): HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate3 = HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate3() +inline fun getHolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate3Inline(): HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate3 = HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate3() +fun getHolderOfAnnotationClassWithParameterThatBecomesPrivate4(): HolderOfAnnotationClassWithParameterThatBecomesPrivate4 = HolderOfAnnotationClassWithParameterThatBecomesPrivate4() +inline fun getHolderOfAnnotationClassWithParameterThatBecomesPrivate4Inline(): HolderOfAnnotationClassWithParameterThatBecomesPrivate4 = HolderOfAnnotationClassWithParameterThatBecomesPrivate4() +fun getHolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate4(): HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate4 = HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate4() +inline fun getHolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate4Inline(): HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate4 = HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate4() +fun getHolderOfAnnotationClassWithParameterWithPrivateDefaultValue(): HolderOfAnnotationClassWithParameterWithPrivateDefaultValue = HolderOfAnnotationClassWithParameterWithPrivateDefaultValue() +inline fun getHolderOfAnnotationClassWithParameterWithPrivateDefaultValueInline(): HolderOfAnnotationClassWithParameterWithPrivateDefaultValue = HolderOfAnnotationClassWithParameterWithPrivateDefaultValue() +fun getHolderOfAnnotationClassWithParameterOfParameterWithPrivateDefaultValue(): HolderOfAnnotationClassWithParameterOfParameterWithPrivateDefaultValue = HolderOfAnnotationClassWithParameterOfParameterWithPrivateDefaultValue() +inline fun getHolderOfAnnotationClassWithParameterOfParameterWithPrivateDefaultValueInline(): HolderOfAnnotationClassWithParameterOfParameterWithPrivateDefaultValue = HolderOfAnnotationClassWithParameterOfParameterWithPrivateDefaultValue() fun getValueToClass(): ValueToClass = ValueToClass(1) inline fun getValueToClassInline(): ValueToClass = ValueToClass(2) diff --git a/compiler/testData/klibABI/classTransformations/main/m.kt b/compiler/testData/klibABI/classTransformations/main/m.kt index d7830f27100..99dd61bdcb0 100644 --- a/compiler/testData/klibABI/classTransformations/main/m.kt +++ b/compiler/testData/klibABI/classTransformations/main/m.kt @@ -17,7 +17,10 @@ fun box() = abiTest { * * The [adjustForLazyIr] function is used to adjust tested error messages depending on whether lazy IR is used or not. */ - fun adjustForLazyIr(declaration: String) = if (testMode == NATIVE_CACHE_STATIC_EVERYWHERE) "Expression" else declaration + fun adjustForLazyIr(declaration: String) = + if (testMode == NATIVE_CACHE_STATIC_EVERYWHERE) "Expression" else declaration + fun adjustNoClassFoundForLazyIr(signature: String) = + if (testMode == NATIVE_CACHE_STATIC_EVERYWHERE) "Expression uses unlinked class symbol '$signature'" else "No class found for symbol '$signature'" expectFailure(linkage("Function 'getClassToEnumFoo' can not be called: ${adjustForLazyIr("Function")} uses unlinked class symbol '/ClassToEnum.Foo'")) { getClassToEnumFoo() } expectFailure(linkage("Function 'getClassToEnumFooInline' can not be called: ${adjustForLazyIr("Function")} uses unlinked class symbol '/ClassToEnum.Foo'")) { getClassToEnumFooInline() } @@ -169,6 +172,90 @@ fun box() = abiTest { expectFailure(linkage("Constructor 'AnnotationClassWithNewParameter.' can not be called: No constructor found for symbol '/AnnotationClassWithNewParameter.'")) { getAnnotationClassWithNewParameterInline() } expectFailure(linkage("Constructor 'AnnotationClassWithNewParameter.' can not be called: No constructor found for symbol '/AnnotationClassWithNewParameter.'")) { getAnnotationClassWithNewParameterAsAny() } expectFailure(linkage("Constructor 'AnnotationClassWithNewParameter.' can not be called: No constructor found for symbol '/AnnotationClassWithNewParameter.'")) { getAnnotationClassWithNewParameterAsAnyInline() } + expectFailure(linkage("Function 'getAnnotationClassWithClassReferenceParameterThatDisappears1' can not be called: Function uses unlinked class symbol '/RemovedClass' (via annotation class 'AnnotationClassWithClassReferenceParameterThatDisappears1')")) { getAnnotationClassWithClassReferenceParameterThatDisappears1() } + expectFailure(linkage("Function 'getAnnotationClassWithClassReferenceParameterThatDisappears1Inline' can not be called: Function uses unlinked class symbol '/RemovedClass' (via annotation class 'AnnotationClassWithClassReferenceParameterThatDisappears1')")) { getAnnotationClassWithClassReferenceParameterThatDisappears1Inline() } + expectFailure(linkage("Reference to class 'RemovedClass' can not be evaluated: No class found for symbol '/RemovedClass'")) { getAnnotationClassWithClassReferenceParameterThatDisappears1AsAny() } + expectFailure(linkage("Reference to class 'RemovedClass' can not be evaluated: ${adjustNoClassFoundForLazyIr("/RemovedClass")}")) { getAnnotationClassWithClassReferenceParameterThatDisappears1AsAnyInline() } + expectFailure(linkage("Function 'getAnnotationClassWithDefaultClassReferenceParameterThatDisappears1' can not be called: Function uses unlinked class symbol '/RemovedClass' (via annotation class 'AnnotationClassWithClassReferenceParameterThatDisappears1')")) { getAnnotationClassWithDefaultClassReferenceParameterThatDisappears1() } + expectFailure(linkage("Function 'getAnnotationClassWithDefaultClassReferenceParameterThatDisappears1Inline' can not be called: Function uses unlinked class symbol '/RemovedClass' (via annotation class 'AnnotationClassWithClassReferenceParameterThatDisappears1')")) { getAnnotationClassWithDefaultClassReferenceParameterThatDisappears1Inline() } + expectFailure(linkage("Constructor 'AnnotationClassWithClassReferenceParameterThatDisappears1.' can not be called: Constructor uses unlinked class symbol '/RemovedClass'")) { getAnnotationClassWithDefaultClassReferenceParameterThatDisappears1AsAny() } + expectFailure(linkage("Constructor 'AnnotationClassWithClassReferenceParameterThatDisappears1.' can not be called: Constructor uses unlinked class symbol '/RemovedClass'")) { getAnnotationClassWithDefaultClassReferenceParameterThatDisappears1AsAnyInline() } + expectFailure(linkage("Reference to class 'RemovedClass' can not be evaluated: No class found for symbol '/RemovedClass'")) { getAnnotationClassWithClassReferenceParameterThatDisappears2() } + expectFailure(linkage("Reference to class 'RemovedClass' can not be evaluated: ${adjustNoClassFoundForLazyIr("/RemovedClass")}")) { getAnnotationClassWithClassReferenceParameterThatDisappears2Inline() } + expectFailure(linkage("Reference to class 'RemovedClass' can not be evaluated: No class found for symbol '/RemovedClass'")) { getAnnotationClassWithClassReferenceParameterThatDisappears2AsAny() } + expectFailure(linkage("Reference to class 'RemovedClass' can not be evaluated: ${adjustNoClassFoundForLazyIr("/RemovedClass")}")) { getAnnotationClassWithClassReferenceParameterThatDisappears2AsAnyInline() } + expectFailure(linkage("Reference to class 'RemovedClass' can not be evaluated: No class found for symbol '/RemovedClass'")) { getAnnotationClassWithDefaultClassReferenceParameterThatDisappears2() } + expectFailure(linkage("Reference to class 'RemovedClass' can not be evaluated: No class found for symbol '/RemovedClass'")) { getAnnotationClassWithDefaultClassReferenceParameterThatDisappears2Inline() } + expectFailure(linkage("Reference to class 'RemovedClass' can not be evaluated: No class found for symbol '/RemovedClass'")) { getAnnotationClassWithDefaultClassReferenceParameterThatDisappears2AsAny() } + expectFailure(linkage("Reference to class 'RemovedClass' can not be evaluated: No class found for symbol '/RemovedClass'")) { getAnnotationClassWithDefaultClassReferenceParameterThatDisappears2AsAnyInline() } + expectFailure(linkage("Function 'getAnnotationClassWithClassReferenceParameterOfParameterThatDisappears1' can not be called: Function uses unlinked class symbol '/RemovedClass' (via annotation class 'AnnotationClassWithClassReferenceParameterOfParameterThatDisappears1')")) { getAnnotationClassWithClassReferenceParameterOfParameterThatDisappears1() } + expectFailure(linkage("Function 'getAnnotationClassWithClassReferenceParameterOfParameterThatDisappears1Inline' can not be called: Function uses unlinked class symbol '/RemovedClass' (via annotation class 'AnnotationClassWithClassReferenceParameterOfParameterThatDisappears1')")) { getAnnotationClassWithClassReferenceParameterOfParameterThatDisappears1Inline() } + expectFailure(linkage("Reference to class 'RemovedClass' can not be evaluated: No class found for symbol '/RemovedClass'")) { getAnnotationClassWithClassReferenceParameterOfParameterThatDisappears1AsAny() } + expectFailure(linkage("Reference to class 'RemovedClass' can not be evaluated: ${adjustNoClassFoundForLazyIr("/RemovedClass")}")) { getAnnotationClassWithClassReferenceParameterOfParameterThatDisappears1AsAnyInline() } + expectFailure(linkage("Function 'getAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears1' can not be called: Function uses unlinked class symbol '/RemovedClass' (via annotation class 'AnnotationClassWithClassReferenceParameterOfParameterThatDisappears1')")) { getAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears1() } + expectFailure(linkage("Function 'getAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears1Inline' can not be called: Function uses unlinked class symbol '/RemovedClass' (via annotation class 'AnnotationClassWithClassReferenceParameterOfParameterThatDisappears1')")) { getAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears1Inline() } + expectFailure(linkage("Constructor 'AnnotationClassWithClassReferenceParameterOfParameterThatDisappears1.' can not be called: Constructor uses unlinked class symbol '/RemovedClass' (via annotation class 'AnnotationClassWithClassReferenceParameterThatDisappears1')")) { getAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears1AsAny() } + expectFailure(linkage("Constructor 'AnnotationClassWithClassReferenceParameterOfParameterThatDisappears1.' can not be called: Constructor uses unlinked class symbol '/RemovedClass' (via annotation class 'AnnotationClassWithClassReferenceParameterThatDisappears1')")) { getAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears1AsAnyInline() } + expectFailure(linkage("Reference to class 'RemovedClass' can not be evaluated: No class found for symbol '/RemovedClass'")) { getAnnotationClassWithClassReferenceParameterOfParameterThatDisappears2() } + expectFailure(linkage("Reference to class 'RemovedClass' can not be evaluated: ${adjustNoClassFoundForLazyIr("/RemovedClass")}")) { getAnnotationClassWithClassReferenceParameterOfParameterThatDisappears2Inline() } + expectFailure(linkage("Reference to class 'RemovedClass' can not be evaluated: No class found for symbol '/RemovedClass'")) { getAnnotationClassWithClassReferenceParameterOfParameterThatDisappears2AsAny() } + expectFailure(linkage("Reference to class 'RemovedClass' can not be evaluated: ${adjustNoClassFoundForLazyIr("/RemovedClass")}")) { getAnnotationClassWithClassReferenceParameterOfParameterThatDisappears2AsAnyInline() } + expectFailure(linkage("Reference to class 'RemovedClass' can not be evaluated: No class found for symbol '/RemovedClass'")) { getAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears2() } + expectFailure(linkage("Reference to class 'RemovedClass' can not be evaluated: No class found for symbol '/RemovedClass'")) { getAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears2Inline() } + expectFailure(linkage("Reference to class 'RemovedClass' can not be evaluated: No class found for symbol '/RemovedClass'")) { getAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears2AsAny() } + expectFailure(linkage("Reference to class 'RemovedClass' can not be evaluated: No class found for symbol '/RemovedClass'")) { getAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears2AsAnyInline() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassWithDisappearingEntry.REMOVED': No enum entry found for symbol '/EnumClassWithDisappearingEntry.REMOVED'")) { getAnnotationClassWithRemovedEnumEntryParameter() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassWithDisappearingEntry.REMOVED': No enum entry found for symbol '/EnumClassWithDisappearingEntry.REMOVED'")) { getAnnotationClassWithRemovedEnumEntryParameterInline() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassWithDisappearingEntry.REMOVED': No enum entry found for symbol '/EnumClassWithDisappearingEntry.REMOVED'")) { getAnnotationClassWithRemovedEnumEntryParameterAsAny() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassWithDisappearingEntry.REMOVED': No enum entry found for symbol '/EnumClassWithDisappearingEntry.REMOVED'")) { getAnnotationClassWithRemovedEnumEntryParameterAsAnyInline() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassWithDisappearingEntry.REMOVED': No enum entry found for symbol '/EnumClassWithDisappearingEntry.REMOVED'")) { getAnnotationClassWithDefaultRemovedEnumEntryParameter() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassWithDisappearingEntry.REMOVED': No enum entry found for symbol '/EnumClassWithDisappearingEntry.REMOVED'")) { getAnnotationClassWithDefaultRemovedEnumEntryParameterInline() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassWithDisappearingEntry.REMOVED': No enum entry found for symbol '/EnumClassWithDisappearingEntry.REMOVED'")) { getAnnotationClassWithDefaultRemovedEnumEntryParameterAsAny() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassWithDisappearingEntry.REMOVED': No enum entry found for symbol '/EnumClassWithDisappearingEntry.REMOVED'")) { getAnnotationClassWithDefaultRemovedEnumEntryParameterAsAnyInline() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassWithDisappearingEntry.REMOVED': No enum entry found for symbol '/EnumClassWithDisappearingEntry.REMOVED'")) { getAnnotationClassWithRemovedEnumEntryParameterOfParameter() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassWithDisappearingEntry.REMOVED': No enum entry found for symbol '/EnumClassWithDisappearingEntry.REMOVED'")) { getAnnotationClassWithRemovedEnumEntryParameterOfParameterInline() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassWithDisappearingEntry.REMOVED': No enum entry found for symbol '/EnumClassWithDisappearingEntry.REMOVED'")) { getAnnotationClassWithRemovedEnumEntryParameterOfParameterAsAny() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassWithDisappearingEntry.REMOVED': No enum entry found for symbol '/EnumClassWithDisappearingEntry.REMOVED'")) { getAnnotationClassWithRemovedEnumEntryParameterOfParameterAsAnyInline() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassWithDisappearingEntry.REMOVED': No enum entry found for symbol '/EnumClassWithDisappearingEntry.REMOVED'")) { getAnnotationClassWithDefaultRemovedEnumEntryParameterOfParameter() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassWithDisappearingEntry.REMOVED': No enum entry found for symbol '/EnumClassWithDisappearingEntry.REMOVED'")) { getAnnotationClassWithDefaultRemovedEnumEntryParameterOfParameterInline() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassWithDisappearingEntry.REMOVED': No enum entry found for symbol '/EnumClassWithDisappearingEntry.REMOVED'")) { getAnnotationClassWithDefaultRemovedEnumEntryParameterOfParameterAsAny() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassWithDisappearingEntry.REMOVED': No enum entry found for symbol '/EnumClassWithDisappearingEntry.REMOVED'")) { getAnnotationClassWithDefaultRemovedEnumEntryParameterOfParameterAsAnyInline() } + expectFailure(linkage("Constructor 'AnnotationClassThatBecomesPrivate.' can not be called: Private constructor declared in module can not be accessed in module ")) { getAnnotationClassWithParameterThatBecomesPrivate1() } + expectFailure(linkage("Constructor 'AnnotationClassThatBecomesPrivate.' can not be called: Private constructor declared in module can not be accessed in module ")) { getAnnotationClassWithParameterThatBecomesPrivate1Inline() } + expectFailure(linkage("Constructor 'AnnotationClassThatBecomesPrivate.' can not be called: Private constructor declared in module can not be accessed in module ")) { getAnnotationClassWithParameterThatBecomesPrivate1AsAny() } + expectFailure(linkage("Constructor 'AnnotationClassThatBecomesPrivate.' can not be called: Private constructor declared in module can not be accessed in module ")) { getAnnotationClassWithParameterThatBecomesPrivate1AsAnyInline() } + expectFailure(linkage("Reference to class 'ClassThatBecomesPrivate' can not be evaluated: Private class declared in module can not be accessed in module ")) { getAnnotationClassWithParameterThatBecomesPrivate2() } + expectFailure(linkage("Reference to class 'ClassThatBecomesPrivate' can not be evaluated: Private class declared in module can not be accessed in module ")) { getAnnotationClassWithParameterThatBecomesPrivate2Inline() } + expectFailure(linkage("Reference to class 'ClassThatBecomesPrivate' can not be evaluated: Private class declared in module can not be accessed in module ")) { getAnnotationClassWithParameterThatBecomesPrivate2AsAny() } + expectFailure(linkage("Reference to class 'ClassThatBecomesPrivate' can not be evaluated: Private class declared in module can not be accessed in module ")) { getAnnotationClassWithParameterThatBecomesPrivate2AsAnyInline() } + expectFailure(linkage("Reference to class 'ClassThatBecomesPrivate' can not be evaluated: Private class declared in module can not be accessed in module ")) { getAnnotationClassWithParameterOfParameterThatBecomesPrivate2() } + expectFailure(linkage("Reference to class 'ClassThatBecomesPrivate' can not be evaluated: Private class declared in module can not be accessed in module ")) { getAnnotationClassWithParameterOfParameterThatBecomesPrivate2Inline() } + expectFailure(linkage("Reference to class 'ClassThatBecomesPrivate' can not be evaluated: Private class declared in module can not be accessed in module ")) { getAnnotationClassWithParameterOfParameterThatBecomesPrivate2AsAny() } + expectFailure(linkage("Reference to class 'ClassThatBecomesPrivate' can not be evaluated: Private class declared in module can not be accessed in module ")) { getAnnotationClassWithParameterOfParameterThatBecomesPrivate2AsAnyInline() } + expectFailure(linkage("Reference to class 'ClassThatBecomesPrivate' can not be evaluated: Private class declared in module can not be accessed in module ")) { getAnnotationClassWithParameterThatBecomesPrivate3() } + expectFailure(linkage("Reference to class 'ClassThatBecomesPrivate' can not be evaluated: Private class declared in module can not be accessed in module ")) { getAnnotationClassWithParameterThatBecomesPrivate3Inline() } + expectFailure(linkage("Reference to class 'ClassThatBecomesPrivate' can not be evaluated: Private class declared in module can not be accessed in module ")) { getAnnotationClassWithParameterThatBecomesPrivate3AsAny() } + expectFailure(linkage("Reference to class 'ClassThatBecomesPrivate' can not be evaluated: Private class declared in module can not be accessed in module ")) { getAnnotationClassWithParameterThatBecomesPrivate3AsAnyInline() } + expectFailure(linkage("Reference to class 'ClassThatBecomesPrivate' can not be evaluated: Private class declared in module can not be accessed in module ")) { getAnnotationClassWithParameterOfParameterThatBecomesPrivate3() } + expectFailure(linkage("Reference to class 'ClassThatBecomesPrivate' can not be evaluated: Private class declared in module can not be accessed in module ")) { getAnnotationClassWithParameterOfParameterThatBecomesPrivate3Inline() } + expectFailure(linkage("Reference to class 'ClassThatBecomesPrivate' can not be evaluated: Private class declared in module can not be accessed in module ")) { getAnnotationClassWithParameterOfParameterThatBecomesPrivate3AsAny() } + expectFailure(linkage("Reference to class 'ClassThatBecomesPrivate' can not be evaluated: Private class declared in module can not be accessed in module ")) { getAnnotationClassWithParameterOfParameterThatBecomesPrivate3AsAnyInline() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassThatBecomesPrivate.ENTRY': Private enum entry declared in module can not be accessed in module ")) { getAnnotationClassWithParameterThatBecomesPrivate4().toString() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassThatBecomesPrivate.ENTRY': Private enum entry declared in module can not be accessed in module ")) { getAnnotationClassWithParameterThatBecomesPrivate4Inline().toString() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassThatBecomesPrivate.ENTRY': Private enum entry declared in module can not be accessed in module ")) { getAnnotationClassWithParameterThatBecomesPrivate4AsAny().toString() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassThatBecomesPrivate.ENTRY': Private enum entry declared in module can not be accessed in module ")) { getAnnotationClassWithParameterThatBecomesPrivate4AsAnyInline().toString() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassThatBecomesPrivate.ENTRY': Private enum entry declared in module can not be accessed in module ")) { getAnnotationClassWithParameterOfParameterThatBecomesPrivate4().toString() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassThatBecomesPrivate.ENTRY': Private enum entry declared in module can not be accessed in module ")) { getAnnotationClassWithParameterOfParameterThatBecomesPrivate4Inline().toString() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassThatBecomesPrivate.ENTRY': Private enum entry declared in module can not be accessed in module ")) { getAnnotationClassWithParameterOfParameterThatBecomesPrivate4AsAny().toString() } + expectFailure(linkage("Can not get instance of singleton 'EnumClassThatBecomesPrivate.ENTRY': Private enum entry declared in module can not be accessed in module ")) { getAnnotationClassWithParameterOfParameterThatBecomesPrivate4AsAnyInline().toString() } + expectSuccess { getAnnotationClassWithParameterWithPrivateDefaultValue(); "OK" } + expectSuccess { getAnnotationClassWithParameterWithPrivateDefaultValueInline(); "OK" } + expectSuccess { getAnnotationClassWithParameterWithPrivateDefaultValueAsAny(); "OK" } + expectSuccess { getAnnotationClassWithParameterWithPrivateDefaultValueInlineAsAny(); "OK" } + expectSuccess { getAnnotationClassWithParameterOfParameterWithPrivateDefaultValue(); "OK" } + expectSuccess { getAnnotationClassWithParameterOfParameterWithPrivateDefaultValueInline(); "OK" } + expectSuccess { getAnnotationClassWithParameterOfParameterWithPrivateDefaultValueAsAny(); "OK" } + expectSuccess { getAnnotationClassWithParameterOfParameterWithPrivateDefaultValueInlineAsAny(); "OK" } // Handle unlinked constructor call in annotation & non-annotation class appearing in annotation: expectSuccess("HolderOfAnnotationClassWithChangedParameterType") { getHolderOfAnnotationClassWithChangedParameterType().toString() } @@ -191,6 +278,48 @@ fun box() = abiTest { expectSuccess("HolderOfAnnotationClassWithReorderedParameters") { getHolderOfAnnotationClassWithReorderedParametersInline().toString() } expectSuccess("HolderOfAnnotationClassWithNewParameter") { getHolderOfAnnotationClassWithNewParameter().toString() } expectSuccess("HolderOfAnnotationClassWithNewParameter") { getHolderOfAnnotationClassWithNewParameterInline().toString() } + expectSuccess("HolderOfAnnotationClassWithClassReferenceParameterThatDisappears1") { getHolderOfAnnotationClassWithClassReferenceParameterThatDisappears1().toString() } + expectSuccess("HolderOfAnnotationClassWithClassReferenceParameterThatDisappears1") { getHolderOfAnnotationClassWithClassReferenceParameterThatDisappears1Inline().toString() } + expectSuccess("HolderOfAnnotationClassWithDefaultClassReferenceParameterThatDisappears1") { getHolderOfAnnotationClassWithDefaultClassReferenceParameterThatDisappears1().toString() } + expectSuccess("HolderOfAnnotationClassWithDefaultClassReferenceParameterThatDisappears1") { getHolderOfAnnotationClassWithDefaultClassReferenceParameterThatDisappears1Inline().toString() } + expectSuccess("HolderOfAnnotationClassWithClassReferenceParameterThatDisappears2") { getHolderOfAnnotationClassWithClassReferenceParameterThatDisappears2().toString() } + expectSuccess("HolderOfAnnotationClassWithClassReferenceParameterThatDisappears2") { getHolderOfAnnotationClassWithClassReferenceParameterThatDisappears2Inline().toString() } + expectSuccess("HolderOfAnnotationClassWithDefaultClassReferenceParameterThatDisappears2") { getHolderOfAnnotationClassWithDefaultClassReferenceParameterThatDisappears2().toString() } + expectSuccess("HolderOfAnnotationClassWithDefaultClassReferenceParameterThatDisappears2") { getHolderOfAnnotationClassWithDefaultClassReferenceParameterThatDisappears2Inline().toString() } + expectSuccess("HolderOfAnnotationClassWithClassReferenceParameterOfParameterThatDisappears1") { getHolderOfAnnotationClassWithClassReferenceParameterOfParameterThatDisappears1().toString() } + expectSuccess("HolderOfAnnotationClassWithClassReferenceParameterOfParameterThatDisappears1") { getHolderOfAnnotationClassWithClassReferenceParameterOfParameterThatDisappears1Inline().toString() } + expectSuccess("HolderOfAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears1") { getHolderOfAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears1().toString() } + expectSuccess("HolderOfAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears1") { getHolderOfAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears1Inline().toString() } + expectSuccess("HolderOfAnnotationClassWithClassReferenceParameterOfParameterThatDisappears2") { getHolderOfAnnotationClassWithClassReferenceParameterOfParameterThatDisappears2().toString() } + expectSuccess("HolderOfAnnotationClassWithClassReferenceParameterOfParameterThatDisappears2") { getHolderOfAnnotationClassWithClassReferenceParameterOfParameterThatDisappears2Inline().toString() } + expectSuccess("HolderOfAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears2") { getHolderOfAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears2().toString() } + expectSuccess("HolderOfAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears2") { getHolderOfAnnotationClassWithDefaultClassReferenceParameterOfParameterThatDisappears2Inline().toString() } + expectSuccess("HolderOfAnnotationClassWithRemovedEnumEntryParameter") { getHolderOfAnnotationClassWithRemovedEnumEntryParameter().toString() } + expectSuccess("HolderOfAnnotationClassWithRemovedEnumEntryParameter") { getHolderOfAnnotationClassWithRemovedEnumEntryParameterInline().toString() } + expectSuccess("HolderOfAnnotationClassWithDefaultRemovedEnumEntryParameter") { getHolderOfAnnotationClassWithDefaultRemovedEnumEntryParameter().toString() } + expectSuccess("HolderOfAnnotationClassWithDefaultRemovedEnumEntryParameter") { getHolderOfAnnotationClassWithDefaultRemovedEnumEntryParameterInline().toString() } + expectSuccess("HolderOfAnnotationClassWithRemovedEnumEntryParameterOfParameter") { getHolderOfAnnotationClassWithRemovedEnumEntryParameterOfParameter().toString() } + expectSuccess("HolderOfAnnotationClassWithRemovedEnumEntryParameterOfParameter") { getHolderOfAnnotationClassWithRemovedEnumEntryParameterOfParameterInline().toString() } + expectSuccess("HolderOfAnnotationClassWithDefaultRemovedEnumEntryParameterOfParameter") { getHolderOfAnnotationClassWithDefaultRemovedEnumEntryParameterOfParameter().toString() } + expectSuccess("HolderOfAnnotationClassWithDefaultRemovedEnumEntryParameterOfParameter") { getHolderOfAnnotationClassWithDefaultRemovedEnumEntryParameterOfParameterInline().toString() } + expectSuccess("HolderOfAnnotationClassWithParameterThatBecomesPrivate1") { getHolderOfAnnotationClassWithParameterThatBecomesPrivate1().toString() } + expectSuccess("HolderOfAnnotationClassWithParameterThatBecomesPrivate1") { getHolderOfAnnotationClassWithParameterThatBecomesPrivate1Inline().toString() } + expectSuccess("HolderOfAnnotationClassWithParameterThatBecomesPrivate2") { getHolderOfAnnotationClassWithParameterThatBecomesPrivate2().toString() } + expectSuccess("HolderOfAnnotationClassWithParameterThatBecomesPrivate2") { getHolderOfAnnotationClassWithParameterThatBecomesPrivate2Inline().toString() } + expectSuccess("HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate2") { getHolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate2().toString() } + expectSuccess("HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate2") { getHolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate2Inline().toString() } + expectSuccess("HolderOfAnnotationClassWithParameterThatBecomesPrivate3") { getHolderOfAnnotationClassWithParameterThatBecomesPrivate3().toString() } + expectSuccess("HolderOfAnnotationClassWithParameterThatBecomesPrivate3") { getHolderOfAnnotationClassWithParameterThatBecomesPrivate3Inline().toString() } + expectSuccess("HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate3") { getHolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate3().toString() } + expectSuccess("HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate3") { getHolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate3Inline().toString() } + expectSuccess("HolderOfAnnotationClassWithParameterThatBecomesPrivate4") { getHolderOfAnnotationClassWithParameterThatBecomesPrivate4().toString() } + expectSuccess("HolderOfAnnotationClassWithParameterThatBecomesPrivate4") { getHolderOfAnnotationClassWithParameterThatBecomesPrivate4Inline().toString() } + expectSuccess("HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate4") { getHolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate4().toString() } + expectSuccess("HolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate4") { getHolderOfAnnotationClassWithParameterOfParameterThatBecomesPrivate4Inline().toString() } + expectSuccess("HolderOfAnnotationClassWithParameterWithPrivateDefaultValue") { getHolderOfAnnotationClassWithParameterWithPrivateDefaultValue().toString() } + expectSuccess("HolderOfAnnotationClassWithParameterWithPrivateDefaultValue") { getHolderOfAnnotationClassWithParameterWithPrivateDefaultValueInline().toString() } + expectSuccess("HolderOfAnnotationClassWithParameterOfParameterWithPrivateDefaultValue") { getHolderOfAnnotationClassWithParameterOfParameterWithPrivateDefaultValue().toString() } + expectSuccess("HolderOfAnnotationClassWithParameterOfParameterWithPrivateDefaultValue") { getHolderOfAnnotationClassWithParameterOfParameterWithPrivateDefaultValueInline().toString() } expectSuccess { getValueToClass(); "OK" } expectSuccess { getValueToClassInline(); "OK" }