JS IR: fix type checks for suspend function descendants (^KT-54382 fixed)

Consider `class A : suspend () -> Unit {}`. Type checks such as `is A`
are now performed via a regular `instanceof` check instead of the special
checks for suspend lambdas.
This commit is contained in:
Anton Bannykh
2022-10-12 11:52:34 +02:00
committed by Space Team
parent bc13173ea9
commit 9342356c38
7 changed files with 204 additions and 1 deletions
@@ -254,7 +254,7 @@ class TypeOperatorLowering(val context: JsIrBackendContext) : BodyLoweringPass {
toType is IrDynamicType -> argument
toType.isAny() -> generateIsObjectCheck(argument)
toType.isNothing() -> JsIrBuilder.buildComposite(context.irBuiltIns.booleanType, listOf(argument, litFalse))
toType.isSuspendFunctionTypeOrSubtype() -> generateSuspendFunctionCheck(argument, toType)
toType.isSuspendFunction() -> generateSuspendFunctionCheck(argument, toType)
isTypeOfCheckingType(toType) -> generateTypeOfCheck(argument, toType)
// toType.isChar() -> generateCheckForChar(argument)
toType.isNumber() -> generateNumberCheck(argument)