1/*
2 * Copyright (c) 2023-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
16for (let i = 0, j = 0; i < 10; ++i, j += 2) {
17    console.log(i)
18    console.log(j)
19}
20
21let x = 0
22
23// Error, no autofix
24x = (++x, x++)
25
26// No error
27for (let i = 0, j = 0; i < 10; ++i, j += 2) {
28    console.log(i)
29    console.log(j)
30}
31
32let x2 = 0
33++x2
34x2 = x2++
35
36let c = () => 33;
37
38// Error, no autofix
39const a = (1, b = 2, c());
40
41// Error, no autofix
42const r = (c(), b, 1)
43
44class Test {
45    // Error, no autofix
46    static readonly sr = (1, c(), 2);
47
48    // Error, no autofix
49    field1 = (1, 2, c());
50
51    method() {
52        // Error, no autofix
53        this.field1 = (c(), sr, 1);
54    }
55}
56
57// Error, autofix
58x++, x--
59
60// Error, autofix
61x++, x--, ++x, --x, x
62
63// Error, no autofix
64if (x++, x === 1) {
65    // Error, autofix
66    x++, x--, ++x, --x, x
67}
68
69// Error, autofix
70x++ + x--, ++x, --x;
71
72// Error, autofix
73++x, x-- + x++, --x
74
75// Error, autofix
76++x, --x, x-- + x++;
77
78// Error, autofix
79x === x, --x, x === x, x++, x === x
80
81// Error, autofix
82x instanceof number, --x, x instanceof number, x++, x instanceof number;
83
84// Error, autofix
85x in x, --x, x in x, x++, x in x
86