Propagate all annotations during creating simple functional types
^KT-44563 Fixed
This commit is contained in:
+7
-2
@@ -24,6 +24,7 @@ class PostponedArgumentInputTypesResolver(
|
||||
val parametersFromDeclaration: List<KotlinTypeMarker?>?,
|
||||
val parametersFromDeclarationOfRelatedLambdas: Set<List<KotlinTypeMarker?>>?,
|
||||
val parametersFromConstraints: Set<List<TypeWithKind>>?,
|
||||
val annotations: List<AnnotationMarker>?,
|
||||
val isExtensionFunction: Boolean,
|
||||
val isSuspend: Boolean,
|
||||
val isNullable: Boolean
|
||||
@@ -57,7 +58,7 @@ class PostponedArgumentInputTypesResolver(
|
||||
argument: PostponedAtomWithRevisableExpectedType,
|
||||
postponedArguments: List<PostponedAtomWithRevisableExpectedType>,
|
||||
variableDependencyProvider: TypeVariableDependencyInformationProvider
|
||||
): ParameterTypesInfo? = with(resolutionTypeSystemContext) {
|
||||
): ParameterTypesInfo? {
|
||||
val expectedType = argument.expectedType ?: return null
|
||||
val variableWithConstraints = notFixedTypeVariables[expectedType.typeConstructor()] ?: return null
|
||||
val functionalTypesFromConstraints = findFunctionalTypesInConstraints(variableWithConstraints, variableDependencyProvider)
|
||||
@@ -76,6 +77,8 @@ class PostponedArgumentInputTypesResolver(
|
||||
}
|
||||
}
|
||||
|
||||
val annotations = functionalTypesFromConstraints?.map { it.type.getAnnotations() }?.flatten()?.distinct()
|
||||
|
||||
// An extension function flag can only come from a declaration of anonymous function: `select({ this + it }, fun Int.(x: Int) = 10)`
|
||||
val (parameterTypesFromDeclarationOfRelatedLambdas, isThereExtensionFunctionAmongRelatedLambdas) =
|
||||
getDeclaredParametersFromRelatedLambdas(argument, postponedArguments, variableDependencyProvider)
|
||||
@@ -96,6 +99,7 @@ class PostponedArgumentInputTypesResolver(
|
||||
parameterTypesFromDeclaration,
|
||||
parameterTypesFromDeclarationOfRelatedLambdas,
|
||||
parameterTypesFromConstraints,
|
||||
annotations = annotations,
|
||||
isExtensionFunction = isThereExtensionFunctionAmongRelatedLambdas || extensionFunctionTypePresentInConstraints,
|
||||
isSuspend = isSuspend,
|
||||
isNullable = isNullable
|
||||
@@ -344,7 +348,8 @@ class PostponedArgumentInputTypesResolver(
|
||||
shouldDiscriminateExtensionFunctionAnnotation -> false
|
||||
argument.isFunctionExpressionWithReceiver() -> true
|
||||
else -> parameterTypesInfo.isExtensionFunction
|
||||
}
|
||||
},
|
||||
annotations = parameterTypesInfo.annotations
|
||||
)
|
||||
|
||||
getBuilder().addSubtypeConstraint(
|
||||
|
||||
Reference in New Issue
Block a user