Add test for outdated smart cast with elvis issue

#KT-5335 Obsolete
This commit is contained in:
Alexander Udalov
2014-10-16 16:35:11 +04:00
parent 6387076efe
commit 6698e0ecc9
6 changed files with 24 additions and 5 deletions
@@ -8,4 +8,4 @@ fun test(a: C?, nn: () -> Nothing?) {
a ?: return
<!DEBUG_INFO_SMARTCAST!>a<!>.foo()
}
}
@@ -0,0 +1,10 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
// KT-5335
fun foo(p1: String?, p2: String?) {
if (p2 != null) {
val v = p1 ?: <!DEBUG_INFO_SMARTCAST!>p2<!>
val size = v.length
}
}
@@ -0,0 +1,3 @@
package
internal fun foo(/*0*/ p1: kotlin.String?, /*1*/ p2: kotlin.String?): kotlin.Unit
@@ -9356,9 +9356,15 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("elvis.kt")
public void testElvis() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/smartCasts/elvis.kt");
@TestMetadata("elvisNothingRHS.kt")
public void testElvisNothingRHS() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/smartCasts/elvisNothingRHS.kt");
doTest(fileName);
}
@TestMetadata("elvisRHS.kt")
public void testElvisRHS() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/smartCasts/elvisRHS.kt");
doTest(fileName);
}
@@ -84,7 +84,7 @@ class ConstructorConverter(private val psiClass: PsiClass,
else
null
}
val finalTarget = finalTargetInfo?.constructor ?: target!! //TODO: see KT-5335
val finalTarget = finalTargetInfo?.constructor ?: target
toTargetConstructorMap[constructor] = TargetConstructorInfo(finalTarget, parameterDefaults)
for (entry in toTargetConstructorMap.entrySet()) {