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")