1/* 2 * Copyright (c) 2024-2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16function foo(...^number: int[]): int { 17 return number[0] 18} 19 20/* @@? 16:10 Error TypeError: Only abstract or native methods can't have body. */ 21/* @@? 16:14 Error SyntaxError: Rest parameter should be either array or tuple type. */ 22/* @@? 16:17 Error SyntaxError: Unexpected token, expected an identifier. */ 23/* @@? 16:18 Error SyntaxError: Parameter declaration should have an explicit type annotation. */ 24/* @@? 16:18 Error SyntaxError: Rest parameter must be the last formal parameter. */ 25/* @@? 16:31 Error SyntaxError: Unexpected token ')'. */ 26/* @@? 16:32 Error SyntaxError: Unexpected token ':'. */ 27/* @@? 16:34 Error SyntaxError: Unexpected token 'int'. */ 28/* @@? 16:38 Error SyntaxError: Unexpected token '{'. */ 29/* @@? 17:5 Error SyntaxError: return keyword should be used in function body. */ 30/* @@? 17:12 Error TypeError: Type name 'number' used in the wrong context */ 31/* @@? 17:12 Error TypeError: Indexed access is not supported for such expression type. */ 32/* @@? 17:12 Error TypeError: All return statements in the function should be empty or have a value. */ 33