Reports warning on super calls in public-api inline functions
This commit is contained in:
+6
@@ -14581,6 +14581,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
|||||||
runTest("compiler/testData/diagnostics/tests/inline/stringTemplate.kt");
|
runTest("compiler/testData/diagnostics/tests/inline/stringTemplate.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("superCallDepecation.kt")
|
||||||
|
public void testSuperCallDepecation() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inline/superCallDepecation.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("unsupportedConstruction.kt")
|
@TestMetadata("unsupportedConstruction.kt")
|
||||||
public void testUnsupportedConstruction() throws Exception {
|
public void testUnsupportedConstruction() throws Exception {
|
||||||
|
|||||||
@@ -1139,6 +1139,7 @@ public interface Errors {
|
|||||||
DiagnosticFactory1<PsiElement, CallableDescriptor> PROTECTED_CALL_FROM_PUBLIC_INLINE = DiagnosticFactory1.create(WARNING);
|
DiagnosticFactory1<PsiElement, CallableDescriptor> PROTECTED_CALL_FROM_PUBLIC_INLINE = DiagnosticFactory1.create(WARNING);
|
||||||
DiagnosticFactory1<PsiElement, CallableDescriptor> PROTECTED_CONSTRUCTOR_CALL_FROM_PUBLIC_INLINE = DiagnosticFactory1.create(WARNING);
|
DiagnosticFactory1<PsiElement, CallableDescriptor> PROTECTED_CONSTRUCTOR_CALL_FROM_PUBLIC_INLINE = DiagnosticFactory1.create(WARNING);
|
||||||
DiagnosticFactory1<PsiElement, CallableDescriptor> PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR = DiagnosticFactory1.create(ERROR);
|
DiagnosticFactory1<PsiElement, CallableDescriptor> PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR = DiagnosticFactory1.create(ERROR);
|
||||||
|
DiagnosticFactory1<PsiElement, CallableDescriptor> SUPER_CALL_FROM_PUBLIC_INLINE = DiagnosticFactory1.create(WARNING);
|
||||||
DiagnosticFactory2<KtElement, KtExpression, DeclarationDescriptor> INVALID_DEFAULT_FUNCTIONAL_PARAMETER_FOR_INLINE = DiagnosticFactory2.create(ERROR);
|
DiagnosticFactory2<KtElement, KtExpression, DeclarationDescriptor> INVALID_DEFAULT_FUNCTIONAL_PARAMETER_FOR_INLINE = DiagnosticFactory2.create(ERROR);
|
||||||
DiagnosticFactory2<KtElement, KtExpression, DeclarationDescriptor> NOT_SUPPORTED_INLINE_PARAMETER_IN_INLINE_PARAMETER_DEFAULT_VALUE = DiagnosticFactory2.create(ERROR);
|
DiagnosticFactory2<KtElement, KtExpression, DeclarationDescriptor> NOT_SUPPORTED_INLINE_PARAMETER_IN_INLINE_PARAMETER_DEFAULT_VALUE = DiagnosticFactory2.create(ERROR);
|
||||||
DiagnosticFactory0<PsiElement> PRIVATE_INLINE_FUNCTIONS_RETURNING_ANONYMOUS_OBJECTS = DiagnosticFactory0.create(WARNING);
|
DiagnosticFactory0<PsiElement> PRIVATE_INLINE_FUNCTIONS_RETURNING_ANONYMOUS_OBJECTS = DiagnosticFactory0.create(WARNING);
|
||||||
|
|||||||
+1
@@ -1028,6 +1028,7 @@ public class DefaultErrorMessages {
|
|||||||
MAP.put(PROTECTED_CALL_FROM_PUBLIC_INLINE, "Protected function call from public-API inline function is deprecated", NAME);
|
MAP.put(PROTECTED_CALL_FROM_PUBLIC_INLINE, "Protected function call from public-API inline function is deprecated", NAME);
|
||||||
MAP.put(PROTECTED_CONSTRUCTOR_CALL_FROM_PUBLIC_INLINE, "Protected constructor call from public-API inline function is deprecated", NAME);
|
MAP.put(PROTECTED_CONSTRUCTOR_CALL_FROM_PUBLIC_INLINE, "Protected constructor call from public-API inline function is deprecated", NAME);
|
||||||
MAP.put(PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR, "Protected function call from public-API inline function is prohibited", NAME);
|
MAP.put(PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR, "Protected function call from public-API inline function is prohibited", NAME);
|
||||||
|
MAP.put(SUPER_CALL_FROM_PUBLIC_INLINE, "Accessing super members from public-API inline function is deprecated", NAME);
|
||||||
MAP.put(INVALID_DEFAULT_FUNCTIONAL_PARAMETER_FOR_INLINE, "Invalid default value for inline parameter: ''{0}''. Only lambdas, anonymous functions, and callable references are supported", ELEMENT_TEXT, SHORT_NAMES_IN_TYPES);
|
MAP.put(INVALID_DEFAULT_FUNCTIONAL_PARAMETER_FOR_INLINE, "Invalid default value for inline parameter: ''{0}''. Only lambdas, anonymous functions, and callable references are supported", ELEMENT_TEXT, SHORT_NAMES_IN_TYPES);
|
||||||
MAP.put(NOT_SUPPORTED_INLINE_PARAMETER_IN_INLINE_PARAMETER_DEFAULT_VALUE, "Usage of inline parameter ''{0}'' in default value for another inline parameter is not supported", ELEMENT_TEXT, SHORT_NAMES_IN_TYPES);
|
MAP.put(NOT_SUPPORTED_INLINE_PARAMETER_IN_INLINE_PARAMETER_DEFAULT_VALUE, "Usage of inline parameter ''{0}'' in default value for another inline parameter is not supported", ELEMENT_TEXT, SHORT_NAMES_IN_TYPES);
|
||||||
MAP.put(PRIVATE_INLINE_FUNCTIONS_RETURNING_ANONYMOUS_OBJECTS, "Return type of the private inline function can't be anonymous. It will be approximated to Any in a future release. See KT-33917 for more details");
|
MAP.put(PRIVATE_INLINE_FUNCTIONS_RETURNING_ANONYMOUS_OBJECTS, "Return type of the private inline function can't be anonymous. It will be approximated to Any in a future release. See KT-33917 for more details");
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ import org.jetbrains.kotlin.diagnostics.Errors.*
|
|||||||
import org.jetbrains.kotlin.lexer.KtTokens
|
import org.jetbrains.kotlin.lexer.KtTokens
|
||||||
import org.jetbrains.kotlin.psi.*
|
import org.jetbrains.kotlin.psi.*
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
|
import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
|
||||||
|
import org.jetbrains.kotlin.resolve.BindingContext
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||||
|
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.getSuperCallExpression
|
||||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.DefaultValueArgument
|
import org.jetbrains.kotlin.resolve.calls.model.DefaultValueArgument
|
||||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||||
@@ -39,6 +41,7 @@ import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver
|
|||||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ExtensionReceiver
|
import org.jetbrains.kotlin.resolve.scopes.receivers.ExtensionReceiver
|
||||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
|
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
|
||||||
import org.jetbrains.kotlin.resolve.source.KotlinSourceElement
|
import org.jetbrains.kotlin.resolve.source.KotlinSourceElement
|
||||||
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||||
import kotlin.properties.Delegates
|
import kotlin.properties.Delegates
|
||||||
|
|
||||||
@@ -60,7 +63,8 @@ internal class InlineChecker(private val descriptor: FunctionDescriptor) : CallC
|
|||||||
private var prohibitProtectedCallFromInline by Delegates.notNull<Boolean>()
|
private var prohibitProtectedCallFromInline by Delegates.notNull<Boolean>()
|
||||||
|
|
||||||
override fun check(resolvedCall: ResolvedCall<*>, reportOn: PsiElement, context: CallCheckerContext) {
|
override fun check(resolvedCall: ResolvedCall<*>, reportOn: PsiElement, context: CallCheckerContext) {
|
||||||
val expression = resolvedCall.call.calleeExpression ?: return
|
val call = resolvedCall.call
|
||||||
|
val expression = call.calleeExpression ?: return
|
||||||
|
|
||||||
supportDefaultValueInline = context.languageVersionSettings.supportsFeature(LanguageFeature.InlineDefaultFunctionalParameters)
|
supportDefaultValueInline = context.languageVersionSettings.supportsFeature(LanguageFeature.InlineDefaultFunctionalParameters)
|
||||||
prohibitProtectedCallFromInline = context.languageVersionSettings.supportsFeature(LanguageFeature.ProhibitProtectedCallFromInline)
|
prohibitProtectedCallFromInline = context.languageVersionSettings.supportsFeature(LanguageFeature.ProhibitProtectedCallFromInline)
|
||||||
@@ -90,7 +94,7 @@ internal class InlineChecker(private val descriptor: FunctionDescriptor) : CallC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkVisibilityAndAccess(targetDescriptor, expression, context)
|
checkVisibilityAndAccess(targetDescriptor, expression, context, call)
|
||||||
checkRecursion(context, targetDescriptor, expression)
|
checkRecursion(context, targetDescriptor, expression)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,7 +252,8 @@ internal class InlineChecker(private val descriptor: FunctionDescriptor) : CallC
|
|||||||
private fun checkVisibilityAndAccess(
|
private fun checkVisibilityAndAccess(
|
||||||
calledDescriptor: CallableDescriptor,
|
calledDescriptor: CallableDescriptor,
|
||||||
expression: KtElement,
|
expression: KtElement,
|
||||||
context: CallCheckerContext
|
context: CallCheckerContext,
|
||||||
|
call: Call
|
||||||
) {
|
) {
|
||||||
val calledFunEffectiveVisibility = if (isDefinedInInlineFunction(calledDescriptor))
|
val calledFunEffectiveVisibility = if (isDefinedInInlineFunction(calledDescriptor))
|
||||||
EffectiveVisibility.Public
|
EffectiveVisibility.Public
|
||||||
@@ -263,6 +268,9 @@ internal class InlineChecker(private val descriptor: FunctionDescriptor) : CallC
|
|||||||
context.trace.report(NON_PUBLIC_CALL_FROM_PUBLIC_INLINE.on(expression, calledDescriptor, descriptor))
|
context.trace.report(NON_PUBLIC_CALL_FROM_PUBLIC_INLINE.on(expression, calledDescriptor, descriptor))
|
||||||
} else {
|
} else {
|
||||||
checkPrivateClassMemberAccess(calledDescriptor, expression, context)
|
checkPrivateClassMemberAccess(calledDescriptor, expression, context)
|
||||||
|
if (isInlineFunPublicOrPublishedApi) {
|
||||||
|
checkSuperCalls(calledDescriptor, call, expression, context)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val isConstructorCall = calledDescriptor is ConstructorDescriptor
|
val isConstructorCall = calledDescriptor is ConstructorDescriptor
|
||||||
@@ -296,6 +304,27 @@ internal class InlineChecker(private val descriptor: FunctionDescriptor) : CallC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun checkSuperCalls(
|
||||||
|
callableDescriptor: CallableDescriptor,
|
||||||
|
call: Call,
|
||||||
|
expression: KtElement,
|
||||||
|
context: CallCheckerContext
|
||||||
|
) {
|
||||||
|
val superCall = getSuperCallExpression(call)
|
||||||
|
if (superCall != null) {
|
||||||
|
val thisTypeForSuperCall: KotlinType =
|
||||||
|
context.trace.get(
|
||||||
|
BindingContext.THIS_TYPE_FOR_SUPER_EXPRESSION,
|
||||||
|
superCall
|
||||||
|
) ?: return
|
||||||
|
val descriptor = thisTypeForSuperCall.constructor.declarationDescriptor as? DeclarationDescriptorWithVisibility ?: return
|
||||||
|
|
||||||
|
if (!isDefinedInInlineFunction(descriptor)) {
|
||||||
|
context.trace.report(SUPER_CALL_FROM_PUBLIC_INLINE.on(expression.parent.parent ?: superCall, callableDescriptor))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun isDefinedInInlineFunction(startDescriptor: DeclarationDescriptorWithVisibility): Boolean {
|
private fun isDefinedInInlineFunction(startDescriptor: DeclarationDescriptorWithVisibility): Boolean {
|
||||||
var parent: DeclarationDescriptorWithVisibility? = startDescriptor
|
var parent: DeclarationDescriptorWithVisibility? = startDescriptor
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,122 @@
|
|||||||
|
// !DIAGNOSTICS: -EXPOSED_PARAMETER_TYPE -NOTHING_TO_INLINE
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
open class AndroidTargetConfigurator :
|
||||||
|
Base(),
|
||||||
|
ModuleConfiguratorWithTests,
|
||||||
|
AndroidModuleConfigurator {
|
||||||
|
|
||||||
|
public inline fun inlineFun(): String {
|
||||||
|
return super.classFun() + super<ModuleConfiguratorWithTests>.getConfiguratorSettings() + super<AndroidModuleConfigurator>.getConfiguratorSettings()
|
||||||
|
}
|
||||||
|
|
||||||
|
@PublishedApi
|
||||||
|
internal inline fun inlineFunPublished(): String {
|
||||||
|
return super.classFun() + super<ModuleConfiguratorWithTests>.getConfiguratorSettings() + super<AndroidModuleConfigurator>.getConfiguratorSettings()
|
||||||
|
}
|
||||||
|
|
||||||
|
public inline fun inlineFunAnonymousObjects(): String {
|
||||||
|
{
|
||||||
|
super.classFun() + super<ModuleConfiguratorWithTests>.getConfiguratorSettings() + super<AndroidModuleConfigurator>.getConfiguratorSettings()
|
||||||
|
}()
|
||||||
|
|
||||||
|
return object {
|
||||||
|
fun run() = super@AndroidTargetConfigurator.classFun() + super<ModuleConfiguratorWithTests>@AndroidTargetConfigurator.getConfiguratorSettings() + super<AndroidModuleConfigurator>@AndroidTargetConfigurator.getConfiguratorSettings()
|
||||||
|
}.run()
|
||||||
|
}
|
||||||
|
|
||||||
|
public inline fun inlineFunAnonymousNoDiagnostics(): String {
|
||||||
|
return object: AndroidTargetConfigurator(), ModuleConfiguratorWithTests, AndroidModuleConfigurator {
|
||||||
|
|
||||||
|
override fun getConfiguratorSettings(): String {
|
||||||
|
return super<AndroidTargetConfigurator>.getConfiguratorSettings()
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun anonymousInline() {
|
||||||
|
super.classFun() + super<<!QUALIFIED_SUPERTYPE_EXTENDED_BY_OTHER_SUPERTYPE!>ModuleConfiguratorWithTests<!>>.getConfiguratorSettings() + super<<!QUALIFIED_SUPERTYPE_EXTENDED_BY_OTHER_SUPERTYPE!>AndroidModuleConfigurator<!>>.getConfiguratorSettings()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun run() = super.classFun() + super<<!QUALIFIED_SUPERTYPE_EXTENDED_BY_OTHER_SUPERTYPE!>ModuleConfiguratorWithTests<!>>.getConfiguratorSettings() + super<<!QUALIFIED_SUPERTYPE_EXTENDED_BY_OTHER_SUPERTYPE!>AndroidModuleConfigurator<!>>.getConfiguratorSettings()
|
||||||
|
}.run()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
internal inline fun inlineInternal(): String {
|
||||||
|
return super.classFun() + super<ModuleConfiguratorWithTests>.getConfiguratorSettings() + super<AndroidModuleConfigurator>.getConfiguratorSettings()
|
||||||
|
}
|
||||||
|
|
||||||
|
private inline fun inlinePrivate(): String {
|
||||||
|
return super.classFun() + super<ModuleConfiguratorWithTests>.getConfiguratorSettings() + super<AndroidModuleConfigurator>.getConfiguratorSettings()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//non-inline
|
||||||
|
override fun getConfiguratorSettings() =
|
||||||
|
super.classFun() + super<ModuleConfiguratorWithTests>.getConfiguratorSettings() + super<AndroidModuleConfigurator>.getConfiguratorSettings()
|
||||||
|
|
||||||
|
fun noInline() {
|
||||||
|
{
|
||||||
|
super.classFun() + super<ModuleConfiguratorWithTests>.getConfiguratorSettings() + super<AndroidModuleConfigurator>.getConfiguratorSettings()
|
||||||
|
}()
|
||||||
|
|
||||||
|
object {
|
||||||
|
fun run() = super@AndroidTargetConfigurator.classFun() + super<ModuleConfiguratorWithTests>@AndroidTargetConfigurator.getConfiguratorSettings() + super<AndroidModuleConfigurator>@AndroidTargetConfigurator.getConfiguratorSettings()
|
||||||
|
}.run()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
open class Base {
|
||||||
|
fun classFun(): String = "Class"
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ModuleConfiguratorWithTests : ModuleConfiguratorWithSettings {
|
||||||
|
override fun getConfiguratorSettings() = "K"
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ModuleConfiguratorWithSettings {
|
||||||
|
fun getConfiguratorSettings(): String = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
interface AndroidModuleConfigurator :
|
||||||
|
ModuleConfiguratorWithSettings {
|
||||||
|
override fun getConfiguratorSettings(): String {
|
||||||
|
return "O"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sealed class FooSealed : Base() {
|
||||||
|
class A : FooSealed()
|
||||||
|
|
||||||
|
class B: FooSealed()
|
||||||
|
|
||||||
|
inline fun test() {
|
||||||
|
super.classFun()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class FooEmum {
|
||||||
|
A, B {
|
||||||
|
|
||||||
|
inline fun test() {
|
||||||
|
super.classFun()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fun classFun(): String = "Class"
|
||||||
|
}
|
||||||
|
|
||||||
|
class FooOuter : Base() {
|
||||||
|
|
||||||
|
inner class FooInner: Base() {
|
||||||
|
inline fun test() {
|
||||||
|
super@FooOuter.classFun()
|
||||||
|
super.classFun()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
// !DIAGNOSTICS: -EXPOSED_PARAMETER_TYPE -NOTHING_TO_INLINE
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
open class AndroidTargetConfigurator :
|
||||||
|
Base(),
|
||||||
|
ModuleConfiguratorWithTests,
|
||||||
|
AndroidModuleConfigurator {
|
||||||
|
|
||||||
|
public inline fun inlineFun(): String {
|
||||||
|
return <!SUPER_CALL_FROM_PUBLIC_INLINE!>super.classFun()<!> + <!SUPER_CALL_FROM_PUBLIC_INLINE!>super<ModuleConfiguratorWithTests>.getConfiguratorSettings()<!> + <!SUPER_CALL_FROM_PUBLIC_INLINE!>super<AndroidModuleConfigurator>.getConfiguratorSettings()<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
@PublishedApi
|
||||||
|
internal inline fun inlineFunPublished(): String {
|
||||||
|
return <!SUPER_CALL_FROM_PUBLIC_INLINE!>super.classFun()<!> + <!SUPER_CALL_FROM_PUBLIC_INLINE!>super<ModuleConfiguratorWithTests>.getConfiguratorSettings()<!> + <!SUPER_CALL_FROM_PUBLIC_INLINE!>super<AndroidModuleConfigurator>.getConfiguratorSettings()<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
public inline fun inlineFunAnonymousObjects(): String {
|
||||||
|
{
|
||||||
|
<!SUPER_CALL_FROM_PUBLIC_INLINE!>super.classFun()<!> + <!SUPER_CALL_FROM_PUBLIC_INLINE!>super<ModuleConfiguratorWithTests>.getConfiguratorSettings()<!> + <!SUPER_CALL_FROM_PUBLIC_INLINE!>super<AndroidModuleConfigurator>.getConfiguratorSettings()<!>
|
||||||
|
}()
|
||||||
|
|
||||||
|
return object {
|
||||||
|
fun run() = <!SUPER_CALL_FROM_PUBLIC_INLINE!>super@AndroidTargetConfigurator.classFun()<!> + <!SUPER_CALL_FROM_PUBLIC_INLINE!>super<ModuleConfiguratorWithTests>@AndroidTargetConfigurator.getConfiguratorSettings()<!> + <!SUPER_CALL_FROM_PUBLIC_INLINE!>super<AndroidModuleConfigurator>@AndroidTargetConfigurator.getConfiguratorSettings()<!>
|
||||||
|
}.run()
|
||||||
|
}
|
||||||
|
|
||||||
|
public inline fun inlineFunAnonymousNoDiagnostics(): String {
|
||||||
|
return object: AndroidTargetConfigurator(), ModuleConfiguratorWithTests, AndroidModuleConfigurator {
|
||||||
|
|
||||||
|
override fun getConfiguratorSettings(): String {
|
||||||
|
return super<AndroidTargetConfigurator>.getConfiguratorSettings()
|
||||||
|
}
|
||||||
|
|
||||||
|
inline fun anonymousInline() {
|
||||||
|
super.classFun() + super<<!QUALIFIED_SUPERTYPE_EXTENDED_BY_OTHER_SUPERTYPE!>ModuleConfiguratorWithTests<!>>.getConfiguratorSettings() + super<<!QUALIFIED_SUPERTYPE_EXTENDED_BY_OTHER_SUPERTYPE!>AndroidModuleConfigurator<!>>.getConfiguratorSettings()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun run() = super.classFun() + super<<!QUALIFIED_SUPERTYPE_EXTENDED_BY_OTHER_SUPERTYPE!>ModuleConfiguratorWithTests<!>>.getConfiguratorSettings() + super<<!QUALIFIED_SUPERTYPE_EXTENDED_BY_OTHER_SUPERTYPE!>AndroidModuleConfigurator<!>>.getConfiguratorSettings()
|
||||||
|
}.run()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
internal inline fun inlineInternal(): String {
|
||||||
|
return super.classFun() + super<ModuleConfiguratorWithTests>.getConfiguratorSettings() + super<AndroidModuleConfigurator>.getConfiguratorSettings()
|
||||||
|
}
|
||||||
|
|
||||||
|
private inline fun inlinePrivate(): String {
|
||||||
|
return super.classFun() + super<ModuleConfiguratorWithTests>.getConfiguratorSettings() + super<AndroidModuleConfigurator>.getConfiguratorSettings()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//non-inline
|
||||||
|
override fun getConfiguratorSettings() =
|
||||||
|
super.classFun() + super<ModuleConfiguratorWithTests>.getConfiguratorSettings() + super<AndroidModuleConfigurator>.getConfiguratorSettings()
|
||||||
|
|
||||||
|
fun noInline() {
|
||||||
|
{
|
||||||
|
super.classFun() + super<ModuleConfiguratorWithTests>.getConfiguratorSettings() + super<AndroidModuleConfigurator>.getConfiguratorSettings()
|
||||||
|
}()
|
||||||
|
|
||||||
|
object {
|
||||||
|
fun run() = super@AndroidTargetConfigurator.classFun() + super<ModuleConfiguratorWithTests>@AndroidTargetConfigurator.getConfiguratorSettings() + super<AndroidModuleConfigurator>@AndroidTargetConfigurator.getConfiguratorSettings()
|
||||||
|
}.run()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
open class Base {
|
||||||
|
fun classFun(): String = "Class"
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ModuleConfiguratorWithTests : ModuleConfiguratorWithSettings {
|
||||||
|
override fun getConfiguratorSettings() = "K"
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ModuleConfiguratorWithSettings {
|
||||||
|
fun getConfiguratorSettings(): String = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
interface AndroidModuleConfigurator :
|
||||||
|
ModuleConfiguratorWithSettings {
|
||||||
|
override fun getConfiguratorSettings(): String {
|
||||||
|
return "O"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sealed class FooSealed : Base() {
|
||||||
|
class A : FooSealed()
|
||||||
|
|
||||||
|
class B: FooSealed()
|
||||||
|
|
||||||
|
inline fun test() {
|
||||||
|
<!SUPER_CALL_FROM_PUBLIC_INLINE!>super.classFun()<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class FooEmum {
|
||||||
|
A, B {
|
||||||
|
|
||||||
|
inline fun test() {
|
||||||
|
<!SUPER_CALL_FROM_PUBLIC_INLINE!>super.classFun()<!>
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fun classFun(): String = "Class"
|
||||||
|
}
|
||||||
|
|
||||||
|
class FooOuter : Base() {
|
||||||
|
|
||||||
|
inner class FooInner: Base() {
|
||||||
|
inline fun test() {
|
||||||
|
<!SUPER_CALL_FROM_PUBLIC_INLINE!>super@FooOuter.classFun()<!>
|
||||||
|
<!SUPER_CALL_FROM_PUBLIC_INLINE!>super.classFun()<!>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public interface AndroidModuleConfigurator : ModuleConfiguratorWithSettings {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ fun getConfiguratorSettings(): kotlin.String
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class AndroidTargetConfigurator : Base, ModuleConfiguratorWithTests, AndroidModuleConfigurator {
|
||||||
|
public constructor AndroidTargetConfigurator()
|
||||||
|
public final override /*1*/ /*fake_override*/ fun classFun(): kotlin.String
|
||||||
|
public open override /*3*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*2*/ fun getConfiguratorSettings(): kotlin.String
|
||||||
|
public open override /*3*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public final inline fun inlineFun(): kotlin.String
|
||||||
|
public final inline fun inlineFunAnonymousNoDiagnostics(): kotlin.String
|
||||||
|
public final inline fun inlineFunAnonymousObjects(): kotlin.String
|
||||||
|
@kotlin.PublishedApi internal final inline fun inlineFunPublished(): kotlin.String
|
||||||
|
internal final inline fun inlineInternal(): kotlin.String
|
||||||
|
private final inline fun inlinePrivate(): kotlin.String
|
||||||
|
public final fun noInline(): kotlin.Unit
|
||||||
|
public open override /*3*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class Base {
|
||||||
|
public constructor Base()
|
||||||
|
public final fun classFun(): kotlin.String
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public final enum class FooEmum : kotlin.Enum<FooEmum> {
|
||||||
|
enum entry A
|
||||||
|
|
||||||
|
enum entry B
|
||||||
|
|
||||||
|
private constructor FooEmum()
|
||||||
|
public final override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||||
|
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||||
|
public final fun classFun(): kotlin.String
|
||||||
|
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
||||||
|
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: FooEmum): kotlin.Int
|
||||||
|
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
protected/*protected and package*/ final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun finalize(): kotlin.Unit
|
||||||
|
public final override /*1*/ /*fake_override*/ /*isHiddenForResolutionEverywhereBesideSupercalls*/ fun getDeclaringClass(): java.lang.Class<FooEmum!>!
|
||||||
|
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
// Static members
|
||||||
|
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): FooEmum
|
||||||
|
public final /*synthesized*/ fun values(): kotlin.Array<FooEmum>
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class FooOuter : Base {
|
||||||
|
public constructor FooOuter()
|
||||||
|
public final override /*1*/ /*fake_override*/ fun classFun(): kotlin.String
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public final inner class FooInner : Base {
|
||||||
|
public constructor FooInner()
|
||||||
|
public final override /*1*/ /*fake_override*/ fun classFun(): kotlin.String
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public final inline fun test(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class FooSealed : Base {
|
||||||
|
protected constructor FooSealed()
|
||||||
|
public final override /*1*/ /*fake_override*/ fun classFun(): kotlin.String
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public final inline fun test(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
public final class A : FooSealed {
|
||||||
|
public constructor A()
|
||||||
|
public final override /*1*/ /*fake_override*/ fun classFun(): kotlin.String
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public final override /*1*/ inline /*fake_override*/ fun test(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class B : FooSealed {
|
||||||
|
public constructor B()
|
||||||
|
public final override /*1*/ /*fake_override*/ fun classFun(): kotlin.String
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public final override /*1*/ inline /*fake_override*/ fun test(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ModuleConfiguratorWithSettings {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open fun getConfiguratorSettings(): kotlin.String
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ModuleConfiguratorWithTests : ModuleConfiguratorWithSettings {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ fun getConfiguratorSettings(): kotlin.String
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
Generated
+6
@@ -14587,6 +14587,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/inline/stringTemplate.kt");
|
runTest("compiler/testData/diagnostics/tests/inline/stringTemplate.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("superCallDepecation.kt")
|
||||||
|
public void testSuperCallDepecation() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/inline/superCallDepecation.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("unsupportedConstruction.kt")
|
@TestMetadata("unsupportedConstruction.kt")
|
||||||
public void testUnsupportedConstruction() throws Exception {
|
public void testUnsupportedConstruction() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user