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 constantCases(): void{ 17 let a : char = 100; 18 let first = true ? a : 68; 19 20 let b : byte = 50; 21 let sec = false ? b : 68; 22 23 let c : Short = 721; 24 let third = true ? c : 419; 25 26 let d : char = 3; 27 let fourth = false ? c : 665; 28 29 let e : Byte = 88; 30 let fifth = true ? c : 665; 31 32 let f : short = 20; 33 let sixth = true ? c : 665419; 34 35 let g : double = 40; 36 let seventh = false ? g : 30; 37} 38 39function unboxingCases(): void{ 40 let a : Char = c'k'; 41 let b : char = c'l'; 42 let first = true ? a : b; 43 44 let c : Int = 11; 45 let d : int = 10; 46 let sec = false ? a : b; 47} 48 49function dominantNumericCases(): void{ 50 let a : double = 2.0; 51 let b : float = 2.0; 52 let c : long = 2; 53 let d : int = 2; 54 let e : Short = 2; 55 let f : byte = 2; 56 let g : char = 2; 57 58 let first = false ? a : b; 59 let sec = false ? b : c; 60 let third = false ? c : d; 61 let fourth = false ? d : e; 62 let fifth = false ? e : f; 63 let sixth = false ? f : g; 64} 65 66function main(): void { 67 constantCases(); 68 unboxingCases(); 69 dominantNumericCases(); 70} 71