From a4d6f72ad107af7a5501c837a12f87adfa0d9893 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Thu, 7 Feb 2019 14:35:33 +0300 Subject: [PATCH] Split testdata of #KT-25432 and #KT-29767 --- .../diagnostics/tests/smartCasts/inference/kt25432.kt | 11 ++--------- .../tests/smartCasts/inference/kt25432.txt | 3 +-- .../diagnostics/tests/smartCasts/inference/kt29767.kt | 11 +++++++++++ .../tests/smartCasts/inference/kt29767.txt | 3 +++ .../kotlin/checkers/DiagnosticsTestGenerated.java | 5 +++++ .../javac/DiagnosticsUsingJavacTestGenerated.java | 5 +++++ 6 files changed, 27 insertions(+), 11 deletions(-) create mode 100644 compiler/testData/diagnostics/tests/smartCasts/inference/kt29767.kt create mode 100644 compiler/testData/diagnostics/tests/smartCasts/inference/kt29767.txt diff --git a/compiler/testData/diagnostics/tests/smartCasts/inference/kt25432.kt b/compiler/testData/diagnostics/tests/smartCasts/inference/kt25432.kt index 1d63a3fb291..053c23e3092 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/inference/kt25432.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/inference/kt25432.kt @@ -1,18 +1,11 @@ // !WITH_NEW_INFERENCE +// ISSUE: KT-25432 class Data(val s: T) -fun test_1(d: Data) { +fun test(d: Data) { if (d.s is String) { d.s.length } } -fun test_2(a: MutableList?) { - if (a != null) { - val b = a[0] // no SMARTCAST diagnostic - if (b != null) { - b.inc() - } - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/inference/kt25432.txt b/compiler/testData/diagnostics/tests/smartCasts/inference/kt25432.txt index d8b56a60e39..bdb8cfce41c 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/inference/kt25432.txt +++ b/compiler/testData/diagnostics/tests/smartCasts/inference/kt25432.txt @@ -1,7 +1,6 @@ package -public fun test_1(/*0*/ d: Data): kotlin.Unit -public fun test_2(/*0*/ a: kotlin.collections.MutableList?): kotlin.Unit +public fun test(/*0*/ d: Data): kotlin.Unit public final class Data { public constructor Data(/*0*/ s: T) diff --git a/compiler/testData/diagnostics/tests/smartCasts/inference/kt29767.kt b/compiler/testData/diagnostics/tests/smartCasts/inference/kt29767.kt new file mode 100644 index 00000000000..46f081df69c --- /dev/null +++ b/compiler/testData/diagnostics/tests/smartCasts/inference/kt29767.kt @@ -0,0 +1,11 @@ +// !WITH_NEW_INFERENCE +// ISSUE: KT-29767 + +fun test(a: MutableList?) { + if (a != null) { + val b = a[0] // no SMARTCAST diagnostic + if (b != null) { + b.inc() + } + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/inference/kt29767.txt b/compiler/testData/diagnostics/tests/smartCasts/inference/kt29767.txt new file mode 100644 index 00000000000..f0667242d9f --- /dev/null +++ b/compiler/testData/diagnostics/tests/smartCasts/inference/kt29767.txt @@ -0,0 +1,3 @@ +package + +public fun test(/*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 2e36f737cf7..598101b02ac 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -19894,6 +19894,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest { runTest("compiler/testData/diagnostics/tests/smartCasts/inference/kt2851.kt"); } + @TestMetadata("kt29767.kt") + public void testKt29767() throws Exception { + runTest("compiler/testData/diagnostics/tests/smartCasts/inference/kt29767.kt"); + } + @TestMetadata("kt4009.kt") public void testKt4009() throws Exception { runTest("compiler/testData/diagnostics/tests/smartCasts/inference/kt4009.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java index 13830acfc8b..50bac656f82 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java @@ -19819,6 +19819,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing runTest("compiler/testData/diagnostics/tests/smartCasts/inference/kt2851.kt"); } + @TestMetadata("kt29767.kt") + public void testKt29767() throws Exception { + runTest("compiler/testData/diagnostics/tests/smartCasts/inference/kt29767.kt"); + } + @TestMetadata("kt4009.kt") public void testKt4009() throws Exception { runTest("compiler/testData/diagnostics/tests/smartCasts/inference/kt4009.kt");