FIR. Remove effectively unused parameter to resolveArgumentExpression
The only place where it was used was revised input type logic for lambda analysis, and it turns out the only significant information it carries is the presence of expected type ref, which is in fact equal to such of an expectedType argument
This commit is contained in:
committed by
Space Team
parent
669efc781d
commit
471be7405a
@@ -48,7 +48,6 @@ fun Candidate.resolveArgumentExpression(
|
|||||||
csBuilder: ConstraintSystemBuilder,
|
csBuilder: ConstraintSystemBuilder,
|
||||||
argument: FirExpression,
|
argument: FirExpression,
|
||||||
expectedType: ConeKotlinType?,
|
expectedType: ConeKotlinType?,
|
||||||
expectedTypeRef: FirTypeRef?,
|
|
||||||
sink: CheckerSink,
|
sink: CheckerSink,
|
||||||
context: ResolutionContext,
|
context: ResolutionContext,
|
||||||
isReceiver: Boolean,
|
isReceiver: Boolean,
|
||||||
@@ -112,14 +111,13 @@ fun Candidate.resolveArgumentExpression(
|
|||||||
else
|
else
|
||||||
preprocessCallableReference(argument, expectedType, context)
|
preprocessCallableReference(argument, expectedType, context)
|
||||||
// TODO:!
|
// TODO:!
|
||||||
is FirAnonymousFunctionExpression -> preprocessLambdaArgument(csBuilder, argument, expectedType, expectedTypeRef, context, sink)
|
is FirAnonymousFunctionExpression -> preprocessLambdaArgument(csBuilder, argument, expectedType, context, sink)
|
||||||
// TODO:!
|
// TODO:!
|
||||||
//TODO: Collection literal
|
//TODO: Collection literal
|
||||||
is FirWrappedArgumentExpression -> resolveArgumentExpression(
|
is FirWrappedArgumentExpression -> resolveArgumentExpression(
|
||||||
csBuilder,
|
csBuilder,
|
||||||
argument.expression,
|
argument.expression,
|
||||||
expectedType,
|
expectedType,
|
||||||
expectedTypeRef,
|
|
||||||
sink,
|
sink,
|
||||||
context,
|
context,
|
||||||
isReceiver,
|
isReceiver,
|
||||||
@@ -129,7 +127,6 @@ fun Candidate.resolveArgumentExpression(
|
|||||||
csBuilder,
|
csBuilder,
|
||||||
argument,
|
argument,
|
||||||
expectedType,
|
expectedType,
|
||||||
expectedTypeRef,
|
|
||||||
sink,
|
sink,
|
||||||
context,
|
context,
|
||||||
isReceiver,
|
isReceiver,
|
||||||
@@ -143,7 +140,6 @@ private fun Candidate.resolveBlockArgument(
|
|||||||
csBuilder: ConstraintSystemBuilder,
|
csBuilder: ConstraintSystemBuilder,
|
||||||
block: FirBlock,
|
block: FirBlock,
|
||||||
expectedType: ConeKotlinType?,
|
expectedType: ConeKotlinType?,
|
||||||
expectedTypeRef: FirTypeRef?,
|
|
||||||
sink: CheckerSink,
|
sink: CheckerSink,
|
||||||
context: ResolutionContext,
|
context: ResolutionContext,
|
||||||
isReceiver: Boolean,
|
isReceiver: Boolean,
|
||||||
@@ -169,7 +165,6 @@ private fun Candidate.resolveBlockArgument(
|
|||||||
csBuilder,
|
csBuilder,
|
||||||
argument,
|
argument,
|
||||||
expectedType,
|
expectedType,
|
||||||
expectedTypeRef,
|
|
||||||
sink,
|
sink,
|
||||||
context,
|
context,
|
||||||
isReceiver,
|
isReceiver,
|
||||||
@@ -450,7 +445,6 @@ internal fun Candidate.resolveArgument(
|
|||||||
this.system.getBuilder(),
|
this.system.getBuilder(),
|
||||||
argument,
|
argument,
|
||||||
expectedType,
|
expectedType,
|
||||||
parameter?.returnTypeRef,
|
|
||||||
sink,
|
sink,
|
||||||
context,
|
context,
|
||||||
isReceiver,
|
isReceiver,
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ package org.jetbrains.kotlin.fir.resolve.inference
|
|||||||
|
|
||||||
import org.jetbrains.kotlin.builtins.functions.FunctionTypeKind
|
import org.jetbrains.kotlin.builtins.functions.FunctionTypeKind
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirAnonymousFunction
|
import org.jetbrains.kotlin.fir.declarations.FirAnonymousFunction
|
||||||
import org.jetbrains.kotlin.fir.declarations.utils.isSuspend
|
|
||||||
import org.jetbrains.kotlin.fir.diagnostics.ConeCannotInferValueParameterType
|
import org.jetbrains.kotlin.fir.diagnostics.ConeCannotInferValueParameterType
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirReturnExpression
|
import org.jetbrains.kotlin.fir.expressions.FirReturnExpression
|
||||||
import org.jetbrains.kotlin.fir.expressions.impl.FirUnitExpression
|
import org.jetbrains.kotlin.fir.expressions.impl.FirUnitExpression
|
||||||
@@ -21,7 +20,6 @@ import org.jetbrains.kotlin.utils.addToStdlib.runIf
|
|||||||
*/
|
*/
|
||||||
fun extractLambdaInfoFromFunctionType(
|
fun extractLambdaInfoFromFunctionType(
|
||||||
expectedType: ConeKotlinType?,
|
expectedType: ConeKotlinType?,
|
||||||
expectedTypeRef: FirTypeRef?,
|
|
||||||
argument: FirAnonymousFunction,
|
argument: FirAnonymousFunction,
|
||||||
returnTypeVariable: ConeTypeVariableForLambdaReturnType?,
|
returnTypeVariable: ConeTypeVariableForLambdaReturnType?,
|
||||||
components: BodyResolveComponents,
|
components: BodyResolveComponents,
|
||||||
@@ -33,7 +31,6 @@ fun extractLambdaInfoFromFunctionType(
|
|||||||
if (expectedType is ConeFlexibleType) {
|
if (expectedType is ConeFlexibleType) {
|
||||||
return extractLambdaInfoFromFunctionType(
|
return extractLambdaInfoFromFunctionType(
|
||||||
expectedType.lowerBound,
|
expectedType.lowerBound,
|
||||||
expectedTypeRef,
|
|
||||||
argument,
|
argument,
|
||||||
returnTypeVariable,
|
returnTypeVariable,
|
||||||
components,
|
components,
|
||||||
|
|||||||
+2
-4
@@ -28,13 +28,12 @@ fun Candidate.preprocessLambdaArgument(
|
|||||||
csBuilder: ConstraintSystemBuilder,
|
csBuilder: ConstraintSystemBuilder,
|
||||||
argument: FirAnonymousFunctionExpression,
|
argument: FirAnonymousFunctionExpression,
|
||||||
expectedType: ConeKotlinType?,
|
expectedType: ConeKotlinType?,
|
||||||
expectedTypeRef: FirTypeRef?,
|
|
||||||
context: ResolutionContext,
|
context: ResolutionContext,
|
||||||
sink: CheckerSink?,
|
sink: CheckerSink?,
|
||||||
duringCompletion: Boolean = false,
|
duringCompletion: Boolean = false,
|
||||||
returnTypeVariable: ConeTypeVariableForLambdaReturnType? = null
|
returnTypeVariable: ConeTypeVariableForLambdaReturnType? = null
|
||||||
): PostponedResolvedAtom {
|
): PostponedResolvedAtom {
|
||||||
if (expectedType != null && expectedTypeRef != null && !duringCompletion && csBuilder.isTypeVariable(expectedType)) {
|
if (expectedType != null && !duringCompletion && csBuilder.isTypeVariable(expectedType)) {
|
||||||
val expectedTypeVariableWithConstraints = csBuilder.currentStorage().notFixedTypeVariables[expectedType.typeConstructor(context.typeContext)]
|
val expectedTypeVariableWithConstraints = csBuilder.currentStorage().notFixedTypeVariables[expectedType.typeConstructor(context.typeContext)]
|
||||||
|
|
||||||
if (expectedTypeVariableWithConstraints != null) {
|
if (expectedTypeVariableWithConstraints != null) {
|
||||||
@@ -43,7 +42,7 @@ fun Candidate.preprocessLambdaArgument(
|
|||||||
}?.type as ConeKotlinType?
|
}?.type as ConeKotlinType?
|
||||||
|
|
||||||
if (explicitTypeArgument == null || explicitTypeArgument.typeArguments.isNotEmpty()) {
|
if (explicitTypeArgument == null || explicitTypeArgument.typeArguments.isNotEmpty()) {
|
||||||
return LambdaWithTypeVariableAsExpectedTypeAtom(argument, expectedType, expectedTypeRef, this)
|
return LambdaWithTypeVariableAsExpectedTypeAtom(argument, expectedType, this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,7 +52,6 @@ fun Candidate.preprocessLambdaArgument(
|
|||||||
val resolvedArgument =
|
val resolvedArgument =
|
||||||
extractLambdaInfoFromFunctionType(
|
extractLambdaInfoFromFunctionType(
|
||||||
expectedType,
|
expectedType,
|
||||||
expectedTypeRef,
|
|
||||||
anonymousFunction,
|
anonymousFunction,
|
||||||
returnTypeVariable,
|
returnTypeVariable,
|
||||||
context.bodyResolveComponents,
|
context.bodyResolveComponents,
|
||||||
|
|||||||
-2
@@ -194,7 +194,6 @@ class PostponedArgumentsAnalyzer(
|
|||||||
builder,
|
builder,
|
||||||
it,
|
it,
|
||||||
returnTypeRef.type,
|
returnTypeRef.type,
|
||||||
returnTypeRef,
|
|
||||||
checkerSink,
|
checkerSink,
|
||||||
context = resolutionContext,
|
context = resolutionContext,
|
||||||
isReceiver = false,
|
isReceiver = false,
|
||||||
@@ -254,7 +253,6 @@ fun LambdaWithTypeVariableAsExpectedTypeAtom.transformToResolvedLambda(
|
|||||||
csBuilder,
|
csBuilder,
|
||||||
atom,
|
atom,
|
||||||
fixedExpectedType,
|
fixedExpectedType,
|
||||||
expectedTypeRef,
|
|
||||||
context,
|
context,
|
||||||
sink = null,
|
sink = null,
|
||||||
duringCompletion = true,
|
duringCompletion = true,
|
||||||
|
|||||||
@@ -88,7 +88,6 @@ class ResolvedLambdaAtom(
|
|||||||
class LambdaWithTypeVariableAsExpectedTypeAtom(
|
class LambdaWithTypeVariableAsExpectedTypeAtom(
|
||||||
override val atom: FirAnonymousFunctionExpression,
|
override val atom: FirAnonymousFunctionExpression,
|
||||||
private val initialExpectedTypeType: ConeKotlinType,
|
private val initialExpectedTypeType: ConeKotlinType,
|
||||||
val expectedTypeRef: FirTypeRef,
|
|
||||||
val candidateOfOuterCall: Candidate,
|
val candidateOfOuterCall: Candidate,
|
||||||
) : PostponedResolvedAtom(), LambdaWithTypeVariableAsExpectedTypeMarker {
|
) : PostponedResolvedAtom(), LambdaWithTypeVariableAsExpectedTypeMarker {
|
||||||
init {
|
init {
|
||||||
|
|||||||
+1
-1
@@ -794,7 +794,7 @@ open class FirDeclarationsResolveTransformer(
|
|||||||
): FirAnonymousFunction {
|
): FirAnonymousFunction {
|
||||||
val resolvedLambdaAtom = (expectedTypeRef as? FirResolvedTypeRef)?.let {
|
val resolvedLambdaAtom = (expectedTypeRef as? FirResolvedTypeRef)?.let {
|
||||||
extractLambdaInfoFromFunctionType(
|
extractLambdaInfoFromFunctionType(
|
||||||
it.type, it, anonymousFunction, returnTypeVariable = null, components, candidate = null, duringCompletion = false
|
it.type, anonymousFunction, returnTypeVariable = null, components, candidate = null, duringCompletion = false
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
var lambda = anonymousFunction
|
var lambda = anonymousFunction
|
||||||
|
|||||||
Reference in New Issue
Block a user