Consider property external if all accessors are external #KT-13997 Fixed
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
// See KT-13997
|
||||||
|
|
||||||
|
class Foo {
|
||||||
|
var bar: Int // Ok
|
||||||
|
external get
|
||||||
|
external set
|
||||||
|
}
|
||||||
|
|
||||||
|
class Bar {
|
||||||
|
val foo: Int // Ok
|
||||||
|
external get
|
||||||
|
|
||||||
|
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>var baz: Int<!>
|
||||||
|
external get
|
||||||
|
|
||||||
|
<!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>var gav: Int<!>
|
||||||
|
external set
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public final class Bar {
|
||||||
|
public constructor Bar()
|
||||||
|
public final var baz: kotlin.Int
|
||||||
|
public final val foo: kotlin.Int
|
||||||
|
public final var gav: kotlin.Int
|
||||||
|
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 class Foo {
|
||||||
|
public constructor Foo()
|
||||||
|
public final var bar: kotlin.Int
|
||||||
|
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
|
||||||
|
}
|
||||||
@@ -254,6 +254,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("ExternalAccessors.kt")
|
||||||
|
public void testExternalAccessors() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/ExternalAccessors.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("ExternalAndAbstract.kt")
|
@TestMetadata("ExternalAndAbstract.kt")
|
||||||
public void testExternalAndAbstract() throws Exception {
|
public void testExternalAndAbstract() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/ExternalAndAbstract.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/ExternalAndAbstract.kt");
|
||||||
|
|||||||
@@ -422,6 +422,11 @@ fun MemberDescriptor.isEffectivelyExternal(): Boolean {
|
|||||||
if (variableDescriptor.isEffectivelyExternal()) return true
|
if (variableDescriptor.isEffectivelyExternal()) return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this is PropertyDescriptor) {
|
||||||
|
if (getter?.isExternal == true &&
|
||||||
|
(!isVar || setter?.isExternal == true)) return true
|
||||||
|
}
|
||||||
|
|
||||||
val containingClass = getContainingClass(this)
|
val containingClass = getContainingClass(this)
|
||||||
return containingClass != null && containingClass.isEffectivelyExternal()
|
return containingClass != null && containingClass.isEffectivelyExternal()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user