From 51225d3556702f4260f084f4bf5ff09e725eacd3 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Thu, 8 Oct 2015 18:07:40 +0300 Subject: [PATCH] Test for KT-9430: proper visibility of protected members of base class in child classes --- .../diagnostics/tests/scopes/kt9430.kt | 16 +++++++++ .../diagnostics/tests/scopes/kt9430.txt | 34 +++++++++++++++++++ .../checkers/JetDiagnosticsTestGenerated.java | 6 ++++ 3 files changed, 56 insertions(+) create mode 100644 compiler/testData/diagnostics/tests/scopes/kt9430.kt create mode 100644 compiler/testData/diagnostics/tests/scopes/kt9430.txt diff --git a/compiler/testData/diagnostics/tests/scopes/kt9430.kt b/compiler/testData/diagnostics/tests/scopes/kt9430.kt new file mode 100644 index 00000000000..f68468e270c --- /dev/null +++ b/compiler/testData/diagnostics/tests/scopes/kt9430.kt @@ -0,0 +1,16 @@ +open class A { + protected fun foo() {} +} + +class B: A() + +class C: A() { + fun bar() { + A().foo() + B().foo() + } +} + +class D { + fun qux() { B().foo() } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/scopes/kt9430.txt b/compiler/testData/diagnostics/tests/scopes/kt9430.txt new file mode 100644 index 00000000000..a805f619876 --- /dev/null +++ b/compiler/testData/diagnostics/tests/scopes/kt9430.txt @@ -0,0 +1,34 @@ +package + +public open class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + protected 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 +} + +public final class B : A { + public constructor B() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + protected final 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 C : A { + public constructor C() + public final fun bar(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + protected final 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 D { + public constructor D() + 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 final fun qux(): kotlin.Unit + 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 dd4751b473a..955e30bf3a6 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java @@ -12840,6 +12840,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { doTest(fileName); } + @TestMetadata("kt9430.kt") + public void testKt9430() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/scopes/kt9430.kt"); + doTest(fileName); + } + @TestMetadata("NoAmbiguityBetweenRootAndPackage.kt") public void testNoAmbiguityBetweenRootAndPackage() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/scopes/NoAmbiguityBetweenRootAndPackage.kt");