1/* 2* Copyright (c) Microsoft Corporation. All rights reserved. 3* Copyright (c) 2023 Huawei Device Co., Ltd. 4* Licensed under the Apache License, Version 2.0 (the "License"); 5* you may not use this file except in compliance with the License. 6* You may obtain a copy of the License at 7* 8* http://www.apache.org/licenses/LICENSE-2.0 9* 10* Unless required by applicable law or agreed to in writing, software 11* distributed under the License is distributed on an "AS IS" BASIS, 12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13* See the License for the specific language governing permissions and 14* limitations under the License. 15* 16* This file has been modified by Huawei to verify type inference by adding verification statements. 17*/ 18 19// === tests/cases/conformance/types/typeParameters/typeParameterLists/innerTypeParameterShadowingOuterOne2.ts === 20declare function AssertType(value:any, type:string):void; 21// inner type parameters shadow outer ones of the same name 22// no errors expected 23 24class C<T extends Date> { 25 g<T extends Number>() { 26 let x: T; 27AssertType(x, "T"); 28 29 x.toFixed(); 30AssertType(x.toFixed(), "string"); 31AssertType(x.toFixed, "(?number) => string"); 32 } 33 34 h() { 35 let x: T; 36AssertType(x, "T"); 37 38 x.getDate(); 39AssertType(x.getDate(), "number"); 40AssertType(x.getDate, "() => number"); 41 } 42} 43 44class C2<T extends Date, U extends Date> { 45 g<T extends Number, U extends Number>() { 46 let x: U; 47AssertType(x, "U"); 48 49 x.toFixed(); 50AssertType(x.toFixed(), "string"); 51AssertType(x.toFixed, "(?number) => string"); 52 } 53 54 h() { 55 let x: U; 56AssertType(x, "U"); 57 58 x.getDate(); 59AssertType(x.getDate(), "number"); 60AssertType(x.getDate, "() => number"); 61 } 62} 63 64