[PL] Fix: Remove annotations containing unlinked arguments

Both explicitly specified and default argument expressions are considered.

In case an argument expression is considered as 'unlinked' the whole annotation
is removed from the declaration. An appropriate compiler warning logged for each
such case.
This commit is contained in:
Dmitriy Dolovov
2023-05-10 23:06:37 +02:00
committed by Space Team
parent 6e8283a6fe
commit 706a4e9919
13 changed files with 508 additions and 57 deletions
@@ -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)"
}
@@ -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)"
}
@@ -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: