Add test for #KT-25432

This commit is contained in:
Dmitriy Novozhilov
2019-02-01 14:08:39 +03:00
parent 93de13d931
commit 6878abe8b4
4 changed files with 40 additions and 0 deletions
@@ -0,0 +1,18 @@
// !WITH_NEW_INFERENCE
class Data<T>(val s: T)
fun test_1(d: Data<out Any>) {
if (d.s is String) {
<!OI;DEBUG_INFO_SMARTCAST!>d.s<!>.<!NI;UNRESOLVED_REFERENCE!>length<!>
}
}
fun test_2(a: MutableList<out Int?>?) {
if (a != null) {
val b = <!OI;DEBUG_INFO_SMARTCAST!>a<!>[0] // no SMARTCAST diagnostic
if (b != null) {
<!DEBUG_INFO_SMARTCAST!>b<!>.inc()
}
}
}
@@ -0,0 +1,12 @@
package
public fun test_1(/*0*/ d: Data<out kotlin.Any>): kotlin.Unit
public fun test_2(/*0*/ a: kotlin.collections.MutableList<out kotlin.Int?>?): kotlin.Unit
public final class Data</*0*/ T> {
public constructor Data</*0*/ T>(/*0*/ s: T)
public final val s: T
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
}
@@ -19776,6 +19776,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
runTest("compiler/testData/diagnostics/tests/smartCasts/inference/kt1355.kt");
}
@TestMetadata("kt25432.kt")
public void testKt25432() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/inference/kt25432.kt");
}
@TestMetadata("kt2746.kt")
public void testKt2746() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/inference/kt2746.kt");
@@ -19776,6 +19776,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
runTest("compiler/testData/diagnostics/tests/smartCasts/inference/kt1355.kt");
}
@TestMetadata("kt25432.kt")
public void testKt25432() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/inference/kt25432.kt");
}
@TestMetadata("kt2746.kt")
public void testKt2746() throws Exception {
runTest("compiler/testData/diagnostics/tests/smartCasts/inference/kt2746.kt");