Tests for KT-3899. Passes already in M11 or even earlier

This commit is contained in:
Mikhail Glukhikh
2015-04-07 18:26:55 +03:00
parent f49c79f4f0
commit 39e01f4df2
3 changed files with 36 additions and 0 deletions
@@ -0,0 +1,13 @@
data class StringPair(val first: String, val second: String)
fun String.to(second: String) = StringPair(this, second)
fun hashMapOf(<!UNUSED_PARAMETER!>pair<!>: StringPair): MutableMap<String, String> {
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun F() : MutableMap<String, String> {
val value: String? = "xyz"
if (value == null) throw Error()
// Smart cast should be here
return hashMapOf("sss" to <!DEBUG_INFO_SMARTCAST!>value<!>)
}
@@ -0,0 +1,17 @@
package
internal fun F(): kotlin.MutableMap<kotlin.String, kotlin.String>
internal fun hashMapOf(/*0*/ pair: StringPair): kotlin.MutableMap<kotlin.String, kotlin.String>
internal fun kotlin.String.to(/*0*/ second: kotlin.String): StringPair
kotlin.data() internal final class StringPair {
public constructor StringPair(/*0*/ first: kotlin.String, /*1*/ second: kotlin.String)
internal final val first: kotlin.String
internal final val second: kotlin.String
internal final /*synthesized*/ fun component1(): kotlin.String
internal final /*synthesized*/ fun component2(): kotlin.String
public final /*synthesized*/ fun copy(/*0*/ first: kotlin.String = ..., /*1*/ second: kotlin.String = ...): StringPair
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -11335,6 +11335,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("kt3899.kt")
public void testKt3899() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/smartCasts/varnotnull/kt3899.kt");
doTest(fileName);
}
@TestMetadata("kt3993.kt")
public void testKt3993() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/smartCasts/varnotnull/kt3993.kt");