From 162a2d58514884e702690e9dbe20a4405d1cc107 Mon Sep 17 00:00:00 2001 From: Mikhail Zarechenskiy Date: Thu, 20 Feb 2020 02:49:48 +0300 Subject: [PATCH] [NI] Add test to check how behavior will be changed after few commits --- .../fir/FirOldFrontendDiagnosticsTestGenerated.java | 5 +++++ ...bilityOfSmartcastsAgainstGenericFunctions.fir.kt | 13 +++++++++++++ .../stabilityOfSmartcastsAgainstGenericFunctions.kt | 13 +++++++++++++ ...stabilityOfSmartcastsAgainstGenericFunctions.txt | 12 ++++++++++++ .../kotlin/checkers/DiagnosticsTestGenerated.java | 5 +++++ .../javac/DiagnosticsUsingJavacTestGenerated.java | 5 +++++ 6 files changed, 53 insertions(+) create mode 100644 compiler/testData/diagnostics/tests/smartCasts/inference/stabilityOfSmartcastsAgainstGenericFunctions.fir.kt create mode 100644 compiler/testData/diagnostics/tests/smartCasts/inference/stabilityOfSmartcastsAgainstGenericFunctions.kt create mode 100644 compiler/testData/diagnostics/tests/smartCasts/inference/stabilityOfSmartcastsAgainstGenericFunctions.txt diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java index 1cdaba2c5e9..6b61f0c0339 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java @@ -21215,6 +21215,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte public void testSmartCastOnReceiver() throws Exception { runTest("compiler/testData/diagnostics/tests/smartCasts/inference/smartCastOnReceiver.kt"); } + + @TestMetadata("stabilityOfSmartcastsAgainstGenericFunctions.kt") + public void testStabilityOfSmartcastsAgainstGenericFunctions() throws Exception { + runTest("compiler/testData/diagnostics/tests/smartCasts/inference/stabilityOfSmartcastsAgainstGenericFunctions.kt"); + } } @TestMetadata("compiler/testData/diagnostics/tests/smartCasts/intersectionScope") diff --git a/compiler/testData/diagnostics/tests/smartCasts/inference/stabilityOfSmartcastsAgainstGenericFunctions.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/inference/stabilityOfSmartcastsAgainstGenericFunctions.fir.kt new file mode 100644 index 00000000000..7ef7f5b09b0 --- /dev/null +++ b/compiler/testData/diagnostics/tests/smartCasts/inference/stabilityOfSmartcastsAgainstGenericFunctions.fir.kt @@ -0,0 +1,13 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_LAMBDA_EXPRESSION -VARIABLE_WITH_REDUNDANT_INITIALIZER -UNUSED_EXPRESSION + +object Test { + fun foo(actual: T) {} + fun foo(actual: T) {} +} + +fun main() { + var y: Number? = null + y = 2 + { y = 1 } + Test.foo(y) +} diff --git a/compiler/testData/diagnostics/tests/smartCasts/inference/stabilityOfSmartcastsAgainstGenericFunctions.kt b/compiler/testData/diagnostics/tests/smartCasts/inference/stabilityOfSmartcastsAgainstGenericFunctions.kt new file mode 100644 index 00000000000..d56545ff296 --- /dev/null +++ b/compiler/testData/diagnostics/tests/smartCasts/inference/stabilityOfSmartcastsAgainstGenericFunctions.kt @@ -0,0 +1,13 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_LAMBDA_EXPRESSION -VARIABLE_WITH_REDUNDANT_INITIALIZER -UNUSED_EXPRESSION + +object Test { + fun foo(actual: T) {} + fun foo(actual: T) {} +} + +fun main() { + var y: Number? = null + y = 2 + { y = 1 } + Test.foo(y) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/inference/stabilityOfSmartcastsAgainstGenericFunctions.txt b/compiler/testData/diagnostics/tests/smartCasts/inference/stabilityOfSmartcastsAgainstGenericFunctions.txt new file mode 100644 index 00000000000..843affd028d --- /dev/null +++ b/compiler/testData/diagnostics/tests/smartCasts/inference/stabilityOfSmartcastsAgainstGenericFunctions.txt @@ -0,0 +1,12 @@ +package + +public fun main(): kotlin.Unit + +public object Test { + private constructor Test() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final fun foo(/*0*/ actual: T): kotlin.Unit + public final fun foo(/*0*/ actual: T): 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/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 9ecfe94603e..783dd0e9ce6 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -21292,6 +21292,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { public void testSmartCastOnReceiver() throws Exception { runTest("compiler/testData/diagnostics/tests/smartCasts/inference/smartCastOnReceiver.kt"); } + + @TestMetadata("stabilityOfSmartcastsAgainstGenericFunctions.kt") + public void testStabilityOfSmartcastsAgainstGenericFunctions() throws Exception { + runTest("compiler/testData/diagnostics/tests/smartCasts/inference/stabilityOfSmartcastsAgainstGenericFunctions.kt"); + } } @TestMetadata("compiler/testData/diagnostics/tests/smartCasts/intersectionScope") diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java index d33f5a1ae89..f1df77aa662 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java @@ -21217,6 +21217,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing public void testSmartCastOnReceiver() throws Exception { runTest("compiler/testData/diagnostics/tests/smartCasts/inference/smartCastOnReceiver.kt"); } + + @TestMetadata("stabilityOfSmartcastsAgainstGenericFunctions.kt") + public void testStabilityOfSmartcastsAgainstGenericFunctions() throws Exception { + runTest("compiler/testData/diagnostics/tests/smartCasts/inference/stabilityOfSmartcastsAgainstGenericFunctions.kt"); + } } @TestMetadata("compiler/testData/diagnostics/tests/smartCasts/intersectionScope")