1/* 2 * Copyright (c) 2023 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 16// The following test case once exposed a bug: deopt does not restore vregs correctly in a loop when the number of 17// declare args is greater than the number of actual args. 18 19// @ts-nocheck 20declare function print(arg:any):string; 21 22class C { 23 x:number = 1; 24 y:number; 25 z:number; 26 27 set(x: C, y?:number, z?: number, w?: number) { 28 this.x = x.x; // occur deopt 29 print(x); 30 } 31} 32 33let c1 = new C(); 34C.prototype.bar = 1; 35let c2 = new C(); 36c2.set(c1); 37