1/* 2 * Copyright (c) 2023-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 16class A { foo() {}} 17class B extends A { bar() {}} 18 19type num_str_str_type = [number, string, string]; 20type num_str_str_with_array = [num_str_str_type, number[]]; 21 22function main(): void { 23 const tup_arr_1: num_str_str_type[] = [ 24 [0, "a", "d"], 25 [1, "b", "e"], 26 [2, "c", "f"], 27 ]; 28 29 const tup_arr_2: num_str_str_with_array[] = [ 30 [tup_arr_1[0], [250]], 31 [tup_arr_1[1], [250, 260]], 32 [tup_arr_1[0], [300, 300, 300]], 33 ]; 34 35 const a_var = tup_arr_2[0][1][0] + tup_arr_2[1][1][0] + tup_arr_2[2][1][0]; 36 const b_var = tup_arr_2[1][1][1] + tup_arr_2[2][1][1]; 37 const c_var = tup_arr_2[2][1][2]; 38 39 let d_var: [number, string] = [1, "A"]; 40 let e_var: [number, string, boolean] = [1, "A", true]; 41 let f_var: [number, string, boolean, number, string]; 42 f_var = [1, "A", true, 20, "B"]; 43 44 let g_var: [number, string][]; 45 g_var = [[1, "A"], [2, "B"], [3, "C"]]; 46 47 // #15570 - test ArrayExpr assignability with individual element types 48 // let h_var: [number, int, string, boolean, Object] = [1, 2, "asd", false, new Object()]; 49 // let i_var: float = h_var[1]; 50 // let j_var: [int, number, string, boolean, Object] = [6, 7, "abc", true, 666]; 51 // NOTE: Bug in op_assignment lowering (removes const from property) 52 // j_var[0] += new Short(2 as short); 53 54 let empty: [] = []; 55} 56