Skip to content

Commit 9f96f47

Browse files
committed
Added scenario when duplicate function implementation is reported
1 parent d4d6e48 commit 9f96f47

6 files changed

+103
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
tests/cases/compiler/a.ts(1,10): error TS2393: Duplicate function implementation.
2+
3+
4+
==== tests/cases/compiler/b.js (0 errors) ====
5+
function foo() {
6+
return 10;
7+
}
8+
==== tests/cases/compiler/a.ts (1 errors) ====
9+
function foo() {
10+
~~~
11+
!!! error TS2393: Duplicate function implementation.
12+
return 30;
13+
}
14+
15+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//// [tests/cases/compiler/jsFileCompilationDuplicateFunctionImplementation.ts] ////
2+
3+
//// [b.js]
4+
function foo() {
5+
return 10;
6+
}
7+
//// [a.ts]
8+
function foo() {
9+
return 30;
10+
}
11+
12+
13+
14+
//// [out.js]
15+
function foo() {
16+
return 10;
17+
}
18+
function foo() {
19+
return 30;
20+
}
21+
22+
23+
//// [out.d.ts]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
tests/cases/compiler/a.ts(1,10): error TS2393: Duplicate function implementation.
2+
3+
4+
==== tests/cases/compiler/a.ts (1 errors) ====
5+
function foo() {
6+
~~~
7+
!!! error TS2393: Duplicate function implementation.
8+
return 30;
9+
}
10+
11+
==== tests/cases/compiler/b.js (0 errors) ====
12+
function foo() {
13+
return 10;
14+
}
15+
16+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//// [tests/cases/compiler/jsFileCompilationDuplicateFunctionImplementationFileOrderReversed.ts] ////
2+
3+
//// [a.ts]
4+
function foo() {
5+
return 30;
6+
}
7+
8+
//// [b.js]
9+
function foo() {
10+
return 10;
11+
}
12+
13+
14+
15+
//// [out.js]
16+
function foo() {
17+
return 30;
18+
}
19+
function foo() {
20+
return 10;
21+
}
22+
23+
24+
//// [out.d.ts]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// @jsExtensions: js
2+
// @out: out.js
3+
// @declaration: true
4+
// @filename: b.js
5+
function foo() {
6+
return 10;
7+
}
8+
// @filename: a.ts
9+
function foo() {
10+
return 30;
11+
}
12+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// @jsExtensions: js
2+
// @out: out.js
3+
// @declaration: true
4+
// @filename: a.ts
5+
function foo() {
6+
return 30;
7+
}
8+
9+
// @filename: b.js
10+
function foo() {
11+
return 10;
12+
}
13+

0 commit comments

Comments
 (0)