[FIR] Don't report EXPOSED_FUNCTION_RETURN_TYPE on property accessors

This commit is contained in:
Dmitriy Novozhilov
2021-06-30 15:09:42 +03:00
committed by TeamCityServer
parent 3a34a2ca62
commit f7c68afb18
7 changed files with 69 additions and 1 deletions
@@ -30930,6 +30930,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
public void testLackOfInvisibleSetterOfJavaClassInSamePackage() throws Exception {
runTest("compiler/testData/diagnostics/tests/visibility/lackOfInvisibleSetterOfJavaClassInSamePackage.kt");
}
@Test
@TestMetadata("protectedInternal.kt")
public void testProtectedInternal() throws Exception {
runTest("compiler/testData/diagnostics/tests/visibility/protectedInternal.kt");
}
}
@Nested
@@ -30930,6 +30930,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
public void testLackOfInvisibleSetterOfJavaClassInSamePackage() throws Exception {
runTest("compiler/testData/diagnostics/tests/visibility/lackOfInvisibleSetterOfJavaClassInSamePackage.kt");
}
@Test
@TestMetadata("protectedInternal.kt")
public void testProtectedInternal() throws Exception {
runTest("compiler/testData/diagnostics/tests/visibility/protectedInternal.kt");
}
}
@Nested
@@ -110,7 +110,7 @@ object FirExposedVisibilityDeclarationChecker : FirBasicDeclarationChecker() {
val functionVisibility = (declaration as FirMemberDeclaration).effectiveVisibility
if (functionVisibility == EffectiveVisibility.Local) return
if (declaration !is FirConstructor) {
if (declaration !is FirConstructor && declaration !is FirPropertyAccessor) {
val restricting = declaration.returnTypeRef.coneTypeSafe<ConeKotlinType>()
?.findVisibilityExposure(context, functionVisibility)
if (restricting != null) {
@@ -0,0 +1,13 @@
// FIR_IDENTICAL
abstract class A
internal class B : A()
abstract class Base {
protected abstract val a: A
}
internal class Derived : Base() {
override val a = B()
get() = field
}
@@ -0,0 +1,31 @@
package
public abstract class A {
public constructor A()
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
}
internal final class B : A {
public constructor B()
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 abstract class Base {
public constructor Base()
protected abstract val a: A
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
}
internal final class Derived : Base {
public constructor Derived()
protected open override /*1*/ val a: B
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
}
@@ -31026,6 +31026,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
public void testLackOfInvisibleSetterOfJavaClassInSamePackage() throws Exception {
runTest("compiler/testData/diagnostics/tests/visibility/lackOfInvisibleSetterOfJavaClassInSamePackage.kt");
}
@Test
@TestMetadata("protectedInternal.kt")
public void testProtectedInternal() throws Exception {
runTest("compiler/testData/diagnostics/tests/visibility/protectedInternal.kt");
}
}
@Nested
@@ -30930,6 +30930,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
public void testLackOfInvisibleSetterOfJavaClassInSamePackage() throws Exception {
runTest("compiler/testData/diagnostics/tests/visibility/lackOfInvisibleSetterOfJavaClassInSamePackage.kt");
}
@Test
@TestMetadata("protectedInternal.kt")
public void testProtectedInternal() throws Exception {
runTest("compiler/testData/diagnostics/tests/visibility/protectedInternal.kt");
}
}
@Nested