[FIR] Fix completion of synthetic call arguments
This commit is contained in:
Vendored
+1
-1
@@ -75,7 +75,7 @@ FILE: RedundantExplicitTypeChecker.kt
|
||||
public final fun test(boolean: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||
lval expectedLong: R|kotlin/Long| = when () {
|
||||
R|<local>/boolean| -> {
|
||||
Int(42)
|
||||
Long(42)
|
||||
}
|
||||
else -> {
|
||||
^test Unit
|
||||
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
FILE: SpecialCallsWithLambdas.kt
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
lval inv: R|() -> kotlin/Function0<kotlin/Unit>| = fun <anonymous>(): R|() -> kotlin/Unit| {
|
||||
^ fun <anonymous>(): R|kotlin/Unit| {
|
||||
^ Unit
|
||||
}
|
||||
|
||||
}
|
||||
!!
|
||||
lval bar: R|() -> kotlin/Function0<kotlin/Unit>| = fun <anonymous>(): R|() -> kotlin/Unit| {
|
||||
^ fun <anonymous>(): R|kotlin/Unit| {
|
||||
^ Unit
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
fun foo() {
|
||||
val inv = {{}}!!
|
||||
val bar = {{}}
|
||||
}
|
||||
+6
@@ -4889,6 +4889,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/receiverResolutionInLambda.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SpecialCallsWithLambdas.kt")
|
||||
public void testSpecialCallsWithLambdas() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/SpecialCallsWithLambdas.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("TypesEligibleForSimpleVisit.kt")
|
||||
public void testTypesEligibleForSimpleVisit() throws Exception {
|
||||
|
||||
+4
-1
@@ -534,13 +534,16 @@ class FirCallCompletionResultsWriterTransformer(
|
||||
syntheticCall: D,
|
||||
data: ExpectedArgumentType?,
|
||||
): CompositeTransformResult<FirStatement> where D : FirResolvable, D : FirExpression {
|
||||
syntheticCall.transformChildren(this, data?.getExpectedType(syntheticCall)?.toExpectedType())
|
||||
val calleeReference = syntheticCall.calleeReference as? FirNamedReferenceWithCandidate ?: return syntheticCall.compose()
|
||||
|
||||
val declaration = calleeReference.candidate.symbol.fir as? FirSimpleFunction ?: return syntheticCall.compose()
|
||||
|
||||
val typeRef = typeCalculator.tryCalculateReturnType(declaration)
|
||||
syntheticCall.replaceTypeRefWithSubstituted(calleeReference, typeRef)
|
||||
syntheticCall.transformChildren(
|
||||
this,
|
||||
data = data?.getExpectedType(syntheticCall)?.toExpectedType() ?: syntheticCall.typeRef.coneType.toExpectedType()
|
||||
)
|
||||
|
||||
return (syntheticCall.transformCalleeReference(
|
||||
StoreCalleeReference,
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
@@ -5,7 +5,7 @@ fun <M> materialize(): M = TODO()
|
||||
|
||||
fun test(b: Boolean) {
|
||||
<!INAPPLICABLE_CANDIDATE!>id<!>(if (b) {
|
||||
<!INAPPLICABLE_CANDIDATE!>id<!>(<!UNRESOLVED_REFERENCE!>unresolved<!>)
|
||||
id(<!UNRESOLVED_REFERENCE!>unresolved<!>)
|
||||
} else {
|
||||
id(
|
||||
materialize()
|
||||
|
||||
Reference in New Issue
Block a user