Resolve calls using the builder inference despite the presence of the annotation if there are uninferred type variables
^KT-48194 Fixed
This commit is contained in:
committed by
TeamCityServer
parent
55811c8851
commit
bf1e68a53f
+8
-2
@@ -9,6 +9,8 @@ import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.builtins.getReceiverTypeFromFunctionType
|
||||
import org.jetbrains.kotlin.builtins.getValueParameterTypesFromFunctionType
|
||||
import org.jetbrains.kotlin.builtins.isBuiltinFunctionalType
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.descriptors.annotations.FilteredAnnotations
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.addSubsystemFromArgument
|
||||
@@ -23,7 +25,8 @@ import org.jetbrains.kotlin.types.typeUtil.builtIns
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.cast
|
||||
|
||||
class PostponedArgumentsAnalyzer(
|
||||
private val callableReferenceResolver: CallableReferenceResolver
|
||||
private val callableReferenceResolver: CallableReferenceResolver,
|
||||
private val languageVersionSettings: LanguageVersionSettings
|
||||
) {
|
||||
|
||||
fun analyze(
|
||||
@@ -180,7 +183,10 @@ class PostponedArgumentsAnalyzer(
|
||||
|
||||
lambda.setAnalyzedResults(returnArgumentsInfo, subResolvedKtPrimitives)
|
||||
|
||||
if (inferenceSession != null && lambda.atom.hasBuilderInferenceAnnotation) {
|
||||
val shouldUseBuilderInference = lambda.atom.hasBuilderInferenceAnnotation
|
||||
|| languageVersionSettings.supportsFeature(LanguageFeature.UseBuilderInferenceWithoutAnnotation)
|
||||
|
||||
if (inferenceSession != null && shouldUseBuilderInference) {
|
||||
val storageSnapshot = c.getBuilder().currentStorage()
|
||||
|
||||
val postponedVariables = inferenceSession.inferPostponedVariables(
|
||||
|
||||
+3
-1
@@ -176,9 +176,11 @@ class KotlinConstraintSystemCompleter(
|
||||
if (!useBuilderInferenceOnlyIfNeeded) return false
|
||||
|
||||
val lambdaArguments = postponedArguments.filterIsInstance<ResolvedLambdaAtom>().takeIf { it.isNotEmpty() } ?: return false
|
||||
val useBuilderInferenceWithoutAnnotation =
|
||||
languageVersionSettings.supportsFeature(LanguageFeature.UseBuilderInferenceWithoutAnnotation)
|
||||
|
||||
return lambdaArguments.any { argument ->
|
||||
if (!argument.atom.hasBuilderInferenceAnnotation)
|
||||
if (!argument.atom.hasBuilderInferenceAnnotation && !useBuilderInferenceWithoutAnnotation)
|
||||
return@any false
|
||||
|
||||
val notFixedInputTypeVariables = argument.inputTypes
|
||||
|
||||
Reference in New Issue
Block a user