Allow open callable members in expect interfaces
#KT-42094 fixed
This commit is contained in:
committed by
Sebastian Sellmair
parent
bf0156f7c6
commit
06cb64bb51
+10
@@ -14556,6 +14556,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
|||||||
runTest("compiler/testData/diagnostics/tests/modifiers/NoLocalVisibility.kt");
|
runTest("compiler/testData/diagnostics/tests/modifiers/NoLocalVisibility.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("openInExpectInterface.kt")
|
||||||
|
public void testOpenInExpectInterface() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/modifiers/openInExpectInterface.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("openInInterface.kt")
|
@TestMetadata("openInInterface.kt")
|
||||||
public void testOpenInInterface() throws Exception {
|
public void testOpenInInterface() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/modifiers/openInInterface.kt");
|
runTest("compiler/testData/diagnostics/tests/modifiers/openInInterface.kt");
|
||||||
@@ -15015,6 +15020,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("expectInterfaceApplicability.kt")
|
||||||
|
public void testExpectInterfaceApplicability() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/expectInterfaceApplicability.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("headerFunInNonHeaderClass.kt")
|
@TestMetadata("headerFunInNonHeaderClass.kt")
|
||||||
public void testHeaderFunInNonHeaderClass() throws Exception {
|
public void testHeaderFunInNonHeaderClass() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/multiplatform/headerFunInNonHeaderClass.kt");
|
runTest("compiler/testData/diagnostics/tests/multiplatform/headerFunInNonHeaderClass.kt");
|
||||||
|
|||||||
@@ -772,7 +772,7 @@ class DeclarationsChecker(
|
|||||||
if (function.hasModifier(KtTokens.PRIVATE_KEYWORD)) {
|
if (function.hasModifier(KtTokens.PRIVATE_KEYWORD)) {
|
||||||
trace.report(PRIVATE_FUNCTION_WITH_NO_BODY.on(function, functionDescriptor))
|
trace.report(PRIVATE_FUNCTION_WITH_NO_BODY.on(function, functionDescriptor))
|
||||||
}
|
}
|
||||||
if (!hasAbstractModifier && function.hasModifier(KtTokens.OPEN_KEYWORD)) {
|
if (!containingDescriptor.isExpect && !hasAbstractModifier && function.hasModifier(KtTokens.OPEN_KEYWORD)) {
|
||||||
trace.report(REDUNDANT_OPEN_IN_INTERFACE.on(function))
|
trace.report(REDUNDANT_OPEN_IN_INTERFACE.on(function))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public class ModifiersChecker {
|
|||||||
boolean allowSealed
|
boolean allowSealed
|
||||||
) {
|
) {
|
||||||
KtModifierList modifierList = (modifierListOwner != null) ? modifierListOwner.getModifierList() : null;
|
KtModifierList modifierList = (modifierListOwner != null) ? modifierListOwner.getModifierList() : null;
|
||||||
Modality modality = resolveModalityFromModifiers(modifierList, defaultModality, allowSealed);
|
Modality modality = resolveModalityFromModifiers(containingDescriptor, modifierList, defaultModality, allowSealed);
|
||||||
|
|
||||||
if (modifierListOwner != null) {
|
if (modifierListOwner != null) {
|
||||||
Collection<DeclarationAttributeAltererExtension> extensions =
|
Collection<DeclarationAttributeAltererExtension> extensions =
|
||||||
@@ -103,6 +103,7 @@ public class ModifiersChecker {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static Modality resolveModalityFromModifiers(
|
private static Modality resolveModalityFromModifiers(
|
||||||
|
@Nullable DeclarationDescriptor containingDescriptor,
|
||||||
@Nullable KtModifierList modifierList,
|
@Nullable KtModifierList modifierList,
|
||||||
@NotNull Modality defaultModality,
|
@NotNull Modality defaultModality,
|
||||||
boolean allowSealed
|
boolean allowSealed
|
||||||
@@ -115,6 +116,12 @@ public class ModifiersChecker {
|
|||||||
return Modality.SEALED;
|
return Modality.SEALED;
|
||||||
}
|
}
|
||||||
if (modifierList.hasModifier(OPEN_KEYWORD)) {
|
if (modifierList.hasModifier(OPEN_KEYWORD)) {
|
||||||
|
if (containingDescriptor instanceof ClassDescriptor) {
|
||||||
|
ClassDescriptor classOrInterface = (ClassDescriptor) containingDescriptor;
|
||||||
|
if (classOrInterface.getKind() == ClassKind.INTERFACE && classOrInterface.isExpect()) {
|
||||||
|
return Modality.OPEN;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (hasAbstractModifier || defaultModality == Modality.ABSTRACT) {
|
if (hasAbstractModifier || defaultModality == Modality.ABSTRACT) {
|
||||||
return Modality.ABSTRACT;
|
return Modality.ABSTRACT;
|
||||||
}
|
}
|
||||||
@@ -141,7 +148,10 @@ public class ModifiersChecker {
|
|||||||
return resolveVisibilityFromModifiers(modifierListOwner.getModifierList(), defaultVisibility);
|
return resolveVisibilityFromModifiers(modifierListOwner.getModifierList(), defaultVisibility);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DescriptorVisibility resolveVisibilityFromModifiers(@Nullable KtModifierList modifierList, @NotNull DescriptorVisibility defaultVisibility) {
|
public static DescriptorVisibility resolveVisibilityFromModifiers(
|
||||||
|
@Nullable KtModifierList modifierList,
|
||||||
|
@NotNull DescriptorVisibility defaultVisibility
|
||||||
|
) {
|
||||||
if (modifierList == null) return defaultVisibility;
|
if (modifierList == null) return defaultVisibility;
|
||||||
if (modifierList.hasModifier(PRIVATE_KEYWORD)) return DescriptorVisibilities.PRIVATE;
|
if (modifierList.hasModifier(PRIVATE_KEYWORD)) return DescriptorVisibilities.PRIVATE;
|
||||||
if (modifierList.hasModifier(PUBLIC_KEYWORD)) return DescriptorVisibilities.PUBLIC;
|
if (modifierList.hasModifier(PUBLIC_KEYWORD)) return DescriptorVisibilities.PUBLIC;
|
||||||
@@ -226,7 +236,7 @@ public class ModifiersChecker {
|
|||||||
public void checkModifiersForDestructuringDeclaration(@NotNull KtDestructuringDeclaration multiDeclaration) {
|
public void checkModifiersForDestructuringDeclaration(@NotNull KtDestructuringDeclaration multiDeclaration) {
|
||||||
annotationChecker.check(multiDeclaration, trace, null);
|
annotationChecker.check(multiDeclaration, trace, null);
|
||||||
ModifierCheckerCore.INSTANCE.check(multiDeclaration, trace, null, languageVersionSettings);
|
ModifierCheckerCore.INSTANCE.check(multiDeclaration, trace, null, languageVersionSettings);
|
||||||
for (KtDestructuringDeclarationEntry multiEntry: multiDeclaration.getEntries()) {
|
for (KtDestructuringDeclarationEntry multiEntry : multiDeclaration.getEntries()) {
|
||||||
annotationChecker.check(multiEntry, trace, null);
|
annotationChecker.check(multiEntry, trace, null);
|
||||||
ModifierCheckerCore.INSTANCE.check(multiEntry, trace, null, languageVersionSettings);
|
ModifierCheckerCore.INSTANCE.check(multiEntry, trace, null, languageVersionSettings);
|
||||||
UnderscoreChecker.INSTANCE.checkNamed(multiEntry, trace, languageVersionSettings, /* allowSingleUnderscore = */ true);
|
UnderscoreChecker.INSTANCE.checkNamed(multiEntry, trace, languageVersionSettings, /* allowSingleUnderscore = */ true);
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
// !LANGUAGE: +MultiPlatformProjects
|
||||||
|
// MODULE: m1-common
|
||||||
|
// FILE: common.kt
|
||||||
|
// TODO: .fir.kt version is just a stub.
|
||||||
|
|
||||||
|
expect interface My {
|
||||||
|
open fun bar()
|
||||||
|
open fun bas() {}
|
||||||
|
<!REDUNDANT_MODIFIER!>open<!> abstract fun bat(): Int
|
||||||
|
|
||||||
|
fun foo()
|
||||||
|
|
||||||
|
|
||||||
|
open val a: Int
|
||||||
|
open val b: String
|
||||||
|
open val c: String get() = ""
|
||||||
|
<!REDUNDANT_MODIFIER!>open<!> abstract val e: Int
|
||||||
|
|
||||||
|
val f: Int
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyImpl1: My
|
||||||
|
|
||||||
|
class MyImpl2: My {
|
||||||
|
override fun foo() {}
|
||||||
|
override val f = 0
|
||||||
|
override val e = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
expect interface Outer {
|
||||||
|
interface Inner {
|
||||||
|
open fun bar()
|
||||||
|
open fun bas() {}
|
||||||
|
<!REDUNDANT_MODIFIER!>open<!> abstract fun bat(): Int
|
||||||
|
fun foo()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
// !LANGUAGE: +MultiPlatformProjects
|
||||||
|
// MODULE: m1-common
|
||||||
|
// FILE: common.kt
|
||||||
|
// TODO: .fir.kt version is just a stub.
|
||||||
|
|
||||||
|
expect interface My {
|
||||||
|
open fun bar()
|
||||||
|
<!EXPECTED_DECLARATION_WITH_BODY!>open fun bas()<!> {}
|
||||||
|
<!REDUNDANT_MODIFIER!>open<!> abstract fun bat(): Int
|
||||||
|
|
||||||
|
fun foo()
|
||||||
|
|
||||||
|
|
||||||
|
open val a: Int
|
||||||
|
open val b: String
|
||||||
|
open val c: String <!EXPECTED_DECLARATION_WITH_BODY!>get()<!> = ""
|
||||||
|
<!REDUNDANT_MODIFIER!>open<!> abstract val e: Int
|
||||||
|
|
||||||
|
val f: Int
|
||||||
|
}
|
||||||
|
|
||||||
|
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class MyImpl1<!>: My
|
||||||
|
|
||||||
|
class MyImpl2: My {
|
||||||
|
override fun foo() {}
|
||||||
|
override val f = 0
|
||||||
|
override val e = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
expect interface Outer {
|
||||||
|
interface Inner {
|
||||||
|
open fun bar()
|
||||||
|
<!EXPECTED_DECLARATION_WITH_BODY!>open fun bas()<!> {}
|
||||||
|
<!REDUNDANT_MODIFIER!>open<!> abstract fun bat(): Int
|
||||||
|
fun foo()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public expect interface My {
|
||||||
|
public expect open val a: kotlin.Int
|
||||||
|
public expect open val b: kotlin.String
|
||||||
|
public expect open val c: kotlin.String
|
||||||
|
public expect open val e: kotlin.Int
|
||||||
|
public expect abstract val f: kotlin.Int
|
||||||
|
public open expect fun bar(): kotlin.Unit
|
||||||
|
public open expect fun bas(): kotlin.Unit
|
||||||
|
public open expect fun bat(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract expect fun foo(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class MyImpl1 : My {
|
||||||
|
public constructor MyImpl1()
|
||||||
|
public expect open override /*1*/ /*fake_override*/ val a: kotlin.Int
|
||||||
|
public expect open override /*1*/ /*fake_override*/ val b: kotlin.String
|
||||||
|
public expect open override /*1*/ /*fake_override*/ val c: kotlin.String
|
||||||
|
public expect open override /*1*/ /*fake_override*/ val e: kotlin.Int
|
||||||
|
public expect abstract override /*1*/ /*fake_override*/ val f: kotlin.Int
|
||||||
|
public open expect override /*1*/ /*fake_override*/ fun bar(): kotlin.Unit
|
||||||
|
public open expect override /*1*/ /*fake_override*/ fun bas(): kotlin.Unit
|
||||||
|
public open expect override /*1*/ /*fake_override*/ fun bat(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract expect override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class MyImpl2 : My {
|
||||||
|
public constructor MyImpl2()
|
||||||
|
public expect open override /*1*/ /*fake_override*/ val a: kotlin.Int
|
||||||
|
public expect open override /*1*/ /*fake_override*/ val b: kotlin.String
|
||||||
|
public expect open override /*1*/ /*fake_override*/ val c: kotlin.String
|
||||||
|
public open override /*1*/ val e: kotlin.Int = 1
|
||||||
|
public open override /*1*/ val f: kotlin.Int = 0
|
||||||
|
public open expect override /*1*/ /*fake_override*/ fun bar(): kotlin.Unit
|
||||||
|
public open expect override /*1*/ /*fake_override*/ fun bas(): kotlin.Unit
|
||||||
|
public open expect override /*1*/ /*fake_override*/ fun bat(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ fun foo(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public expect interface Outer {
|
||||||
|
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 expect interface Inner {
|
||||||
|
public open expect fun bar(): kotlin.Unit
|
||||||
|
public open expect fun bas(): kotlin.Unit
|
||||||
|
public open expect fun bat(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract expect fun foo(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
}
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
// !LANGUAGE: +MultiPlatformProjects
|
||||||
|
// MODULE: m1-common
|
||||||
|
// FILE: common.kt
|
||||||
|
// TODO: .fir.kt version is just a stub.
|
||||||
|
expect interface My {
|
||||||
|
open fun openFunPositive()
|
||||||
|
open fun openFunNegative()
|
||||||
|
abstract fun abstractFun()
|
||||||
|
|
||||||
|
open val openValPositive: Int
|
||||||
|
open val openValNegative: Int
|
||||||
|
abstract val abstractVal: Int
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: m1-jvm(m1-common)
|
||||||
|
// FILE: jvm.kt
|
||||||
|
actual interface My {
|
||||||
|
actual fun openFunPositive() = Unit
|
||||||
|
actual fun openFunNegative()
|
||||||
|
actual fun abstractFun()
|
||||||
|
|
||||||
|
actual val openValPositive: Int get() = 0
|
||||||
|
actual val openValNegative: Int
|
||||||
|
actual val abstractVal: Int
|
||||||
|
}
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
// !LANGUAGE: +MultiPlatformProjects
|
||||||
|
// MODULE: m1-common
|
||||||
|
// FILE: common.kt
|
||||||
|
// TODO: .fir.kt version is just a stub.
|
||||||
|
expect interface My {
|
||||||
|
open fun openFunPositive()
|
||||||
|
open fun openFunNegative()
|
||||||
|
abstract fun abstractFun()
|
||||||
|
|
||||||
|
open val openValPositive: Int
|
||||||
|
open val openValNegative: Int
|
||||||
|
abstract val abstractVal: Int
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: m1-jvm(m1-common)
|
||||||
|
// FILE: jvm.kt
|
||||||
|
actual interface My {
|
||||||
|
actual fun openFunPositive() = Unit
|
||||||
|
actual fun <!ACTUAL_WITHOUT_EXPECT!>openFunNegative<!>()
|
||||||
|
actual fun abstractFun()
|
||||||
|
|
||||||
|
actual val openValPositive: Int get() = 0
|
||||||
|
actual val <!ACTUAL_WITHOUT_EXPECT!>openValNegative<!>: Int
|
||||||
|
actual val abstractVal: Int
|
||||||
|
}
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
// -- Module: <m1-common> --
|
||||||
|
package
|
||||||
|
|
||||||
|
public expect interface My {
|
||||||
|
public expect abstract val abstractVal: kotlin.Int
|
||||||
|
public expect open val openValNegative: kotlin.Int
|
||||||
|
public expect open val openValPositive: kotlin.Int
|
||||||
|
public abstract expect fun abstractFun(): kotlin.Unit
|
||||||
|
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 expect fun openFunNegative(): kotlin.Unit
|
||||||
|
public open expect fun openFunPositive(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- Module: <m1-jvm> --
|
||||||
|
package
|
||||||
|
|
||||||
|
public actual interface My {
|
||||||
|
public actual abstract val abstractVal: kotlin.Int
|
||||||
|
public actual abstract val openValNegative: kotlin.Int
|
||||||
|
public actual open val openValPositive: kotlin.Int
|
||||||
|
public abstract actual fun abstractFun(): kotlin.Unit
|
||||||
|
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 abstract actual fun openFunNegative(): kotlin.Unit
|
||||||
|
public open actual fun openFunPositive(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
@@ -14563,6 +14563,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali
|
|||||||
runTest("compiler/testData/diagnostics/tests/modifiers/NoLocalVisibility.kt");
|
runTest("compiler/testData/diagnostics/tests/modifiers/NoLocalVisibility.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("openInExpectInterface.kt")
|
||||||
|
public void testOpenInExpectInterface() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/modifiers/openInExpectInterface.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("openInInterface.kt")
|
@TestMetadata("openInInterface.kt")
|
||||||
public void testOpenInInterface() throws Exception {
|
public void testOpenInInterface() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/modifiers/openInInterface.kt");
|
runTest("compiler/testData/diagnostics/tests/modifiers/openInInterface.kt");
|
||||||
@@ -15022,6 +15027,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("expectInterfaceApplicability.kt")
|
||||||
|
public void testExpectInterfaceApplicability() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/expectInterfaceApplicability.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("headerFunInNonHeaderClass.kt")
|
@TestMetadata("headerFunInNonHeaderClass.kt")
|
||||||
public void testHeaderFunInNonHeaderClass() throws Exception {
|
public void testHeaderFunInNonHeaderClass() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/multiplatform/headerFunInNonHeaderClass.kt");
|
runTest("compiler/testData/diagnostics/tests/multiplatform/headerFunInNonHeaderClass.kt");
|
||||||
|
|||||||
Generated
+10
@@ -14558,6 +14558,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
|||||||
runTest("compiler/testData/diagnostics/tests/modifiers/NoLocalVisibility.kt");
|
runTest("compiler/testData/diagnostics/tests/modifiers/NoLocalVisibility.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("openInExpectInterface.kt")
|
||||||
|
public void testOpenInExpectInterface() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/modifiers/openInExpectInterface.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("openInInterface.kt")
|
@TestMetadata("openInInterface.kt")
|
||||||
public void testOpenInInterface() throws Exception {
|
public void testOpenInInterface() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/modifiers/openInInterface.kt");
|
runTest("compiler/testData/diagnostics/tests/modifiers/openInInterface.kt");
|
||||||
@@ -15017,6 +15022,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("expectInterfaceApplicability.kt")
|
||||||
|
public void testExpectInterfaceApplicability() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/expectInterfaceApplicability.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("headerFunInNonHeaderClass.kt")
|
@TestMetadata("headerFunInNonHeaderClass.kt")
|
||||||
public void testHeaderFunInNonHeaderClass() throws Exception {
|
public void testHeaderFunInNonHeaderClass() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/multiplatform/headerFunInNonHeaderClass.kt");
|
runTest("compiler/testData/diagnostics/tests/multiplatform/headerFunInNonHeaderClass.kt");
|
||||||
|
|||||||
Generated
+1
-1
@@ -208,7 +208,7 @@ public class MultiplatformAnalysisTestGenerated extends AbstractMultiplatformAna
|
|||||||
runTest("idea/testData/multiplatform/simple/");
|
runTest("idea/testData/multiplatform/simple/");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("simple")
|
@TestMetadata("smartCastOnPropertyFromDependentModule")
|
||||||
public void testSmartCastOnPropertyFromDependentModule() throws Exception {
|
public void testSmartCastOnPropertyFromDependentModule() throws Exception {
|
||||||
runTest("idea/testData/multiplatform/smartCastOnPropertyFromDependentModule/");
|
runTest("idea/testData/multiplatform/smartCastOnPropertyFromDependentModule/");
|
||||||
}
|
}
|
||||||
|
|||||||
-3
@@ -23,9 +23,6 @@ interface CirFunctionOrProperty :
|
|||||||
val returnType: CirType
|
val returnType: CirType
|
||||||
val kind: CallableMemberDescriptor.Kind
|
val kind: CallableMemberDescriptor.Kind
|
||||||
|
|
||||||
fun isNonAbstractMemberInInterface(): Boolean =
|
|
||||||
modality != Modality.ABSTRACT && containingClassDetails?.kind == ClassKind.INTERFACE
|
|
||||||
|
|
||||||
fun isVirtual(): Boolean =
|
fun isVirtual(): Boolean =
|
||||||
visibility != DescriptorVisibilities.PRIVATE
|
visibility != DescriptorVisibilities.PRIVATE
|
||||||
&& modality != Modality.FINAL
|
&& modality != Modality.FINAL
|
||||||
|
|||||||
+1
-2
@@ -29,8 +29,7 @@ abstract class AbstractFunctionOrPropertyCommonizer<T : CirFunctionOrProperty>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun doCommonizeWith(next: T): Boolean =
|
override fun doCommonizeWith(next: T): Boolean =
|
||||||
!next.isNonAbstractMemberInInterface() // non-abstract callable members declared in interface can't be commonized
|
next.kind != DELEGATION // delegated members should not be commonized
|
||||||
&& next.kind != DELEGATION // delegated members should not be commonized
|
|
||||||
&& (next.kind != SYNTHESIZED || next.containingClassDetails?.isData != true) // synthesized members of data classes should not be commonized
|
&& (next.kind != SYNTHESIZED || next.containingClassDetails?.isData != true) // synthesized members of data classes should not be commonized
|
||||||
&& kind == next.kind
|
&& kind == next.kind
|
||||||
&& modality.commonizeWith(next.modality)
|
&& modality.commonizeWith(next.modality)
|
||||||
|
|||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
expect interface Interface {
|
||||||
|
open fun openFun()
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
actual interface Interface {
|
||||||
|
actual fun openFun() = Unit
|
||||||
|
fun openFunWithOtherParams(param: Int) = Unit
|
||||||
|
fun openInJs_abstractInJvm() = Unit
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
actual interface Interface {
|
||||||
|
actual fun openFun() = Unit
|
||||||
|
fun openFunWithOtherParams(param: Double) = Unit
|
||||||
|
fun openInJs_abstractInJvm()
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
interface Interface {
|
||||||
|
fun openFun() = Unit
|
||||||
|
fun openFunWithOtherParams(param: Int) = Unit
|
||||||
|
fun openInJs_abstractInJvm() = Unit
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
interface Interface {
|
||||||
|
fun openFun() = Unit
|
||||||
|
fun openFunWithOtherParams(param: Double) = Unit
|
||||||
|
fun openInJs_abstractInJvm()
|
||||||
|
}
|
||||||
+2
@@ -15,4 +15,6 @@ class CallableMemberCommonizationFromSourcesTest : AbstractCommonizationFromSour
|
|||||||
fun testReturnTypes() = doTestSuccessfulCommonization()
|
fun testReturnTypes() = doTestSuccessfulCommonization()
|
||||||
|
|
||||||
fun testExtensionReceivers() = doTestSuccessfulCommonization()
|
fun testExtensionReceivers() = doTestSuccessfulCommonization()
|
||||||
|
|
||||||
|
fun testOpenCallableMemberInInterface() = doTestSuccessfulCommonization()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user