[FE] Support functional literals with context receivers
This commit is contained in:
committed by
TeamCityServer
parent
e3f987459c
commit
16b976f0e0
@@ -198,9 +198,11 @@ class FunctionDescriptorResolver(
|
||||
}
|
||||
|
||||
val contextReceivers = function.contextReceivers
|
||||
val contextReceiverTypes = contextReceivers.mapNotNull { it.typeReference() }.map {
|
||||
typeResolver.resolveType(headerScope, it, trace, true)
|
||||
}
|
||||
val contextReceiverTypes =
|
||||
if (function is KtFunctionLiteral) expectedFunctionType.getContextReceiversTypes()
|
||||
else contextReceivers
|
||||
.mapNotNull { it.typeReference() }
|
||||
.map { typeResolver.resolveType(headerScope, it, trace, true) }
|
||||
|
||||
val valueParameterDescriptors =
|
||||
createValueParameterDescriptors(function, functionDescriptor, headerScope, trace, expectedFunctionType, inferenceSession)
|
||||
@@ -351,6 +353,9 @@ class FunctionDescriptorResolver(
|
||||
private fun KotlinType.getReceiverType(): KotlinType? =
|
||||
if (functionTypeExpected()) this.getReceiverTypeFromFunctionType() else null
|
||||
|
||||
private fun KotlinType.getContextReceiversTypes(): List<KotlinType> =
|
||||
if (functionTypeExpected()) this.getContextReceiverTypesFromFunctionType() else emptyList()
|
||||
|
||||
private fun KotlinType.getValueParameters(owner: FunctionDescriptor): List<ValueParameterDescriptor>? =
|
||||
if (functionTypeExpected()) {
|
||||
createValueParametersForInvokeInFunctionType(owner, this.getValueParameterTypesFromFunctionType())
|
||||
|
||||
Reference in New Issue
Block a user