[FE 1.0] Add fallback for extracting when call

This commit is contained in:
Victor Petukhov
2022-06-21 11:24:33 +02:00
committed by teamcity
parent 42e71f8c53
commit db54d18c72
8 changed files with 78 additions and 1 deletions
@@ -34020,6 +34020,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
runTest("compiler/testData/diagnostics/tests/when/ExhaustiveWithNullabilityCheckElse.kt");
}
@Test
@TestMetadata("extractingEntireCall.kt")
public void testExtractingEntireCall() throws Exception {
runTest("compiler/testData/diagnostics/tests/when/extractingEntireCall.kt");
}
@Test
@TestMetadata("intersectionExhaustivenessComplex.kt")
public void testIntersectionExhaustivenessComplex() throws Exception {
@@ -34020,6 +34020,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/when/ExhaustiveWithNullabilityCheckElse.kt");
}
@Test
@TestMetadata("extractingEntireCall.kt")
public void testExtractingEntireCall() throws Exception {
runTest("compiler/testData/diagnostics/tests/when/extractingEntireCall.kt");
}
@Test
@TestMetadata("intersectionExhaustivenessComplex.kt")
public void testIntersectionExhaustivenessComplex() throws Exception {
@@ -34020,6 +34020,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/when/ExhaustiveWithNullabilityCheckElse.kt");
}
@Test
@TestMetadata("extractingEntireCall.kt")
public void testExtractingEntireCall() throws Exception {
runTest("compiler/testData/diagnostics/tests/when/extractingEntireCall.kt");
}
@Test
@TestMetadata("intersectionExhaustivenessComplex.kt")
public void testIntersectionExhaustivenessComplex() throws Exception {
@@ -160,7 +160,7 @@ fun KtElement.getCall(context: BindingContext): Call? {
if (element is KtWhenExpression) {
val subjectVariable = element.subjectVariable
if (subjectVariable != null) {
return subjectVariable.getCall(context)
return subjectVariable.getCall(context) ?: context[CALL, element]
}
}
@@ -0,0 +1,15 @@
// WITH_STDLIB
interface FirExpression
interface FirNamedArgumentExpression : FirExpression {
val expression: FirNamedArgumentExpression
}
class AnnotationUseSiteTarget
private fun List<FirExpression>.toAnnotationUseSiteTargets2(): Set<AnnotationUseSiteTarget> =
flatMapTo(mutableSetOf()) { arg ->
when (val unwrappedArg = if (arg is FirNamedArgumentExpression) arg.expression else arg) {
is FirNamedArgumentExpression -> setOf()
else -> setOf()
}
}
@@ -0,0 +1,15 @@
// WITH_STDLIB
interface FirExpression
interface FirNamedArgumentExpression : FirExpression {
val expression: FirNamedArgumentExpression
}
class AnnotationUseSiteTarget
private fun List<FirExpression>.toAnnotationUseSiteTargets2(): Set<AnnotationUseSiteTarget> =
flatMapTo(mutableSetOf()) { arg ->
when (val unwrappedArg = if (arg is FirNamedArgumentExpression) <!DEBUG_INFO_SMARTCAST!>arg<!>.expression else arg) {
is FirNamedArgumentExpression -> setOf()
else -> setOf()
}
}
@@ -0,0 +1,23 @@
package
private fun kotlin.collections.List<FirExpression>.toAnnotationUseSiteTargets2(): kotlin.collections.Set<AnnotationUseSiteTarget>
public final class AnnotationUseSiteTarget {
public constructor AnnotationUseSiteTarget()
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
}
public interface FirExpression {
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
}
public interface FirNamedArgumentExpression : FirExpression {
public abstract val expression: FirNamedArgumentExpression
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
}
@@ -34110,6 +34110,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/when/ExhaustiveWithNullabilityCheckElse.kt");
}
@Test
@TestMetadata("extractingEntireCall.kt")
public void testExtractingEntireCall() throws Exception {
runTest("compiler/testData/diagnostics/tests/when/extractingEntireCall.kt");
}
@Test
@TestMetadata("intersectionExhaustivenessComplex.kt")
public void testIntersectionExhaustivenessComplex() throws Exception {