Add tests for KT-17929

This commit is contained in:
Mikhail Glukhikh
2017-05-19 14:39:14 +03:00
parent d9e4b445b9
commit 0fd70df681
9 changed files with 80 additions and 0 deletions
@@ -0,0 +1,12 @@
fun bar(arg: Any?) = arg
fun foo() {
var s: String?
s = null
try {
s = "Test"
} catch (ex: Exception) {}
bar(<!DEBUG_INFO_CONSTANT!>s<!>)
if (<!SENSELESS_COMPARISON!><!DEBUG_INFO_CONSTANT!>s<!> != null<!>) { }
<!DEBUG_INFO_CONSTANT!>s<!><!UNSAFE_CALL!>.<!>hashCode()
}
@@ -0,0 +1,4 @@
package
public fun bar(/*0*/ arg: kotlin.Any?): kotlin.Any?
public fun foo(): kotlin.Unit
@@ -0,0 +1,8 @@
fun foo() {
var s: String?
s = "Test"
try {
s = null
} catch (ex: Exception) {}
<!DEBUG_INFO_SMARTCAST!>s<!>.hashCode()
}
@@ -0,0 +1,3 @@
package
public fun foo(): kotlin.Unit
@@ -0,0 +1,14 @@
fun bar() {}
fun foo() {
var s: String?
s = "Test"
try {
s = null
}
catch (ex: Exception) {}
finally {
bar()
}
<!DEBUG_INFO_SMARTCAST!>s<!>.hashCode()
}
@@ -0,0 +1,4 @@
package
public fun bar(): kotlin.Unit
public fun foo(): kotlin.Unit
@@ -0,0 +1,8 @@
fun foo() {
var s: String?
s = "Test"
try {
s = "Other"
} catch (ex: Exception) {}
<!DEBUG_INFO_SMARTCAST!>s<!>.hashCode()
}
@@ -0,0 +1,3 @@
package
public fun foo(): kotlin.Unit
@@ -21168,6 +21168,30 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("setNotNullInTry.kt")
public void testSetNotNullInTry() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNotNullInTry.kt");
doTest(fileName);
}
@TestMetadata("setNullInTry.kt")
public void testSetNullInTry() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTry.kt");
doTest(fileName);
}
@TestMetadata("setNullInTryFinally.kt")
public void testSetNullInTryFinally() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/smartCasts/varnotnull/setNullInTryFinally.kt");
doTest(fileName);
}
@TestMetadata("setSameInTry.kt")
public void testSetSameInTry() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/smartCasts/varnotnull/setSameInTry.kt");
doTest(fileName);
}
@TestMetadata("toFlexibleType.kt")
public void testToFlexibleType() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/smartCasts/varnotnull/toFlexibleType.kt");