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 C {
17  #p: number;
18
19  p2: number;
20  #p2: string; // not fixable
21
22  #q?: string;
23  #e!: string;
24  static #s = 0;
25  readonly #r = 20;
26  static readonly #sr = 0;
27  static readonly #srq?: string;
28
29  #m(x: number): void {}
30
31  m2(x: number): void {}
32  #m2(x: number): void {} // not fixable
33
34  m3: boolean;
35  #m3(x: number): void {} // not fixable
36
37  get #g1(): number { return 10; }
38  set #s1(x: number) { }
39
40  static get #g2(): number { return 10; }
41  static set #s2(x: number) { }
42
43  test() {
44    console.log(this.#p + this.#p2 + this.#q + this.#e + C.#s + this.#r + C.#sr + C.#srq); // '#p2' is not fixable
45    this.#m(10);
46    this.#m2(20); // not fixable
47    this.#m3(30); // not fixable
48    let x = this.#g1;
49    this.#s1 = x;
50    let y = C.#g2;
51    C.#s2 = y;
52  }
53}
54
55class D extends C {
56  #a: string;
57  #p: number; // not fixable
58
59  #m(): string { return 'foo'; } // not fixable
60
61  #bar(): string { return 'baz'; }
62  
63  test() {
64    console.log(this.#p + this.#a); // '#p' is not fixable
65    let x = this.#m(); // not fixable
66    let y = this.#bar();
67  }
68}
69
70class E {
71  #a: number;
72  #b: string; // not fixable
73
74  constructor(public b: number) {}
75}