Add test for outdated smart cast with elvis issue
#KT-5335 Obsolete
This commit is contained in:
+1
-1
@@ -8,4 +8,4 @@ fun test(a: C?, nn: () -> Nothing?) {
|
|||||||
|
|
||||||
a ?: return
|
a ?: return
|
||||||
<!DEBUG_INFO_SMARTCAST!>a<!>.foo()
|
<!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);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("elvis.kt")
|
@TestMetadata("elvisNothingRHS.kt")
|
||||||
public void testElvis() throws Exception {
|
public void testElvisNothingRHS() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/smartCasts/elvis.kt");
|
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);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class ConstructorConverter(private val psiClass: PsiClass,
|
|||||||
else
|
else
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
val finalTarget = finalTargetInfo?.constructor ?: target!! //TODO: see KT-5335
|
val finalTarget = finalTargetInfo?.constructor ?: target
|
||||||
|
|
||||||
toTargetConstructorMap[constructor] = TargetConstructorInfo(finalTarget, parameterDefaults)
|
toTargetConstructorMap[constructor] = TargetConstructorInfo(finalTarget, parameterDefaults)
|
||||||
for (entry in toTargetConstructorMap.entrySet()) {
|
for (entry in toTargetConstructorMap.entrySet()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user