Fix unresolved reference to catch parameter from lambda expression
#KT-41140 Fixed
This commit is contained in:
Generated
+5
@@ -12637,6 +12637,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/inference/plusAssignInsideLambda.kt");
|
runTest("compiler/testData/codegen/box/inference/plusAssignInsideLambda.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("referenceToCatchParameterFromLambdaExpression.kt")
|
||||||
|
public void testReferenceToCatchParameterFromLambdaExpression() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/referenceToCatchParameterFromLambdaExpression.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("unsafeVarianceCodegen.kt")
|
@TestMetadata("unsafeVarianceCodegen.kt")
|
||||||
public void testUnsafeVarianceCodegen() throws Exception {
|
public void testUnsafeVarianceCodegen() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inference/unsafeVarianceCodegen.kt");
|
runTest("compiler/testData/codegen/box/inference/unsafeVarianceCodegen.kt");
|
||||||
|
|||||||
@@ -728,6 +728,9 @@ class PSICallResolver(
|
|||||||
|
|
||||||
val argumentName = valueArgument.getArgumentName()?.asName
|
val argumentName = valueArgument.getArgumentName()?.asName
|
||||||
|
|
||||||
|
@Suppress("NAME_SHADOWING")
|
||||||
|
val outerCallContext = outerCallContext.expandContextForCatchClause(ktExpression)
|
||||||
|
|
||||||
processFunctionalExpression(
|
processFunctionalExpression(
|
||||||
outerCallContext, argumentExpression, startDataFlowInfo,
|
outerCallContext, argumentExpression, startDataFlowInfo,
|
||||||
valueArgument, argumentName, builtIns, typeResolver
|
valueArgument, argumentName, builtIns, typeResolver
|
||||||
@@ -743,7 +746,7 @@ class PSICallResolver(
|
|||||||
|
|
||||||
val context = outerCallContext.replaceContextDependency(ContextDependency.DEPENDENT)
|
val context = outerCallContext.replaceContextDependency(ContextDependency.DEPENDENT)
|
||||||
.replaceDataFlowInfo(startDataFlowInfo)
|
.replaceDataFlowInfo(startDataFlowInfo)
|
||||||
.expandContextForCatchClause(ktExpression).let {
|
.let {
|
||||||
if (isSpecialFunction &&
|
if (isSpecialFunction &&
|
||||||
argumentExpression is KtBlockExpression &&
|
argumentExpression is KtBlockExpression &&
|
||||||
ArgumentTypeResolver.getCallableReferenceExpressionIfAny(argumentExpression, it) != null
|
ArgumentTypeResolver.getCallableReferenceExpressionIfAny(argumentExpression, it) != null
|
||||||
|
|||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
fun test(): () -> Throwable {
|
||||||
|
return try {
|
||||||
|
TODO()
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
{ -> e }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val exception = test()()
|
||||||
|
return if (exception is NotImplementedError) "OK" else "fail: $exception"
|
||||||
|
}
|
||||||
+5
@@ -13862,6 +13862,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/inference/plusAssignInsideLambda.kt");
|
runTest("compiler/testData/codegen/box/inference/plusAssignInsideLambda.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("referenceToCatchParameterFromLambdaExpression.kt")
|
||||||
|
public void testReferenceToCatchParameterFromLambdaExpression() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/referenceToCatchParameterFromLambdaExpression.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("unsafeVarianceCodegen.kt")
|
@TestMetadata("unsafeVarianceCodegen.kt")
|
||||||
public void testUnsafeVarianceCodegen() throws Exception {
|
public void testUnsafeVarianceCodegen() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inference/unsafeVarianceCodegen.kt");
|
runTest("compiler/testData/codegen/box/inference/unsafeVarianceCodegen.kt");
|
||||||
|
|||||||
+5
@@ -13862,6 +13862,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/inference/plusAssignInsideLambda.kt");
|
runTest("compiler/testData/codegen/box/inference/plusAssignInsideLambda.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("referenceToCatchParameterFromLambdaExpression.kt")
|
||||||
|
public void testReferenceToCatchParameterFromLambdaExpression() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/referenceToCatchParameterFromLambdaExpression.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("unsafeVarianceCodegen.kt")
|
@TestMetadata("unsafeVarianceCodegen.kt")
|
||||||
public void testUnsafeVarianceCodegen() throws Exception {
|
public void testUnsafeVarianceCodegen() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inference/unsafeVarianceCodegen.kt");
|
runTest("compiler/testData/codegen/box/inference/unsafeVarianceCodegen.kt");
|
||||||
|
|||||||
+5
@@ -12637,6 +12637,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/inference/plusAssignInsideLambda.kt");
|
runTest("compiler/testData/codegen/box/inference/plusAssignInsideLambda.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("referenceToCatchParameterFromLambdaExpression.kt")
|
||||||
|
public void testReferenceToCatchParameterFromLambdaExpression() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/referenceToCatchParameterFromLambdaExpression.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("unsafeVarianceCodegen.kt")
|
@TestMetadata("unsafeVarianceCodegen.kt")
|
||||||
public void testUnsafeVarianceCodegen() throws Exception {
|
public void testUnsafeVarianceCodegen() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inference/unsafeVarianceCodegen.kt");
|
runTest("compiler/testData/codegen/box/inference/unsafeVarianceCodegen.kt");
|
||||||
|
|||||||
Generated
+5
@@ -10812,6 +10812,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
|||||||
runTest("compiler/testData/codegen/box/inference/plusAssignInsideLambda.kt");
|
runTest("compiler/testData/codegen/box/inference/plusAssignInsideLambda.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("referenceToCatchParameterFromLambdaExpression.kt")
|
||||||
|
public void testReferenceToCatchParameterFromLambdaExpression() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/referenceToCatchParameterFromLambdaExpression.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("unsafeVarianceCodegen.kt")
|
@TestMetadata("unsafeVarianceCodegen.kt")
|
||||||
public void testUnsafeVarianceCodegen() throws Exception {
|
public void testUnsafeVarianceCodegen() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inference/unsafeVarianceCodegen.kt");
|
runTest("compiler/testData/codegen/box/inference/unsafeVarianceCodegen.kt");
|
||||||
|
|||||||
Generated
+5
@@ -10812,6 +10812,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/inference/plusAssignInsideLambda.kt");
|
runTest("compiler/testData/codegen/box/inference/plusAssignInsideLambda.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("referenceToCatchParameterFromLambdaExpression.kt")
|
||||||
|
public void testReferenceToCatchParameterFromLambdaExpression() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/referenceToCatchParameterFromLambdaExpression.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("unsafeVarianceCodegen.kt")
|
@TestMetadata("unsafeVarianceCodegen.kt")
|
||||||
public void testUnsafeVarianceCodegen() throws Exception {
|
public void testUnsafeVarianceCodegen() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inference/unsafeVarianceCodegen.kt");
|
runTest("compiler/testData/codegen/box/inference/unsafeVarianceCodegen.kt");
|
||||||
|
|||||||
+5
@@ -10877,6 +10877,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/inference/plusAssignInsideLambda.kt");
|
runTest("compiler/testData/codegen/box/inference/plusAssignInsideLambda.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("referenceToCatchParameterFromLambdaExpression.kt")
|
||||||
|
public void testReferenceToCatchParameterFromLambdaExpression() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inference/referenceToCatchParameterFromLambdaExpression.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("unsafeVarianceCodegen.kt")
|
@TestMetadata("unsafeVarianceCodegen.kt")
|
||||||
public void testUnsafeVarianceCodegen() throws Exception {
|
public void testUnsafeVarianceCodegen() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inference/unsafeVarianceCodegen.kt");
|
runTest("compiler/testData/codegen/box/inference/unsafeVarianceCodegen.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user