From bb89fee43150a9b70eae72894bf530622f322c1c Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Thu, 28 Nov 2019 11:59:52 +0300 Subject: [PATCH] [FIR-TEST] Add test with ambiguity in static java scopes --- .../problems/javaStaticScopeInheritance.kt | 17 +++++++++++++++++ .../problems/javaStaticScopeInheritance.txt | 4 ++++ .../kotlin/fir/FirDiagnosticsTestGenerated.java | 5 +++++ 3 files changed, 26 insertions(+) create mode 100644 compiler/fir/resolve/testData/resolve/problems/javaStaticScopeInheritance.kt create mode 100644 compiler/fir/resolve/testData/resolve/problems/javaStaticScopeInheritance.txt diff --git a/compiler/fir/resolve/testData/resolve/problems/javaStaticScopeInheritance.kt b/compiler/fir/resolve/testData/resolve/problems/javaStaticScopeInheritance.kt new file mode 100644 index 00000000000..e23765ceb2e --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/problems/javaStaticScopeInheritance.kt @@ -0,0 +1,17 @@ +// FILE: A.java + +class A { + public static final A VALUE = new A(); +} + +// FILE: B.java + +class B extends A { + public static final B VALUE = new B(); +} + +// FILE: main.kt + +fun main() { + val b = B.VALUE // <- should be B +} diff --git a/compiler/fir/resolve/testData/resolve/problems/javaStaticScopeInheritance.txt b/compiler/fir/resolve/testData/resolve/problems/javaStaticScopeInheritance.txt new file mode 100644 index 00000000000..d8cd5ce8392 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/problems/javaStaticScopeInheritance.txt @@ -0,0 +1,4 @@ +FILE: main.kt + public final fun main(): R|kotlin/Unit| { + lval b: = Q|B|.# + } diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java index 04ce660cba7..e225e2f683c 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java @@ -893,6 +893,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest { runTest("compiler/fir/resolve/testData/resolve/problems/javaFieldVsAccessor.kt"); } + @TestMetadata("javaStaticScopeInheritance.kt") + public void testJavaStaticScopeInheritance() throws Exception { + runTest("compiler/fir/resolve/testData/resolve/problems/javaStaticScopeInheritance.kt"); + } + @TestMetadata("localFunctionsHiding.kt") public void testLocalFunctionsHiding() throws Exception { runTest("compiler/fir/resolve/testData/resolve/problems/localFunctionsHiding.kt");