• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025 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
16function makeDate(timestamp: number): Date;  //error
17function makeDate(m: number, d: number, y: number): Date;  //error
18function makeDate(mOrTimestamp: number, d?: number, y?: number): Date {  //error
19  if (d !== undefined && y !== undefined) {
20    return new Date(y, mOrTimestamp, d);
21  } else {
22    return new Date(mOrTimestamp);
23  }
24}
25const d1 = makeDate(12345678);
26const d2 = makeDate(5, 5, 5);
27const d3 = makeDate(1, 3);
28
29class Vector {
30  abstract foo(): void  //error
31  abstract foo(x: string): void  //error
32  abstract foo(x?: string): void {  //error
33    /body/
34  }
35
36  public fun(): void  //error
37  public fun(x: string): void  //error
38  public fun(x?: string): void {  //error
39    /body/
40  }
41}
42
43abstract class absClass {
44  abstract foo(): void
45  abstract foo(x: string): void
46  abstract foo(x?: string): void {
47    /body/
48  }
49
50  constructor(x: number, y: number);  //error
51
52  constructor(magnitude: number);  //error
53
54  constructor(...args: number[]) {  //error
55      /* ... */
56    }
57}
58function func(){
59  console.log("ArkTs foo4")
60}
61
62func.val = "0xff";
63
64@Component
65struct B{
66  constructor() {
67    super()
68  }
69  build() {
70  }
71}
72
73struct C{
74  constructor() {  //error
75    super()
76  }
77  constructor(x:number)  //error
78}
79
80class A{
81  constructor() {
82  }
83}
84class D{
85  constructor() {  //error
86  }
87  constructor(x:number)  //error
88}