Fix signature generation for calls to enum and inner class constructors
The synthesized arguments caused the size of default value mask off by one when it is close to the boundary of Int.SIZE, which in turn resulted in wrong signature at call sites.
This commit is contained in:
committed by
max-kammerer
parent
72fdc648ff
commit
0aee2d0568
@@ -912,7 +912,15 @@ class KotlinTypeMapper @JvmOverloads constructor(
|
||||
jvmSignature,
|
||||
if (isStaticMethod(kind, functionDescriptor) || isStaticDeclaration(functionDescriptor) || isConstructor)
|
||||
null else ownerType.descriptor,
|
||||
functionDescriptor.unwrapFrontendVersion()
|
||||
functionDescriptor.unwrapFrontendVersion(),
|
||||
if (isIrBackend && isConstructor) {
|
||||
val containingDeclaration = functionDescriptor.containingDeclaration
|
||||
when {
|
||||
isEnumClass(containingDeclaration) -> 2
|
||||
(containingDeclaration as? ClassDescriptor)?.isInner == true -> 1
|
||||
else -> 0
|
||||
}
|
||||
} else 0
|
||||
)
|
||||
|
||||
return Method(if (isConstructor) "<init>" else jvmSignature.name + JvmAbi.DEFAULT_PARAMS_IMPL_SUFFIX, descriptor)
|
||||
@@ -1578,10 +1586,11 @@ class KotlinTypeMapper @JvmOverloads constructor(
|
||||
private fun getDefaultDescriptor(
|
||||
method: Method,
|
||||
dispatchReceiverDescriptor: String?,
|
||||
callableDescriptor: CallableDescriptor
|
||||
callableDescriptor: CallableDescriptor,
|
||||
extraArgsShift: Int
|
||||
): String {
|
||||
val descriptor = method.descriptor
|
||||
val maskArgumentsCount = (callableDescriptor.valueParameters.size + Integer.SIZE - 1) / Integer.SIZE
|
||||
val maskArgumentsCount = (callableDescriptor.valueParameters.size - extraArgsShift + Integer.SIZE - 1) / Integer.SIZE
|
||||
val defaultConstructorMarkerType = if (isConstructor(method) || isInlineClassConstructor(callableDescriptor))
|
||||
DEFAULT_CONSTRUCTOR_MARKER
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user