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 16 17function foo1 (tuple: Readonly<[number, string, boolean]>, arr: Readonly<int[]>) { 18 foo2(tuple, arr) 19 let x: readonly [number, string, boolean] = tuple 20 let y: readonly int[] = arr 21} 22 23function foo2 (tuple: readonly [number, string, boolean], arr: readonly int[]) { 24 foo3(tuple, arr) 25 let x: Readonly<[number, string, boolean]> = tuple 26 let y: Readonly<int[]> = arr 27} 28 29function foo3 (tuple: Readonly<[number, string, boolean]>, arr: Readonly<int[]>) { 30 let x: readonly [number, string, boolean] = tuple 31 let y: readonly int[] = arr 32} 33 34function main() : void { 35 foo1([1, "ab", true], [1, 2]) 36 foo2([1, "ab", true], [1, 2]) 37 38 let tuple1: Readonly<[int, boolean]> = [1, true] 39 let arr1: Readonly<int[]> = [] 40 let tuple2: readonly [int, boolean] = tuple1 41 let arr2: readonly int[] = arr1 42 43 arr1 = arr2 44 tuple1 = tuple2 45} 46 47