From 97d8f3fa4b9ebfccef3885958d21e4382f3c1e81 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 21 Jan 2020 16:36:23 +0300 Subject: [PATCH] [FIR TEST] Add test for erroneous callable reference resolve --- .../resolve/expresssions/errCallable.kt | 13 +++++++++ .../resolve/expresssions/errCallable.txt | 27 +++++++++++++++++++ .../fir/FirDiagnosticsTestGenerated.java | 5 ++++ ...DiagnosticsWithLightTreeTestGenerated.java | 5 ++++ 4 files changed, 50 insertions(+) create mode 100644 compiler/fir/resolve/testData/resolve/expresssions/errCallable.kt create mode 100644 compiler/fir/resolve/testData/resolve/expresssions/errCallable.txt diff --git a/compiler/fir/resolve/testData/resolve/expresssions/errCallable.kt b/compiler/fir/resolve/testData/resolve/expresssions/errCallable.kt new file mode 100644 index 00000000000..9dcb5c85aba --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/expresssions/errCallable.kt @@ -0,0 +1,13 @@ +class Your { + class Nested +} + +class My { + fun foo() { + val x = ::Nested // Should be error + } +} + +fun Your.foo() { + val x = ::Nested // Still should be error +} \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/expresssions/errCallable.txt b/compiler/fir/resolve/testData/resolve/expresssions/errCallable.txt new file mode 100644 index 00000000000..b8ae98e1c27 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/expresssions/errCallable.txt @@ -0,0 +1,27 @@ +FILE: errCallable.kt + public final class Your : R|kotlin/Any| { + public constructor(): R|Your| { + super() + } + + public final class Nested : R|kotlin/Any| { + public constructor(): R|Your.Nested| { + super() + } + + } + + } + public final class My : R|kotlin/Any| { + public constructor(): R|My| { + super() + } + + public final fun foo(): R|kotlin/Unit| { + lval x: = ::Nested# + } + + } + public final fun R|Your|.foo(): R|kotlin/Unit| { + lval x: = ::Nested# + } 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 bd9cc52d3a3..f6d5da92ed4 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java @@ -459,6 +459,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest { runTest("compiler/fir/resolve/testData/resolve/expresssions/enumValues.kt"); } + @TestMetadata("errCallable.kt") + public void testErrCallable() throws Exception { + runTest("compiler/fir/resolve/testData/resolve/expresssions/errCallable.kt"); + } + @TestMetadata("extensionPropertyInLambda.kt") public void testExtensionPropertyInLambda() throws Exception { runTest("compiler/fir/resolve/testData/resolve/expresssions/extensionPropertyInLambda.kt"); diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java index f2dcd9bebf8..fb9528f0a63 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithLightTreeTestGenerated.java @@ -459,6 +459,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos runTest("compiler/fir/resolve/testData/resolve/expresssions/enumValues.kt"); } + @TestMetadata("errCallable.kt") + public void testErrCallable() throws Exception { + runTest("compiler/fir/resolve/testData/resolve/expresssions/errCallable.kt"); + } + @TestMetadata("extensionPropertyInLambda.kt") public void testExtensionPropertyInLambda() throws Exception { runTest("compiler/fir/resolve/testData/resolve/expresssions/extensionPropertyInLambda.kt");