-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enforce keyword order between override and static/async (#43660)
* Enforce keyword order between override and static/async * Update old tests for new keyword order
- Loading branch information
1 parent
0987ee9
commit 06f25c0
Showing
13 changed files
with
85 additions
and
10 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
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
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
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
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
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
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
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
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
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,41 @@ | ||
tests/cases/conformance/override/overrideKeywordOrder.ts(12,9): error TS1029: 'override' modifier must precede 'async' modifier. | ||
tests/cases/conformance/override/overrideKeywordOrder.ts(15,12): error TS1029: 'static' modifier must precede 'override' modifier. | ||
tests/cases/conformance/override/overrideKeywordOrder.ts(19,12): error TS1029: 'public' modifier must precede 'override' modifier. | ||
tests/cases/conformance/override/overrideKeywordOrder.ts(24,12): error TS1029: 'override' modifier must precede 'readonly' modifier. | ||
|
||
|
||
==== tests/cases/conformance/override/overrideKeywordOrder.ts (4 errors) ==== | ||
class Base { | ||
static s1() {} | ||
static s2() {} | ||
m1() {} | ||
m2() {} | ||
p1: any; | ||
p2: any; | ||
} | ||
|
||
class Test1 extends Base { | ||
override async m1() {} | ||
async override m2() {} // error | ||
~~~~~~~~ | ||
!!! error TS1029: 'override' modifier must precede 'async' modifier. | ||
} | ||
class Test2 extends Base { | ||
override static s1() {} // error | ||
~~~~~~ | ||
!!! error TS1029: 'static' modifier must precede 'override' modifier. | ||
static override s2() {} | ||
} | ||
class Test3 extends Base { | ||
override public m1() {} // error | ||
~~~~~~ | ||
!!! error TS1029: 'public' modifier must precede 'override' modifier. | ||
public override m2() {} | ||
} | ||
class Test4 extends Base { | ||
override readonly p1: any; | ||
readonly override p2: any; // error | ||
~~~~~~~~ | ||
!!! error TS1029: 'override' modifier must precede 'readonly' modifier. | ||
} | ||
|
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
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
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,28 @@ | ||
// @noTypesAndSymbols: true | ||
// @noEmit: true | ||
|
||
class Base { | ||
static s1() {} | ||
static s2() {} | ||
m1() {} | ||
m2() {} | ||
p1: any; | ||
p2: any; | ||
} | ||
|
||
class Test1 extends Base { | ||
override async m1() {} | ||
async override m2() {} // error | ||
} | ||
class Test2 extends Base { | ||
override static s1() {} // error | ||
static override s2() {} | ||
} | ||
class Test3 extends Base { | ||
override public m1() {} // error | ||
public override m2() {} | ||
} | ||
class Test4 extends Base { | ||
override readonly p1: any; | ||
readonly override p2: any; // error | ||
} |