Fix failing IR tests because of CCE in WrappedValueParameterDescriptor

In previous commits, renderValueParameter began to calculate its
containing declaration. However, WrappedValueParameterDescriptor
assumes that parent of IrParameter is IrFunction, which is not true
for dispatch receiver parameters. The correct fix would be not to create
WrappedValueParameterDescriptor for dispatch receivers at all and use
WrappedReceiverParameterDescriptor instead. In this fix, I just moved
parameter' containing declaration calculation inside specific option
which is usually false, thus hiding the found problem.
This commit is contained in:
Mikhail Glukhikh
2018-11-22 13:01:32 +03:00
parent 22830ebbf8
commit d50c4d7211
2 changed files with 3 additions and 2 deletions
@@ -88,6 +88,8 @@ abstract class WrappedCallableDescriptor<T : IrDeclaration>(
override fun <V : Any?> getUserData(key: CallableDescriptor.UserDataKey<V>?): V? = null
}
// TODO: (Roman Artemev) do not create this kind of descriptor for dispatch receiver parameters
// WrappedReceiverParameterDescriptor should be used instead
open class WrappedValueParameterDescriptor(
annotations: Annotations = Annotations.EMPTY,
sourceElement: SourceElement = SourceElement.NO_SOURCE
@@ -815,8 +815,7 @@ internal class DescriptorRendererImpl(
renderModifier(builder, valueParameter.isCrossinline, "crossinline")
renderModifier(builder, valueParameter.isNoinline, "noinline")
val containingDeclaration = valueParameter.containingDeclaration
if (renderAnnotationPropertiesInPrimaryConstructor && containingDeclaration.isAnnotationConstructor()) {
if (renderAnnotationPropertiesInPrimaryConstructor && valueParameter.containingDeclaration.isAnnotationConstructor()) {
renderModifier(builder, actualPropertiesInPrimaryConstructor, "actual")
renderModifier(builder, true, "val")
}