1/* 2 * Copyright (c) 2021-2024 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 { 17 foo(): void{ 18 let a: boolean = new Boolean(true); 19 let b: Boolean = true; 20 let r: byte = 20; 21 let c: byte = new Byte(r); 22 let d: Byte = 20; 23 let s: short = 2000; 24 let e: short = new Short(s); 25 let t: Short = 20; 26 let f: Short = 2000; 27 let g: char = new Char(c'a'); 28 let h: Char = c'a'; 29 let i: int = new Int(200000); 30 let u: Int = 20; 31 let v: Int = 2000; 32 let j: Int = 200000; 33 let k: long = new Long(200000000000); 34 let l: Long = 200000000000; 35 let m: float = 2.22; 36 let n: float = new Float(m); 37 let o: Float = m; 38 let p: double = new Double(2.2222222222); 39 let q: Double = 2.2222222222; 40 } 41 42 booleanPrimitive(a: boolean): void {} 43 booleanReference(a: Boolean): void {} 44 bytePrimitive(a: byte): void {} 45 byteReference(a: Byte): void {} 46 shortPrimitive(a: short): void {} 47 shortReference(a: Short): void {} 48 charPrimitive(a: char): void {} 49 charReference(a: Char): void {} 50 integerPrimitive(a: int): void {} 51 integerReference(a: Int): void {} 52 longPrimitive(a: long): void {} 53 longReference(a: Long): void {} 54 floatPrimitive(a: float): void {} 55 floatReference(a: Float): void {} 56 doublePrimitive(a: double): void {} 57 doubleReference(a: Double): void {} 58 59 checker(): void { 60 this.booleanPrimitive(new Boolean(false)); 61 this.booleanReference(false); 62 let r: byte = 20; 63 this.bytePrimitive(new Byte(r)); 64 this.byteReference(r); 65 let s: short = 2000; 66 this.shortPrimitive(new Short(s)); 67 this.shortReference(s); 68 this.charPrimitive(new Char(c'a')); 69 this.charReference(c'a'); 70 this.integerPrimitive(new Int(200000)); 71 this.integerReference(200000); 72 this.longPrimitive(new Long(200000000000000)); 73 this.longReference(200000000000000); 74 let f: float = 2.22; 75 this.floatPrimitive(new Float(f)); 76 this.floatReference(f); 77 this.doublePrimitive(new Double(2.2222222222)); 78 this.doubleReference(2.2222222222); 79 } 80} 81