FIR: Set resolve phase to BODY_RESOLVE for SAM constructor value
parameters. This was causing exceptions with analysis API trying to resolve the synthetic FirValueParameter because it could not find a KtDeclaration for it. Using BODY_RESOLVE should be safe; the SAM constructor function is also on BODY_RESOLVE and the type of the value parameter is known.
This commit is contained in:
committed by
TeamCityServer
parent
32bf7f33a7
commit
d16454b9af
+1
@@ -72,6 +72,7 @@ private fun KtCall.stringRepresentation(): String {
|
|||||||
append(
|
append(
|
||||||
when (this@stringValue) {
|
when (this@stringValue) {
|
||||||
is KtFunctionSymbol -> callableIdIfNonLocal ?: name
|
is KtFunctionSymbol -> callableIdIfNonLocal ?: name
|
||||||
|
is KtSamConstructorSymbol -> callableIdIfNonLocal ?: name
|
||||||
is KtConstructorSymbol -> "<constructor>"
|
is KtConstructorSymbol -> "<constructor>"
|
||||||
is KtPropertyGetterSymbol -> callableIdIfNonLocal ?: "<getter>"
|
is KtPropertyGetterSymbol -> callableIdIfNonLocal ?: "<getter>"
|
||||||
is KtPropertySetterSymbol -> callableIdIfNonLocal ?: "<setter>"
|
is KtPropertySetterSymbol -> callableIdIfNonLocal ?: "<setter>"
|
||||||
|
|||||||
+6
@@ -372,6 +372,12 @@ public class ResolveCallTestGenerated extends AbstractResolveCallTest {
|
|||||||
runTest("analysis/analysis-api/testData/analysisSession/resolveCall/resolveCallInSuperConstructorParam.kt");
|
runTest("analysis/analysis-api/testData/analysisSession/resolveCall/resolveCallInSuperConstructorParam.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("samConstructorCall.kt")
|
||||||
|
public void testSamConstructorCall() throws Exception {
|
||||||
|
runTest("analysis/analysis-api/testData/analysisSession/resolveCall/samConstructorCall.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("simpleCallWithNonMatchingArgs.kt")
|
@TestMetadata("simpleCallWithNonMatchingArgs.kt")
|
||||||
public void testSimpleCallWithNonMatchingArgs() throws Exception {
|
public void testSimpleCallWithNonMatchingArgs() throws Exception {
|
||||||
|
|||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
val c = <expr>Comparator {x: Int, y: Int -> 1}</expr>
|
||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
KtFunctionCall:
|
||||||
|
argumentMapping = { {x: Int, y: Int -> 1} -> (block: kotlin.Function2<ft<kotlin.Int, kotlin.Int?>, ft<kotlin.Int, kotlin.Int?>, kotlin.Int>) }
|
||||||
|
targetFunction = java/util/Comparator(block: kotlin.Function2<ft<kotlin.Int, kotlin.Int?>, ft<kotlin.Int, kotlin.Int?>, kotlin.Int>): java.util.Comparator<ft<kotlin.Int, kotlin.Int?>>
|
||||||
|
substitutor = <map substitutor: {FirTypeParameterSymbol T=ft<kotlin/Int, kotlin/Int?>}>
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
val c = java.util.<caret>Comparator {(x: Int, y: Int) -> 1}
|
val c = java.util.<caret>Comparator {x: Int, y: Int -> 1}
|
||||||
|
|
||||||
|
|||||||
@@ -209,6 +209,7 @@ class FirSamResolverImpl(
|
|||||||
isCrossinline = false
|
isCrossinline = false
|
||||||
isNoinline = false
|
isNoinline = false
|
||||||
isVararg = false
|
isVararg = false
|
||||||
|
resolvePhase = FirResolvePhase.BODY_RESOLVE
|
||||||
}
|
}
|
||||||
|
|
||||||
resolvePhase = FirResolvePhase.BODY_RESOLVE
|
resolvePhase = FirResolvePhase.BODY_RESOLVE
|
||||||
|
|||||||
Reference in New Issue
Block a user