KT-52791 Make it possible to pass multiple context receivers to a class
This commit is contained in:
committed by
Space Team
parent
62217b39ec
commit
906c161068
+5
-4
@@ -206,12 +206,13 @@ class TypeAliasConstructorDescriptorImpl private constructor(
|
||||
|
||||
val classDescriptor = typeAliasDescriptor.classDescriptor
|
||||
val contextReceiverParameters = classDescriptor?.let {
|
||||
constructor.contextReceiverParameters.map {
|
||||
constructor.contextReceiverParameters.mapIndexed { index, contextReceiver ->
|
||||
DescriptorFactory.createContextReceiverParameterForClass(
|
||||
classDescriptor,
|
||||
substitutorForUnderlyingClass.safeSubstitute(it.type, Variance.INVARIANT),
|
||||
(it.value as ImplicitContextReceiver).customLabelName,
|
||||
Annotations.EMPTY
|
||||
substitutorForUnderlyingClass.safeSubstitute(contextReceiver.type, Variance.INVARIANT),
|
||||
(contextReceiver.value as ImplicitContextReceiver).customLabelName,
|
||||
Annotations.EMPTY,
|
||||
index
|
||||
)
|
||||
}
|
||||
} ?: emptyList()
|
||||
|
||||
@@ -246,10 +246,12 @@ public class DescriptorFactory {
|
||||
@NotNull ClassDescriptor owner,
|
||||
@Nullable KotlinType receiverParameterType,
|
||||
@Nullable Name customLabelName,
|
||||
@NotNull Annotations annotations
|
||||
@NotNull Annotations annotations,
|
||||
int index
|
||||
) {
|
||||
return receiverParameterType == null
|
||||
? null
|
||||
: new ReceiverParameterDescriptorImpl(owner, new ContextClassReceiver(owner, receiverParameterType, customLabelName, null), annotations);
|
||||
: new ReceiverParameterDescriptorImpl(owner, new ContextClassReceiver(owner, receiverParameterType, customLabelName, null),
|
||||
annotations, NameUtils.contextReceiverName(index));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user