1/* 2 * Copyright (c) 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(a: Double | undefined): Int { 18 return 1; 19 } 20 private foo(a: double): Int { 21 return 0; 22 } 23 24 foo2(a: Int | undefined): Int { 25 return 1; 26 } 27 private foo2(a: int): Int { 28 return 0; 29 } 30 31 foo3(a: Number | undefined): Int { 32 return 1; 33 } 34 private foo3(a: number): Int { 35 return 0; 36 } 37 38 foo4(a: Number | undefined): Int { 39 return 1; 40 } 41 protected foo4(a: number): Int { 42 return 0; 43 } 44 45} 46 47function main(): void { 48 assert( new A().foo(3.0) == 1) 49 assert( new A().foo2(3) == 1) 50 assert( new A().foo3(3.0) == 1) 51 assert( new A().foo4(3.0) == 1) 52} 53