diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/kt2865.kt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/kt2865.kt new file mode 100644 index 00000000000..44190e099e4 --- /dev/null +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/kt2865.kt @@ -0,0 +1,11 @@ +fun MutableMap.set(k: K, v: V) {} + +fun foo(a: MutableMap, x: String?) { + a[x!!] = x + a[x] = x!! +} + +fun foo1(a: MutableMap, x: String?) { + a[x] = x!! + a[x!!] = x +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/varnotnull/kt2865.txt b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/kt2865.txt new file mode 100644 index 00000000000..d73971438fd --- /dev/null +++ b/compiler/testData/diagnostics/tests/smartCasts/varnotnull/kt2865.txt @@ -0,0 +1,5 @@ +package + +internal fun foo(/*0*/ a: kotlin.MutableMap, /*1*/ x: kotlin.String?): kotlin.Unit +internal fun foo1(/*0*/ a: kotlin.MutableMap, /*1*/ x: kotlin.String?): kotlin.Unit +internal fun kotlin.MutableMap.set(/*0*/ k: K, /*1*/ v: V): kotlin.Unit diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java index 45766b98a54..2fcc46f0e40 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java @@ -11323,6 +11323,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/smartCasts/varnotnull"), Pattern.compile("^(.+)\\.kt$"), true); } + @TestMetadata("kt2865.kt") + public void testKt2865() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/smartCasts/varnotnull/kt2865.kt"); + doTest(fileName); + } + @TestMetadata("kt3224.kt") public void testKt3224() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/smartCasts/varnotnull/kt3224.kt");