[FIR] Fix IAE in TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM
IllegalArgumentException: class org.jetbrains.kotlin.psi.KtLambdaArgument is not a subtype of class org.jetbrains.kotlin.psi.KtExpression for factory TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM was reported when TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM was reported on a FirLambdaArgumentExpression, report it on its `expression` instead. #KT-60380 Fixed
This commit is contained in:
committed by
Space Team
parent
f7352585f4
commit
393a5d6c14
+6
@@ -1925,6 +1925,12 @@ public class DiagnosticCompilerTestFirTestdataTestGenerated extends AbstractDiag
|
|||||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/qualifiedSupertypeExtendedByOtherSupertype.kt");
|
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/qualifiedSupertypeExtendedByOtherSupertype.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("recursiveProblemWithSyntaxError.kt")
|
||||||
|
public void testRecursiveProblemWithSyntaxError() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/recursiveProblemWithSyntaxError.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("redundantModifier.kt")
|
@TestMetadata("redundantModifier.kt")
|
||||||
public void testRedundantModifier() throws Exception {
|
public void testRedundantModifier() throws Exception {
|
||||||
|
|||||||
+6
@@ -1925,6 +1925,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFirTestDataTestGenerated
|
|||||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/qualifiedSupertypeExtendedByOtherSupertype.kt");
|
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/qualifiedSupertypeExtendedByOtherSupertype.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("recursiveProblemWithSyntaxError.kt")
|
||||||
|
public void testRecursiveProblemWithSyntaxError() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/recursiveProblemWithSyntaxError.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("redundantModifier.kt")
|
@TestMetadata("redundantModifier.kt")
|
||||||
public void testRedundantModifier() throws Exception {
|
public void testRedundantModifier() throws Exception {
|
||||||
|
|||||||
Vendored
+9
@@ -0,0 +1,9 @@
|
|||||||
|
FILE: recursiveProblemWithSyntaxError.kt
|
||||||
|
public final val foo: <ERROR TYPE REF: Unresolved name: bar> = bar@fun <anonymous>(): <ERROR TYPE REF: Unresolved name: bar> <inline=Unknown> {
|
||||||
|
^ <Unresolved name: bar>#
|
||||||
|
}
|
||||||
|
.R|SubstitutionOverride<kotlin/Function0.invoke: <ERROR TYPE REF: Unresolved name: bar>><Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): kotlin/Function0.invoke>#|(ERROR_EXPR(Argument is absent)).<Unresolved name: bar>#(<Call has no callee>#(<L> = <Call has no callee>@fun <anonymous>(): <ERROR TYPE REF: cycle> <inline=Unknown> {
|
||||||
|
^ R|/foo|
|
||||||
|
}
|
||||||
|
))
|
||||||
|
public get(): <ERROR TYPE REF: Unresolved name: bar>
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
val foo = { <!UNRESOLVED_REFERENCE!>bar<!> }(
|
||||||
|
|
||||||
|
<!SYNTAX!><!SYNTAX!><!>val<!> bar <!SYNTAX!><!SYNTAX!>=<!> <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>{ <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>foo<!> }<!><!>
|
||||||
+6
@@ -1925,6 +1925,12 @@ public class FirLightTreeDiagnosticsTestGenerated extends AbstractFirLightTreeDi
|
|||||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/qualifiedSupertypeExtendedByOtherSupertype.kt");
|
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/qualifiedSupertypeExtendedByOtherSupertype.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("recursiveProblemWithSyntaxError.kt")
|
||||||
|
public void testRecursiveProblemWithSyntaxError() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/recursiveProblemWithSyntaxError.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("redundantModifier.kt")
|
@TestMetadata("redundantModifier.kt")
|
||||||
public void testRedundantModifier() throws Exception {
|
public void testRedundantModifier() throws Exception {
|
||||||
|
|||||||
+6
@@ -1925,6 +1925,12 @@ public class FirPsiDiagnosticTestGenerated extends AbstractFirPsiDiagnosticTest
|
|||||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/qualifiedSupertypeExtendedByOtherSupertype.kt");
|
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/qualifiedSupertypeExtendedByOtherSupertype.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("recursiveProblemWithSyntaxError.kt")
|
||||||
|
public void testRecursiveProblemWithSyntaxError() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/recursiveProblemWithSyntaxError.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("redundantModifier.kt")
|
@TestMetadata("redundantModifier.kt")
|
||||||
public void testRedundantModifier() throws Exception {
|
public void testRedundantModifier() throws Exception {
|
||||||
|
|||||||
+4
-1
@@ -13,9 +13,11 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
|||||||
import org.jetbrains.kotlin.fir.diagnostics.ConeSimpleDiagnostic
|
import org.jetbrains.kotlin.fir.diagnostics.ConeSimpleDiagnostic
|
||||||
import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind
|
import org.jetbrains.kotlin.fir.diagnostics.DiagnosticKind
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||||
|
import org.jetbrains.kotlin.fir.expressions.FirLambdaArgumentExpression
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirStatement
|
import org.jetbrains.kotlin.fir.expressions.FirStatement
|
||||||
import org.jetbrains.kotlin.fir.expressions.impl.FirNoReceiverExpression
|
import org.jetbrains.kotlin.fir.expressions.impl.FirNoReceiverExpression
|
||||||
import org.jetbrains.kotlin.fir.types.*
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
|
import org.jetbrains.kotlin.psi.KtLambdaArgument
|
||||||
|
|
||||||
object FirRecursiveProblemChecker : FirBasicExpressionChecker() {
|
object FirRecursiveProblemChecker : FirBasicExpressionChecker() {
|
||||||
override fun check(expression: FirStatement, context: CheckerContext, reporter: DiagnosticReporter) {
|
override fun check(expression: FirStatement, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||||
@@ -29,7 +31,8 @@ object FirRecursiveProblemChecker : FirBasicExpressionChecker() {
|
|||||||
|
|
||||||
fun checkConeType(coneType: ConeKotlinType?) {
|
fun checkConeType(coneType: ConeKotlinType?) {
|
||||||
if (coneType is ConeErrorType && (coneType.diagnostic as? ConeSimpleDiagnostic)?.kind == DiagnosticKind.RecursionInImplicitTypes) {
|
if (coneType is ConeErrorType && (coneType.diagnostic as? ConeSimpleDiagnostic)?.kind == DiagnosticKind.RecursionInImplicitTypes) {
|
||||||
reporter.reportOn(expression.source, FirErrors.TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, context)
|
val source = ((expression as? FirLambdaArgumentExpression)?.expression ?: expression).source
|
||||||
|
reporter.reportOn(source, FirErrors.TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM, context)
|
||||||
} else if (coneType is ConeClassLikeType) {
|
} else if (coneType is ConeClassLikeType) {
|
||||||
for (typeArgument in coneType.typeArguments) {
|
for (typeArgument in coneType.typeArguments) {
|
||||||
checkConeType(typeArgument.type)
|
checkConeType(typeArgument.type)
|
||||||
|
|||||||
Reference in New Issue
Block a user