diff --git a/ets2panda/checker/ets/function.cpp b/ets2panda/checker/ets/function.cpp index f42c123c760130414ae1a5beef82b2a2157f2fe3..ceed3c0dd3fcdcccce11414c0efc5cb6b80b7a96 100644 --- a/ets2panda/checker/ets/function.cpp +++ b/ets2panda/checker/ets/function.cpp @@ -727,6 +727,7 @@ bool ETSChecker::ValidateSignatureRestParams(Signature *substitutedSig, const Ar if (!invocationCtx.IsInvocable()) { if (restArgument->IsArrayExpression()) { ModifyPreferredType(restArgument->AsArrayExpression(), nullptr); + argument->SetTsType(nullptr); } return false; } diff --git a/ets2panda/test/ast/compiler/ets/overload_crash.ets b/ets2panda/test/ast/compiler/ets/overload_crash.ets new file mode 100644 index 0000000000000000000000000000000000000000..7350e84eddf26fb08cf63f54aabcab5c6a91aa63 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/overload_crash.ets @@ -0,0 +1,26 @@ +/* + * 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 path(); +function path(obj: Object, ...keys: (string | number)[]); +function path(obj: Object, ...keys: (string | number)[]) { +} + +function f1(thing: string) { + path(thing, ...['a']); +} + +/* @@? 16:10 Error TypeError: Only abstract or native methods can't have body. */ +/* @@? 18:1 Error TypeError: Function path with this assembly signature already declared. */