diff --git a/ets2panda/checker/ets/typeCheckingHelpers.cpp b/ets2panda/checker/ets/typeCheckingHelpers.cpp index a2a5bb63d31c26d1024f311ace6ff2f2b70f144c..667c1f6fa4cfe30901264f32586e907a58729b1a 100644 --- a/ets2panda/checker/ets/typeCheckingHelpers.cpp +++ b/ets2panda/checker/ets/typeCheckingHelpers.cpp @@ -1463,7 +1463,8 @@ bool ETSChecker::CheckLambdaAssignable(ir::Expression *param, ir::ScriptFunction if (typeAnn == nullptr) { return false; } - if (typeAnn->IsETSTypeReference() && !typeAnn->AsETSTypeReference()->TsType()->IsETSArrayType()) { + if (typeAnn->IsETSTypeReference() && !typeAnn->AsETSTypeReference()->TsType()->IsETSArrayType() && + !typeAnn->AsETSTypeReference()->TsType()->IsETSAnyType()) { typeAnn = DerefETSTypeReference(typeAnn); } diff --git a/ets2panda/test/runtime/ets/any_lambda.ets b/ets2panda/test/runtime/ets/any_lambda.ets new file mode 100644 index 0000000000000000000000000000000000000000..0109a050332bb59c8fc9bdb54dcade7d4355e8ae --- /dev/null +++ b/ets2panda/test/runtime/ets/any_lambda.ets @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function foo(a: Any) { +} + +function main() { + foo(() => {}); + arktest.assertTrue(true); +} diff --git a/ets2panda/test/test-lists/recheck/recheck-ignored.txt b/ets2panda/test/test-lists/recheck/recheck-ignored.txt index 7d0a9e40abaed6122afcdd88ca63f4965a3c8368..15bc7d860cc7f88a9e822c30789505dc512eac26 100644 --- a/ets2panda/test/test-lists/recheck/recheck-ignored.txt +++ b/ets2panda/test/test-lists/recheck/recheck-ignored.txt @@ -1480,5 +1480,6 @@ runtime/ets/objectLiteral.ets runtime/ets/objectLiteralInterfaceType.ets runtime/ets/objectLiteral_abstract_class_object.ets runtime/ets/rest_object_literal.ets +runtime/ets/any_lambda.ets ast/parser/ets/while_with_empty_body.ets ast/parser/ets/de_while_with_empty_body.ets