[FIR] Set source on callee reference of implicit invoke receiver
This fixes an IllegalArgumentException when a diagnostic was reported on it because no source was set. #KT-61829 Fixed
This commit is contained in:
committed by
Space Team
parent
a224f9db34
commit
ce65d3c7b8
+6
@@ -3847,6 +3847,12 @@ public class DiagnosticCompilerTestFirTestdataTestGenerated extends AbstractDiag
|
|||||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/incompleteWhen.kt");
|
runTest("compiler/fir/analysis-tests/testData/resolve/problems/incompleteWhen.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("incorrectGenericLambdaProperty.kt")
|
||||||
|
public void testIncorrectGenericLambdaProperty() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolve/problems/incorrectGenericLambdaProperty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("innerClassHierarchy.kt")
|
@TestMetadata("innerClassHierarchy.kt")
|
||||||
public void testInnerClassHierarchy() throws Exception {
|
public void testInnerClassHierarchy() throws Exception {
|
||||||
|
|||||||
+6
@@ -3847,6 +3847,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFirTestDataTestGenerated
|
|||||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/incompleteWhen.kt");
|
runTest("compiler/fir/analysis-tests/testData/resolve/problems/incompleteWhen.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("incorrectGenericLambdaProperty.kt")
|
||||||
|
public void testIncorrectGenericLambdaProperty() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolve/problems/incorrectGenericLambdaProperty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("innerClassHierarchy.kt")
|
@TestMetadata("innerClassHierarchy.kt")
|
||||||
public void testInnerClassHierarchy() throws Exception {
|
public void testInnerClassHierarchy() throws Exception {
|
||||||
|
|||||||
Vendored
+13
@@ -0,0 +1,13 @@
|
|||||||
|
FILE: incorrectGenericLambdaProperty.kt
|
||||||
|
public final fun main(args: R|kotlin/Array<kotlin/String>|): R|kotlin/Unit| {
|
||||||
|
lval <T> passIt: R|(ERROR CLASS: No type for parameter) -> ERROR CLASS: Symbol not found for T| = fun <anonymous>(<destruct>: <ERROR TYPE REF: No type for parameter>): <ERROR TYPE REF: Symbol not found for T> <inline=Unknown> {
|
||||||
|
lval t: <ERROR TYPE REF: Symbol not found for T> = R|<local>/<destruct>|.<Unresolved name: component1>#()
|
||||||
|
^ {
|
||||||
|
R|<local>/t|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
R|<local>/passIt<CS errors: <local>/passIt>#|<<ERROR TYPE REF: Cannot infer argument for type parameter T>>.R|SubstitutionOverride<kotlin/Function1.invoke: <ERROR TYPE REF: Symbol not found for T>><Inapplicable(INAPPLICABLE): kotlin/Function1.invoke>#|<R|kotlin/Int|>(Int(1))
|
||||||
|
R|<local>/passIt<CS errors: <local>/passIt>#|<<ERROR TYPE REF: Cannot infer argument for type parameter T>>.R|SubstitutionOverride<kotlin/Function1.invoke: <ERROR TYPE REF: Symbol not found for T>>|(Int(1))
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
fun main(args: Array<String>) {
|
||||||
|
val <!LOCAL_VARIABLE_WITH_TYPE_PARAMETERS!><T><!> passIt = { <!COMPONENT_FUNCTION_MISSING, VALUE_PARAMETER_WITH_NO_TYPE_ANNOTATION!>(t: <!UNRESOLVED_REFERENCE!>T<!>)<!> -> t }
|
||||||
|
<!INAPPLICABLE_CANDIDATE, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>passIt<!><Int>(1)
|
||||||
|
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>passIt<!>(1)
|
||||||
|
}
|
||||||
+6
@@ -3847,6 +3847,12 @@ public class FirLightTreeDiagnosticsTestGenerated extends AbstractFirLightTreeDi
|
|||||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/incompleteWhen.kt");
|
runTest("compiler/fir/analysis-tests/testData/resolve/problems/incompleteWhen.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("incorrectGenericLambdaProperty.kt")
|
||||||
|
public void testIncorrectGenericLambdaProperty() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolve/problems/incorrectGenericLambdaProperty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("innerClassHierarchy.kt")
|
@TestMetadata("innerClassHierarchy.kt")
|
||||||
public void testInnerClassHierarchy() throws Exception {
|
public void testInnerClassHierarchy() throws Exception {
|
||||||
|
|||||||
+6
@@ -3847,6 +3847,12 @@ public class FirPsiDiagnosticTestGenerated extends AbstractFirPsiDiagnosticTest
|
|||||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/incompleteWhen.kt");
|
runTest("compiler/fir/analysis-tests/testData/resolve/problems/incompleteWhen.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("incorrectGenericLambdaProperty.kt")
|
||||||
|
public void testIncorrectGenericLambdaProperty() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolve/problems/incorrectGenericLambdaProperty.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("innerClassHierarchy.kt")
|
@TestMetadata("innerClassHierarchy.kt")
|
||||||
public void testInnerClassHierarchy() throws Exception {
|
public void testInnerClassHierarchy() throws Exception {
|
||||||
|
|||||||
+3
-2
@@ -304,8 +304,9 @@ private fun BodyResolveComponents.createExplicitReceiverForInvokeByCallable(
|
|||||||
symbol: FirCallableSymbol<*>
|
symbol: FirCallableSymbol<*>
|
||||||
): FirExpression {
|
): FirExpression {
|
||||||
return FirPropertyAccessExpressionBuilder().apply {
|
return FirPropertyAccessExpressionBuilder().apply {
|
||||||
|
val fakeSource = info.fakeSourceForImplicitInvokeCallReceiver
|
||||||
calleeReference = FirNamedReferenceWithCandidate(
|
calleeReference = FirNamedReferenceWithCandidate(
|
||||||
null,
|
fakeSource,
|
||||||
symbol.callableId.callableName,
|
symbol.callableId.callableName,
|
||||||
candidate
|
candidate
|
||||||
)
|
)
|
||||||
@@ -321,7 +322,7 @@ private fun BodyResolveComponents.createExplicitReceiverForInvokeByCallable(
|
|||||||
if (candidate.currentApplicability == CandidateApplicability.K2_PROPERTY_AS_OPERATOR) {
|
if (candidate.currentApplicability == CandidateApplicability.K2_PROPERTY_AS_OPERATOR) {
|
||||||
nonFatalDiagnostics.add(ConePropertyAsOperator(candidate.symbol as FirPropertySymbol))
|
nonFatalDiagnostics.add(ConePropertyAsOperator(candidate.symbol as FirPropertySymbol))
|
||||||
}
|
}
|
||||||
source = info.fakeSourceForImplicitInvokeCallReceiver
|
source = fakeSource
|
||||||
}.build().let {
|
}.build().let {
|
||||||
callCompleter.completeCall(it, ResolutionMode.ReceiverResolution)
|
callCompleter.completeCall(it, ResolutionMode.ReceiverResolution)
|
||||||
}.let {
|
}.let {
|
||||||
|
|||||||
Reference in New Issue
Block a user