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:
Ting-Yuan Huang
2019-05-20 17:52:01 -07:00
committed by max-kammerer
parent 72fdc648ff
commit 0aee2d0568
9 changed files with 90 additions and 5 deletions
@@ -327,13 +327,13 @@ class ExpressionCodegen(
}
callGenerator.beforeValueParametersStart()
val defaultMask = DefaultCallArgs(callable.valueParameterTypes.size)
val extraArgsShift =
when {
callee is IrConstructor && callee.parentAsClass.isEnumClass -> 2
callee is IrConstructor && callee.parentAsClass.isInner -> 1 // skip the `$outer` parameter
else -> 0
}
val defaultMask = DefaultCallArgs(callable.valueParameterTypes.size - extraArgsShift)
val typeParameters = if (callee is IrConstructor)
callee.parentAsClass.typeParameters + callee.typeParameters
else