[FIR] Add test for KT-49249
This commit is contained in:
committed by
Space Team
parent
019d7db737
commit
092ebf4c11
+6
@@ -4015,6 +4015,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/literalInWhenSubject.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("longElvisChain.kt")
|
||||
public void testLongElvisChain() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/longElvisChain.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("multipleCasts.kt")
|
||||
public void testMultipleCasts() throws Exception {
|
||||
|
||||
+5
@@ -3549,6 +3549,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/literalInWhenSubject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("longElvisChain.kt")
|
||||
public void testLongElvisChain() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/longElvisChain.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multipleCasts.kt")
|
||||
public void testMultipleCasts() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/multipleCasts.kt");
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
FILE: longElvisChain.kt
|
||||
public final fun test_1(): R|kotlin/Unit| {
|
||||
lval a: R|kotlin/Throwable?| = Null(null)
|
||||
lval b: R|kotlin/Unit?| = Null(null)
|
||||
lval c: R|kotlin/Throwable| = R|<local>/a| ?: R|<local>/b|?.{ $subj$.R|kotlin/let|<R|kotlin/Unit|, R|kotlin/Nothing|>(<L> = let@fun <anonymous>(it: R|kotlin/Unit|): R|kotlin/Nothing| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
^test_1 R|<local>/it|
|
||||
}
|
||||
) } ?: ^test_1 Unit
|
||||
R|<local>/c|!!
|
||||
throw R|<local>/a|
|
||||
}
|
||||
public final fun test_2(): R|kotlin/Unit| {
|
||||
lval a: R|kotlin/Throwable?| = Null(null)
|
||||
lval b: R|kotlin/Unit?| = Null(null)
|
||||
lval c: R|kotlin/Throwable| = R|<local>/a| ?: R|<local>/b|?.{ $subj$.R|kotlin/let|<R|kotlin/Unit|, R|kotlin/Nothing|>(<L> = let@fun <anonymous>(it: R|kotlin/Unit|): R|kotlin/Nothing| <inline=Inline, kind=EXACTLY_ONCE> {
|
||||
^test_2 R|<local>/it|
|
||||
}
|
||||
) } ?: ^test_2 Unit
|
||||
throw R|<local>/a|
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// ISSUE: KT-49249
|
||||
// WITH_STDLIB
|
||||
|
||||
fun test_1() {
|
||||
val a: Throwable? = null;
|
||||
val b: Unit? = null
|
||||
val c = a ?: b?.let { return it } ?: return
|
||||
c<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>
|
||||
throw <!TYPE_MISMATCH!>a<!>
|
||||
}
|
||||
|
||||
fun test_2() {
|
||||
val a: Throwable? = null;
|
||||
val b: Unit? = null
|
||||
val c = a ?: b?.let { return it } ?: return
|
||||
throw <!TYPE_MISMATCH!>a<!>
|
||||
}
|
||||
+6
@@ -4015,6 +4015,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/literalInWhenSubject.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("longElvisChain.kt")
|
||||
public void testLongElvisChain() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/longElvisChain.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("multipleCasts.kt")
|
||||
public void testMultipleCasts() throws Exception {
|
||||
|
||||
+6
@@ -4015,6 +4015,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/literalInWhenSubject.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("longElvisChain.kt")
|
||||
public void testLongElvisChain() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/smartcasts/longElvisChain.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("multipleCasts.kt")
|
||||
public void testMultipleCasts() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user