From bfad2a3b6b9f6229620eb262b9500d26f614cddd Mon Sep 17 00:00:00 2001 From: anjiaqi Date: Sat, 21 Jun 2025 21:59:23 +0800 Subject: [PATCH] Fix the missing CTE for function type assignment Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/ICGVCN Reason: CTE was missed when an assignment problem about reassigning after defining a function type variable occurs. Description: Enhance the check for function type assignment by adding alignment check for the number of optional params between the source function signature and target function signature. Signed-off-by: anjiaqi --- ets2panda/checker/types/ets/etsFunctionType.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ets2panda/checker/types/ets/etsFunctionType.cpp b/ets2panda/checker/types/ets/etsFunctionType.cpp index 0ec3b4ecac..3a333a507e 100644 --- a/ets2panda/checker/types/ets/etsFunctionType.cpp +++ b/ets2panda/checker/types/ets/etsFunctionType.cpp @@ -209,6 +209,9 @@ static bool SignatureIsSupertypeOf(TypeRelation *relation, Signature *super, Sig if (super->MinArgCount() < sub->MinArgCount()) { return false; } + if (super->MinArgCount() == sub->MinArgCount() && super->Params().size() != sub->Params().size()) { + return false; + } if ((super->RestVar() != nullptr && sub->RestVar() == nullptr) || (super->RestVar() == nullptr && sub->RestVar() != nullptr)) { return false; -- Gitee