From ff3054709c62ed3f50ff7368a00651253e973324 Mon Sep 17 00:00:00 2001 From: Zelentsov Dmitry Date: Thu, 5 Jun 2025 15:49:22 +0300 Subject: [PATCH] Skip check of Promise constructor signatures Signed-off-by: Zelentsov Dmitry --- ets2panda/checker/ets/function.cpp | 10 +++++++--- ets2panda/checker/ets/typeCheckingHelpers.cpp | 3 +-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ets2panda/checker/ets/function.cpp b/ets2panda/checker/ets/function.cpp index a10f692e51..2096688b6e 100644 --- a/ets2panda/checker/ets/function.cpp +++ b/ets2panda/checker/ets/function.cpp @@ -872,9 +872,13 @@ Signature *ETSChecker::ValidateSignatures(ArenaVector &signatures, if (!compatibleSignatures.empty()) { // SUPPRESS_CSA_NEXTLINE(alpha.core.AllocatorETSCheckerHint) auto *sig = GetMostSpecificSignature(compatibleSignatures, arguments, pos, resolveFlags); - // May need to re-check the arguments now that we know the particular signature to call. - ValidateSignature({sig, nullptr, TypeRelationFlag::WIDENING | TypeRelationFlag::NO_SUBSTITUTION_NEEDED}, - arguments, pos, FindTypeInferenceArguments(arguments), true); + // NOTE (DZ): skip Promise constructor check - temporary solution, need to be removed after fixing OHOS code! + if (sig == nullptr || !sig->HasFunction() || !sig->Function()->IsConstructor() || + !sig->Owner()->Name().Is("Promise")) { + // May need to re-check the arguments now that we know the particular signature to call. + ValidateSignature({sig, nullptr, TypeRelationFlag::WIDENING | TypeRelationFlag::NO_SUBSTITUTION_NEEDED}, + arguments, pos, FindTypeInferenceArguments(arguments), true); + } return sig; } diff --git a/ets2panda/checker/ets/typeCheckingHelpers.cpp b/ets2panda/checker/ets/typeCheckingHelpers.cpp index 6598de0690..a8889c7de8 100644 --- a/ets2panda/checker/ets/typeCheckingHelpers.cpp +++ b/ets2panda/checker/ets/typeCheckingHelpers.cpp @@ -1421,8 +1421,7 @@ bool ETSChecker::CheckLambdaTypeAnnotation(ir::ETSParameterExpression *param, return true; } // SUPPRESS_CSA_NEXTLINE(alpha.core.AllocatorETSCheckerHint) - return CheckLambdaInfer(typeAnnotation, arrowFuncExpr, nonNullishParam) && - (checkInvocable(flags) || CheckLambdaAssignable(param, arrowFuncExpr->Function())); + return CheckLambdaInfer(typeAnnotation, arrowFuncExpr, nonNullishParam) && checkInvocable(flags); } // Preserve actual lambda types -- Gitee