diff --git a/compiler/testData/diagnostics/tests/scopes/visibility3.kt b/compiler/testData/diagnostics/tests/scopes/visibility3.kt new file mode 100644 index 00000000000..9b59078202f --- /dev/null +++ b/compiler/testData/diagnostics/tests/scopes/visibility3.kt @@ -0,0 +1,47 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE + +//FILE:file1.kt +package a + +private open class A { + fun bar() {} +} + +private var x: Int = 10 + +private fun foo() {} + +private fun bar() { + val y = x + x = 20 +} + +fun makeA() = A() + +private object PO {} + +//FILE:file2.kt +package a + +fun test() { + val y = makeA() + y.bar() + foo() + + val u : A = A() + + val z = x + x = 30 + + val po = PO +} + +class B : A() {} + +class Q { + class W { + fun foo() { + val y = makeA() //assure that 'makeA' is visible + } + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/scopes/visibility3.txt b/compiler/testData/diagnostics/tests/scopes/visibility3.txt new file mode 100644 index 00000000000..408015ac415 --- /dev/null +++ b/compiler/testData/diagnostics/tests/scopes/visibility3.txt @@ -0,0 +1,47 @@ +package + +package a { + private var x: kotlin.Int + private fun bar(): kotlin.Unit + private fun foo(): kotlin.Unit + public fun makeA(): a.A + public fun test(): kotlin.Unit + + private open class A { + public constructor A() + public final fun bar(): 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 override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + public final class B : a.A { + public constructor B() + public final override /*1*/ /*fake_override*/ fun bar(): 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 override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + private object PO { + private constructor PO() + 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 Q { + public constructor Q() + 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 W { + public constructor W() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final fun foo(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } +} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java index 1ee8ee8f908..c591ee9830a 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java @@ -12735,6 +12735,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { doTest(fileName); } + @TestMetadata("visibility3.kt") + public void testVisibility3() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/scopes/visibility3.kt"); + doTest(fileName); + } + @TestMetadata("VisibilityInClassObject.kt") public void testVisibilityInClassObject() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/scopes/VisibilityInClassObject.kt");