From 18a536c8465281c9da54df477a514301d87fc3f4 Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Fri, 26 Dec 2014 15:14:29 +0300 Subject: [PATCH] Added test for correct package names resolve inside local classes --- .../tests/LocalClassAndShortSubpackageNames.kt | 17 +++++++++++++++++ .../tests/LocalClassAndShortSubpackageNames.txt | 15 +++++++++++++++ .../checkers/JetDiagnosticsTestGenerated.java | 6 ++++++ 3 files changed, 38 insertions(+) create mode 100644 compiler/testData/diagnostics/tests/LocalClassAndShortSubpackageNames.kt create mode 100644 compiler/testData/diagnostics/tests/LocalClassAndShortSubpackageNames.txt diff --git a/compiler/testData/diagnostics/tests/LocalClassAndShortSubpackageNames.kt b/compiler/testData/diagnostics/tests/LocalClassAndShortSubpackageNames.kt new file mode 100644 index 00000000000..9fad60892f2 --- /dev/null +++ b/compiler/testData/diagnostics/tests/LocalClassAndShortSubpackageNames.kt @@ -0,0 +1,17 @@ +// FILE: A.kt +package foo.bar + +class X + +// FILE: B.kt + +package foo + +fun f() { + class Local1 { + fun g() : bar.X? = null + } + class Local2 { + fun g() : foo.bar.X? = null + } +} diff --git a/compiler/testData/diagnostics/tests/LocalClassAndShortSubpackageNames.txt b/compiler/testData/diagnostics/tests/LocalClassAndShortSubpackageNames.txt new file mode 100644 index 00000000000..cef265cfca7 --- /dev/null +++ b/compiler/testData/diagnostics/tests/LocalClassAndShortSubpackageNames.txt @@ -0,0 +1,15 @@ +package + +package foo { + internal fun f(): kotlin.Unit + + package foo.bar { + + internal final class X { + public constructor X() + 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 + } + } +} diff --git a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java index d440946e384..285105d7d5e 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestGenerated.java @@ -286,6 +286,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { doTest(fileName); } + @TestMetadata("LocalClassAndShortSubpackageNames.kt") + public void testLocalClassAndShortSubpackageNames() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/LocalClassAndShortSubpackageNames.kt"); + doTest(fileName); + } + @TestMetadata("MergePackagesWithJava.kt") public void testMergePackagesWithJava() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/MergePackagesWithJava.kt");