diff --git a/compiler/testData/diagnostics/tests/inference/kt28598.kt b/compiler/testData/diagnostics/tests/inference/kt28598.kt new file mode 100644 index 00000000000..ebf15016ee6 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/kt28598.kt @@ -0,0 +1,85 @@ +// !WITH_NEW_INFERENCE +// !IDIAGNOSTICS: -UNUSED_EXPRESSION + +fun case_1(a: MutableList?>?>?>?>?>?>?) { + if (a != null) { + val b = a[0] // no SMARTCAST diagnostic + if (b != null) { + val c = b[0] + if (c != null) { + val d = c[0] + if (d != null) { + val e = d[0] + if (e != null) { + val f = e[0] + if (f != null) { + val g = f[0] + if (g != null) { + val h = g[0] + if (h != null) { + h.inc() + } + } + } + } + } + } + } + } +} + + +fun case_2(a: MutableList?>?>?>?>?>?>?) { + if (a != null) { + val b = a[0] // no SMARTCAST diagnostic + if (b != null) { + val c = b[0] + if (c != null) { + val d = c[0] + if (d != null) { + val e = d[0] // no SMARTCAST diagnostic + if (e != null) { + val f = e[0] + if (f != null) { + val g = f[0] + if (g != null) { + val h = g[0] // no SMARTCAST diagnostic + if (h != null) { + h.inc() + } + } + } + } + } + } + } + } +} + + +fun case_3(a: MutableList?>?>?>?>?>?>?) { + if (a != null) { + val b = a[0] + if (b != null) { + val c = b[0] + if (c != null) { + val d = c[0] + if (d != null) { + val e = d[0] + if (e != null) { + val f = e[0] + if (f != null) { + val g = f[0] + if (g != null) { + val h = g[0] + if (h != null) { + h.inc() + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/kt28598.txt b/compiler/testData/diagnostics/tests/inference/kt28598.txt new file mode 100644 index 00000000000..faec0ef8ebf --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/kt28598.txt @@ -0,0 +1,5 @@ +package + +public fun case_1(/*0*/ a: kotlin.collections.MutableList?>?>?>?>?>?): kotlin.Unit +public fun case_2(/*0*/ a: kotlin.collections.MutableList?>?>?>?>?>?): kotlin.Unit +public fun case_3(/*0*/ a: kotlin.collections.MutableList?>?>?>?>?): kotlin.Unit diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index 7205d6b987d..bbc55994f25 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -9485,6 +9485,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { runTest("compiler/testData/diagnostics/tests/inference/kt1293.kt"); } + @TestMetadata("kt28598.kt") + public void testKt28598() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/kt28598.kt"); + } + @TestMetadata("kt3184.kt") public void testKt3184() throws Exception { runTest("compiler/testData/diagnostics/tests/inference/kt3184.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java index 6559a239a09..6c2d82ef8f0 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java @@ -9485,6 +9485,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing runTest("compiler/testData/diagnostics/tests/inference/kt1293.kt"); } + @TestMetadata("kt28598.kt") + public void testKt28598() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/kt28598.kt"); + } + @TestMetadata("kt3184.kt") public void testKt3184() throws Exception { runTest("compiler/testData/diagnostics/tests/inference/kt3184.kt");