Don't require to override abstract methods in expect class
#KT-16099 Fixed
This commit is contained in:
@@ -32,7 +32,7 @@ import org.jetbrains.kotlin.psi.*
|
|||||||
import org.jetbrains.kotlin.psi.psiUtil.hasActualModifier
|
import org.jetbrains.kotlin.psi.psiUtil.hasActualModifier
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.visibilityModifier
|
import org.jetbrains.kotlin.psi.psiUtil.visibilityModifier
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext.*
|
import org.jetbrains.kotlin.resolve.BindingContext.*
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils.classCanHaveAbstractMembers
|
import org.jetbrains.kotlin.resolve.DescriptorUtils.classCanHaveAbstractDeclaration
|
||||||
import org.jetbrains.kotlin.resolve.DescriptorUtils.classCanHaveOpenMembers
|
import org.jetbrains.kotlin.resolve.DescriptorUtils.classCanHaveOpenMembers
|
||||||
import org.jetbrains.kotlin.resolve.calls.results.TypeSpecificityComparator
|
import org.jetbrains.kotlin.resolve.calls.results.TypeSpecificityComparator
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||||
@@ -585,7 +585,7 @@ class DeclarationsChecker(
|
|||||||
if (modifierList != null) {
|
if (modifierList != null) {
|
||||||
if (modifierList.hasModifier(KtTokens.ABSTRACT_KEYWORD)) {
|
if (modifierList.hasModifier(KtTokens.ABSTRACT_KEYWORD)) {
|
||||||
//has abstract modifier
|
//has abstract modifier
|
||||||
if (!classCanHaveAbstractMembers(classDescriptor)) {
|
if (!classCanHaveAbstractDeclaration(classDescriptor)) {
|
||||||
trace.report(ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS.on(property, property.name ?: "", classDescriptor))
|
trace.report(ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS.on(property, property.name ?: "", classDescriptor))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -705,7 +705,7 @@ class DeclarationsChecker(
|
|||||||
if (containingDescriptor is ClassDescriptor) {
|
if (containingDescriptor is ClassDescriptor) {
|
||||||
val inInterface = containingDescriptor.kind == ClassKind.INTERFACE
|
val inInterface = containingDescriptor.kind == ClassKind.INTERFACE
|
||||||
val isExpectClass = containingDescriptor.isExpect
|
val isExpectClass = containingDescriptor.isExpect
|
||||||
if (hasAbstractModifier && !classCanHaveAbstractMembers(containingDescriptor)) {
|
if (hasAbstractModifier && !classCanHaveAbstractDeclaration(containingDescriptor)) {
|
||||||
trace.report(ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS.on(function, functionDescriptor.name.asString(), containingDescriptor))
|
trace.report(ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS.on(function, functionDescriptor.name.asString(), containingDescriptor))
|
||||||
}
|
}
|
||||||
val hasBody = function.hasBody()
|
val hasBody = function.hasBody()
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import org.jetbrains.kotlin.diagnostics.Errors.*
|
|||||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||||
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.resolve.DescriptorUtils.classCanHaveAbstractMembers
|
import org.jetbrains.kotlin.resolve.DescriptorUtils.classCanHaveAbstractFakeOverride
|
||||||
import org.jetbrains.kotlin.resolve.OverridingUtil.OverrideCompatibilityInfo.Result.OVERRIDABLE
|
import org.jetbrains.kotlin.resolve.OverridingUtil.OverrideCompatibilityInfo.Result.OVERRIDABLE
|
||||||
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.isOrOverridesSynthesized
|
import org.jetbrains.kotlin.resolve.calls.callResolverUtil.isOrOverridesSynthesized
|
||||||
import org.jetbrains.kotlin.types.*
|
import org.jetbrains.kotlin.types.*
|
||||||
@@ -211,7 +211,7 @@ class OverrideResolver(
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal fun doReportErrors() {
|
internal fun doReportErrors() {
|
||||||
val canHaveAbstractMembers = classCanHaveAbstractMembers(classDescriptor)
|
val canHaveAbstractMembers = classCanHaveAbstractFakeOverride(classDescriptor)
|
||||||
if (abstractInBaseClassNoImpl.isNotEmpty() && !canHaveAbstractMembers) {
|
if (abstractInBaseClassNoImpl.isNotEmpty() && !canHaveAbstractMembers) {
|
||||||
trace.report(ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED.on(klass, klass, abstractInBaseClassNoImpl.first()))
|
trace.report(ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED.on(klass, klass, abstractInBaseClassNoImpl.first()))
|
||||||
}
|
}
|
||||||
|
|||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
// !LANGUAGE: +MultiPlatformProjects
|
||||||
|
// MODULE: m1-common
|
||||||
|
// FILE: common.kt
|
||||||
|
|
||||||
|
interface Foo {
|
||||||
|
fun foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
expect class ImplicitFoo : Foo
|
||||||
|
|
||||||
|
expect class ExplicitFoo : Foo {
|
||||||
|
override fun foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
expect class ImplicitFooCheck : Foo
|
||||||
|
|
||||||
|
// MODULE: m2-jvm(m1-common)
|
||||||
|
// FILE: jvm.kt
|
||||||
|
|
||||||
|
actual class ImplicitFoo : Foo {
|
||||||
|
override fun foo() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
actual class ExplicitFoo : Foo {
|
||||||
|
actual override fun foo() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
actual <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class ImplicitFooCheck<!> : Foo
|
||||||
+65
@@ -0,0 +1,65 @@
|
|||||||
|
// -- Module: <m1-common> --
|
||||||
|
package
|
||||||
|
|
||||||
|
public final expect class ExplicitFoo : Foo {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open expect 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 interface Foo {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract 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 expect class ImplicitFoo : Foo {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract 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 expect class ImplicitFooCheck : Foo {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract 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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- Module: <m2-jvm> --
|
||||||
|
package
|
||||||
|
|
||||||
|
public final actual class ExplicitFoo : Foo {
|
||||||
|
public constructor ExplicitFoo()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open actual 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 interface Foo {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract 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 actual class ImplicitFoo : Foo {
|
||||||
|
public constructor ImplicitFoo()
|
||||||
|
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 final actual class ImplicitFooCheck : Foo {
|
||||||
|
public constructor ImplicitFooCheck()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract 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
|
||||||
|
}
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
// !LANGUAGE: +MultiPlatformProjects
|
||||||
|
// MODULE: m1-common
|
||||||
|
// FILE: common.kt
|
||||||
|
|
||||||
|
interface Foo {
|
||||||
|
fun foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
expect class NonAbstractClass : Foo {
|
||||||
|
<!ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS!>abstract<!> fun bar()
|
||||||
|
|
||||||
|
<!ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS!>abstract<!> val baz: Int
|
||||||
|
|
||||||
|
<!ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS!>abstract<!> override fun foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
expect abstract class AbstractClass : Foo {
|
||||||
|
abstract fun bar()
|
||||||
|
|
||||||
|
abstract val baz: Int
|
||||||
|
|
||||||
|
abstract override fun foo()
|
||||||
|
}
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public abstract expect class AbstractClass : Foo {
|
||||||
|
public expect abstract val baz: kotlin.Int
|
||||||
|
public abstract expect fun bar(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract expect 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 interface Foo {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract 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 expect class NonAbstractClass : Foo {
|
||||||
|
public expect abstract val baz: kotlin.Int
|
||||||
|
public abstract expect fun bar(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract expect 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
|
||||||
|
}
|
||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
// !LANGUAGE: +MultiPlatformProjects
|
||||||
|
// MODULE: m1-common
|
||||||
|
// FILE: common.kt
|
||||||
|
|
||||||
|
expect abstract class Base {
|
||||||
|
abstract fun foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
expect class DerivedImplicit : Base
|
||||||
|
|
||||||
|
expect class DerivedExplicit : Base {
|
||||||
|
override fun foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
expect class DerivedExplicitCheck : Base {
|
||||||
|
override fun foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: m2-jvm(m1-common)
|
||||||
|
// FILE: jvm.kt
|
||||||
|
|
||||||
|
actual abstract class Base {
|
||||||
|
actual abstract fun foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
actual class DerivedImplicit : Base() {
|
||||||
|
override fun foo() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
actual class DerivedExplicit : Base() {
|
||||||
|
actual override fun foo() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
actual class DerivedExplicitCheck : Base() {
|
||||||
|
override fun <!ACTUAL_MISSING!>foo<!>() {}
|
||||||
|
}
|
||||||
+66
@@ -0,0 +1,66 @@
|
|||||||
|
// -- Module: <m1-common> --
|
||||||
|
package
|
||||||
|
|
||||||
|
public abstract expect class Base {
|
||||||
|
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 expect class DerivedExplicit : Base {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open expect 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 final expect class DerivedExplicitCheck : Base {
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open expect 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 final expect class DerivedImplicit : Base {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- Module: <m2-jvm> --
|
||||||
|
package
|
||||||
|
|
||||||
|
public abstract actual class Base {
|
||||||
|
public constructor Base()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public abstract actual 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 actual class DerivedExplicit : Base {
|
||||||
|
public constructor DerivedExplicit()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open actual 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 final actual class DerivedExplicitCheck : Base {
|
||||||
|
public constructor DerivedExplicitCheck()
|
||||||
|
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 final actual class DerivedImplicit : Base {
|
||||||
|
public constructor DerivedImplicit()
|
||||||
|
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
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
expect abstract class Base {
|
||||||
|
abstract fun foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
expect class DerivedImplicit : Base
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
actual abstract class Base {
|
||||||
|
actual abstract fun foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
actual class DerivedImplicit : Base() {
|
||||||
|
override fun foo() {}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
-- Common --
|
||||||
|
Exit code: OK
|
||||||
|
Output:
|
||||||
|
|
||||||
|
-- JVM --
|
||||||
|
Exit code: OK
|
||||||
|
Output:
|
||||||
@@ -14067,6 +14067,18 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("dontOverrideMethodsFromInterfaceInCommonCode.kt")
|
||||||
|
public void testDontOverrideMethodsFromInterfaceInCommonCode() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/multiplatform/headerClass/dontOverrideMethodsFromInterfaceInCommonCode.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("expectClassWithExplicitAbstractMember.kt")
|
||||||
|
public void testExpectClassWithExplicitAbstractMember() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/multiplatform/headerClass/expectClassWithExplicitAbstractMember.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("expectClassWithoutConstructor.kt")
|
@TestMetadata("expectClassWithoutConstructor.kt")
|
||||||
public void testExpectClassWithoutConstructor() throws Exception {
|
public void testExpectClassWithoutConstructor() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/multiplatform/headerClass/expectClassWithoutConstructor.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/multiplatform/headerClass/expectClassWithoutConstructor.kt");
|
||||||
@@ -14079,6 +14091,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("extendExpectedClassWithoutExplicitOverrideOfMethod.kt")
|
||||||
|
public void testExtendExpectedClassWithoutExplicitOverrideOfMethod() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/multiplatform/headerClass/extendExpectedClassWithoutExplicitOverrideOfMethod.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("extraHeaderOnMembers.kt")
|
@TestMetadata("extraHeaderOnMembers.kt")
|
||||||
public void testExtraHeaderOnMembers() throws Exception {
|
public void testExtraHeaderOnMembers() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/multiplatform/headerClass/extraHeaderOnMembers.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/multiplatform/headerClass/extraHeaderOnMembers.kt");
|
||||||
|
|||||||
+18
@@ -14067,6 +14067,18 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("dontOverrideMethodsFromInterfaceInCommonCode.kt")
|
||||||
|
public void testDontOverrideMethodsFromInterfaceInCommonCode() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/multiplatform/headerClass/dontOverrideMethodsFromInterfaceInCommonCode.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("expectClassWithExplicitAbstractMember.kt")
|
||||||
|
public void testExpectClassWithExplicitAbstractMember() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/multiplatform/headerClass/expectClassWithExplicitAbstractMember.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("expectClassWithoutConstructor.kt")
|
@TestMetadata("expectClassWithoutConstructor.kt")
|
||||||
public void testExpectClassWithoutConstructor() throws Exception {
|
public void testExpectClassWithoutConstructor() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/multiplatform/headerClass/expectClassWithoutConstructor.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/multiplatform/headerClass/expectClassWithoutConstructor.kt");
|
||||||
@@ -14079,6 +14091,12 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("extendExpectedClassWithoutExplicitOverrideOfMethod.kt")
|
||||||
|
public void testExtendExpectedClassWithoutExplicitOverrideOfMethod() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/multiplatform/headerClass/extendExpectedClassWithoutExplicitOverrideOfMethod.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("extraHeaderOnMembers.kt")
|
@TestMetadata("extraHeaderOnMembers.kt")
|
||||||
public void testExtraHeaderOnMembers() throws Exception {
|
public void testExtraHeaderOnMembers() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/multiplatform/headerClass/extraHeaderOnMembers.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/multiplatform/headerClass/extraHeaderOnMembers.kt");
|
||||||
|
|||||||
+6
@@ -54,6 +54,12 @@ public class MultiPlatformIntegrationTestGenerated extends AbstractMultiPlatform
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("explicitActualOnOverrideOfAbstractMethod")
|
||||||
|
public void testExplicitActualOnOverrideOfAbstractMethod() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/multiplatform/explicitActualOnOverrideOfAbstractMethod/");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("genericDeclarations")
|
@TestMetadata("genericDeclarations")
|
||||||
public void testGenericDeclarations() throws Exception {
|
public void testGenericDeclarations() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/multiplatform/genericDeclarations/");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/multiplatform/genericDeclarations/");
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2016 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -458,7 +458,11 @@ public class DescriptorUtils {
|
|||||||
KotlinTypeChecker.DEFAULT.equalTypes(builtIns.getAnyType(), type);
|
KotlinTypeChecker.DEFAULT.equalTypes(builtIns.getAnyType(), type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean classCanHaveAbstractMembers(@NotNull ClassDescriptor classDescriptor) {
|
public static boolean classCanHaveAbstractFakeOverride(@NotNull ClassDescriptor classDescriptor) {
|
||||||
|
return classCanHaveAbstractDeclaration(classDescriptor) || classDescriptor.isExpect();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean classCanHaveAbstractDeclaration(@NotNull ClassDescriptor classDescriptor) {
|
||||||
return classDescriptor.getModality() == Modality.ABSTRACT
|
return classDescriptor.getModality() == Modality.ABSTRACT
|
||||||
|| isSealedClass(classDescriptor)
|
|| isSealedClass(classDescriptor)
|
||||||
|| classDescriptor.getKind() == ClassKind.ENUM_CLASS;
|
|| classDescriptor.getKind() == ClassKind.ENUM_CLASS;
|
||||||
|
|||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
// "Implement members" "false"
|
||||||
|
// ACTION: Create test
|
||||||
|
// ACTION: Make internal
|
||||||
|
// ACTION: Make private
|
||||||
|
// ACTION: Move 'A' to separate file
|
||||||
|
|
||||||
|
interface I {
|
||||||
|
fun foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Suppress("UNSUPPORTED_FEATURE")
|
||||||
|
expect <caret>class A : I
|
||||||
@@ -8072,6 +8072,12 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("dontOfferToImplementMembersForExpectedClass.kt")
|
||||||
|
public void testDontOfferToImplementMembersForExpectedClass() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/override/dontOfferToImplementMembersForExpectedClass.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("implemenAsConstructorParameter.kt")
|
@TestMetadata("implemenAsConstructorParameter.kt")
|
||||||
public void testImplemenAsConstructorParameter() throws Exception {
|
public void testImplemenAsConstructorParameter() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/override/implemenAsConstructorParameter.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/override/implemenAsConstructorParameter.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user