-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5664 from Microsoft/Port-5662
port 5662 into release-1.7
- Loading branch information
Showing
10 changed files
with
174 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
tests/baselines/reference/mixedStaticAndInstanceClassMembers.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
tests/cases/compiler/mixedStaticAndInstanceClassMembers.ts(4,5): error TS2387: Function overload must be static. | ||
tests/cases/compiler/mixedStaticAndInstanceClassMembers.ts(12,12): error TS2388: Function overload must not be static. | ||
tests/cases/compiler/mixedStaticAndInstanceClassMembers.ts(13,5): error TS2387: Function overload must be static. | ||
|
||
|
||
==== tests/cases/compiler/mixedStaticAndInstanceClassMembers.ts (3 errors) ==== | ||
class A { | ||
f() {} | ||
static m1 (a: string): void; | ||
m1 (a: number): void; | ||
~~ | ||
!!! error TS2387: Function overload must be static. | ||
m1 (a: any): void { | ||
} | ||
} | ||
|
||
class B { | ||
f() {} | ||
m1 (a: string): void; | ||
static m1 (a: number): void; | ||
~~ | ||
!!! error TS2388: Function overload must not be static. | ||
m1 (a: any): void { | ||
~~ | ||
!!! error TS2387: Function overload must be static. | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
tests/baselines/reference/mixedStaticAndInstanceClassMembers.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//// [mixedStaticAndInstanceClassMembers.ts] | ||
class A { | ||
f() {} | ||
static m1 (a: string): void; | ||
m1 (a: number): void; | ||
m1 (a: any): void { | ||
} | ||
} | ||
|
||
class B { | ||
f() {} | ||
m1 (a: string): void; | ||
static m1 (a: number): void; | ||
m1 (a: any): void { | ||
} | ||
} | ||
|
||
//// [mixedStaticAndInstanceClassMembers.js] | ||
var A = (function () { | ||
function A() { | ||
} | ||
A.prototype.f = function () { }; | ||
A.prototype.m1 = function (a) { | ||
}; | ||
return A; | ||
})(); | ||
var B = (function () { | ||
function B() { | ||
} | ||
B.prototype.f = function () { }; | ||
B.prototype.m1 = function (a) { | ||
}; | ||
return B; | ||
})(); |
23 changes: 23 additions & 0 deletions
23
tests/baselines/reference/nonMergedDeclarationsAndOverloads.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
tests/cases/compiler/nonMergedDeclarationsAndOverloads.ts(2,5): error TS2300: Duplicate identifier 'm1'. | ||
tests/cases/compiler/nonMergedDeclarationsAndOverloads.ts(4,5): error TS2300: Duplicate identifier 'm1'. | ||
tests/cases/compiler/nonMergedDeclarationsAndOverloads.ts(5,5): error TS2300: Duplicate identifier 'm1'. | ||
tests/cases/compiler/nonMergedDeclarationsAndOverloads.ts(6,5): error TS2300: Duplicate identifier 'm1'. | ||
|
||
|
||
==== tests/cases/compiler/nonMergedDeclarationsAndOverloads.ts (4 errors) ==== | ||
class A { | ||
m1: string; | ||
~~ | ||
!!! error TS2300: Duplicate identifier 'm1'. | ||
f() {} | ||
m1 (a: string): void; | ||
~~ | ||
!!! error TS2300: Duplicate identifier 'm1'. | ||
m1 (a: number): void; | ||
~~ | ||
!!! error TS2300: Duplicate identifier 'm1'. | ||
m1 (a: any): void { | ||
~~ | ||
!!! error TS2300: Duplicate identifier 'm1'. | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
tests/baselines/reference/nonMergedDeclarationsAndOverloads.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//// [nonMergedDeclarationsAndOverloads.ts] | ||
class A { | ||
m1: string; | ||
f() {} | ||
m1 (a: string): void; | ||
m1 (a: number): void; | ||
m1 (a: any): void { | ||
} | ||
} | ||
|
||
//// [nonMergedDeclarationsAndOverloads.js] | ||
var A = (function () { | ||
function A() { | ||
} | ||
A.prototype.f = function () { }; | ||
A.prototype.m1 = function (a) { | ||
}; | ||
return A; | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
tests/cases/compiler/nonMergedOverloads.ts(1,5): error TS2300: Duplicate identifier 'f'. | ||
tests/cases/compiler/nonMergedOverloads.ts(3,17): error TS1148: Cannot compile modules unless the '--module' flag is provided. | ||
tests/cases/compiler/nonMergedOverloads.ts(3,17): error TS2300: Duplicate identifier 'f'. | ||
tests/cases/compiler/nonMergedOverloads.ts(4,17): error TS2300: Duplicate identifier 'f'. | ||
|
||
|
||
==== tests/cases/compiler/nonMergedOverloads.ts (4 errors) ==== | ||
var f = 10; | ||
~ | ||
!!! error TS2300: Duplicate identifier 'f'. | ||
|
||
export function f(); | ||
~ | ||
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided. | ||
~ | ||
!!! error TS2300: Duplicate identifier 'f'. | ||
export function f() { | ||
~ | ||
!!! error TS2300: Duplicate identifier 'f'. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//// [nonMergedOverloads.ts] | ||
var f = 10; | ||
|
||
export function f(); | ||
export function f() { | ||
} | ||
|
||
//// [nonMergedOverloads.js] | ||
var f = 10; | ||
function f() { | ||
} | ||
exports.f = f; |
15 changes: 15 additions & 0 deletions
15
tests/cases/compiler/mixedStaticAndInstanceClassMembers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class A { | ||
f() {} | ||
static m1 (a: string): void; | ||
m1 (a: number): void; | ||
m1 (a: any): void { | ||
} | ||
} | ||
|
||
class B { | ||
f() {} | ||
m1 (a: string): void; | ||
static m1 (a: number): void; | ||
m1 (a: any): void { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class A { | ||
m1: string; | ||
f() {} | ||
m1 (a: string): void; | ||
m1 (a: number): void; | ||
m1 (a: any): void { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
var f = 10; | ||
|
||
export function f(); | ||
export function f() { | ||
} |