-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Report error when referencing class name from decorator (#57666)
- Loading branch information
Showing
9 changed files
with
507 additions
and
7 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
147 changes: 147 additions & 0 deletions
147
tests/baselines/reference/useBeforeDeclaration_classDecorators.1.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,147 @@ | ||
useBeforeDeclaration_classDecorators.1.ts(7,6): error TS2449: Class 'C2' used before its declaration. | ||
useBeforeDeclaration_classDecorators.1.ts(10,13): error TS2449: Class 'C3' used before its declaration. | ||
useBeforeDeclaration_classDecorators.1.ts(29,10): error TS2449: Class 'C5' used before its declaration. | ||
useBeforeDeclaration_classDecorators.1.ts(30,10): error TS2449: Class 'C5' used before its declaration. | ||
useBeforeDeclaration_classDecorators.1.ts(31,10): error TS2449: Class 'C5' used before its declaration. | ||
useBeforeDeclaration_classDecorators.1.ts(32,10): error TS2449: Class 'C5' used before its declaration. | ||
useBeforeDeclaration_classDecorators.1.ts(33,10): error TS2449: Class 'C5' used before its declaration. | ||
useBeforeDeclaration_classDecorators.1.ts(35,10): error TS2449: Class 'C5' used before its declaration. | ||
useBeforeDeclaration_classDecorators.1.ts(36,10): error TS2449: Class 'C5' used before its declaration. | ||
useBeforeDeclaration_classDecorators.1.ts(37,10): error TS2449: Class 'C5' used before its declaration. | ||
useBeforeDeclaration_classDecorators.1.ts(38,10): error TS2449: Class 'C5' used before its declaration. | ||
useBeforeDeclaration_classDecorators.1.ts(39,10): error TS2449: Class 'C5' used before its declaration. | ||
useBeforeDeclaration_classDecorators.1.ts(44,17): error TS2449: Class 'C6' used before its declaration. | ||
useBeforeDeclaration_classDecorators.1.ts(45,17): error TS2449: Class 'C6' used before its declaration. | ||
useBeforeDeclaration_classDecorators.1.ts(46,17): error TS2449: Class 'C6' used before its declaration. | ||
useBeforeDeclaration_classDecorators.1.ts(47,17): error TS2449: Class 'C6' used before its declaration. | ||
useBeforeDeclaration_classDecorators.1.ts(48,17): error TS2449: Class 'C6' used before its declaration. | ||
useBeforeDeclaration_classDecorators.1.ts(50,17): error TS2449: Class 'C6' used before its declaration. | ||
useBeforeDeclaration_classDecorators.1.ts(51,17): error TS2449: Class 'C6' used before its declaration. | ||
useBeforeDeclaration_classDecorators.1.ts(52,17): error TS2449: Class 'C6' used before its declaration. | ||
useBeforeDeclaration_classDecorators.1.ts(53,17): error TS2449: Class 'C6' used before its declaration. | ||
useBeforeDeclaration_classDecorators.1.ts(54,17): error TS2449: Class 'C6' used before its declaration. | ||
|
||
|
||
==== useBeforeDeclaration_classDecorators.1.ts (22 errors) ==== | ||
declare const dec: any; | ||
|
||
// ok | ||
@dec(() => C1) class C1 { } | ||
|
||
// error | ||
@dec(C2) class C2 { } | ||
~~ | ||
!!! error TS2449: Class 'C2' used before its declaration. | ||
!!! related TS2728 useBeforeDeclaration_classDecorators.1.ts:7:16: 'C2' is declared here. | ||
|
||
// error | ||
@dec((() => C3)()) class C3 { } | ||
~~ | ||
!!! error TS2449: Class 'C3' used before its declaration. | ||
!!! related TS2728 useBeforeDeclaration_classDecorators.1.ts:10:26: 'C3' is declared here. | ||
|
||
// ok | ||
class C4 { | ||
@dec(() => C4) static method() {} | ||
@dec(() => C4) static get x() { return this.y; } | ||
@dec(() => C4) static set x(v) {} | ||
@dec(() => C4) static y: any; | ||
@dec(() => C4) static accessor z: any; | ||
|
||
@dec(() => C4) method() {} | ||
@dec(() => C4) get x() { return this.y; } | ||
@dec(() => C4) set x(v) {} | ||
@dec(() => C4) y: any; | ||
@dec(() => C4) accessor z: any; | ||
} | ||
|
||
// error | ||
class C5 { | ||
@dec(C5) static method() {} | ||
~~ | ||
!!! error TS2449: Class 'C5' used before its declaration. | ||
!!! related TS2728 useBeforeDeclaration_classDecorators.1.ts:28:7: 'C5' is declared here. | ||
@dec(C5) static get x() { return this.y; } | ||
~~ | ||
!!! error TS2449: Class 'C5' used before its declaration. | ||
!!! related TS2728 useBeforeDeclaration_classDecorators.1.ts:28:7: 'C5' is declared here. | ||
@dec(C5) static set x(v) {} | ||
~~ | ||
!!! error TS2449: Class 'C5' used before its declaration. | ||
!!! related TS2728 useBeforeDeclaration_classDecorators.1.ts:28:7: 'C5' is declared here. | ||
@dec(C5) static y: any; | ||
~~ | ||
!!! error TS2449: Class 'C5' used before its declaration. | ||
!!! related TS2728 useBeforeDeclaration_classDecorators.1.ts:28:7: 'C5' is declared here. | ||
@dec(C5) static accessor z: any; | ||
~~ | ||
!!! error TS2449: Class 'C5' used before its declaration. | ||
!!! related TS2728 useBeforeDeclaration_classDecorators.1.ts:28:7: 'C5' is declared here. | ||
|
||
@dec(C5) method() {} | ||
~~ | ||
!!! error TS2449: Class 'C5' used before its declaration. | ||
!!! related TS2728 useBeforeDeclaration_classDecorators.1.ts:28:7: 'C5' is declared here. | ||
@dec(C5) get x() { return this.y; } | ||
~~ | ||
!!! error TS2449: Class 'C5' used before its declaration. | ||
!!! related TS2728 useBeforeDeclaration_classDecorators.1.ts:28:7: 'C5' is declared here. | ||
@dec(C5) set x(v) {} | ||
~~ | ||
!!! error TS2449: Class 'C5' used before its declaration. | ||
!!! related TS2728 useBeforeDeclaration_classDecorators.1.ts:28:7: 'C5' is declared here. | ||
@dec(C5) y: any; | ||
~~ | ||
!!! error TS2449: Class 'C5' used before its declaration. | ||
!!! related TS2728 useBeforeDeclaration_classDecorators.1.ts:28:7: 'C5' is declared here. | ||
@dec(C5) accessor z: any; | ||
~~ | ||
!!! error TS2449: Class 'C5' used before its declaration. | ||
!!! related TS2728 useBeforeDeclaration_classDecorators.1.ts:28:7: 'C5' is declared here. | ||
} | ||
|
||
// error | ||
class C6 { | ||
@dec((() => C6)()) static method() {} | ||
~~ | ||
!!! error TS2449: Class 'C6' used before its declaration. | ||
!!! related TS2728 useBeforeDeclaration_classDecorators.1.ts:43:7: 'C6' is declared here. | ||
@dec((() => C6)()) static get x() { return this.y; } | ||
~~ | ||
!!! error TS2449: Class 'C6' used before its declaration. | ||
!!! related TS2728 useBeforeDeclaration_classDecorators.1.ts:43:7: 'C6' is declared here. | ||
@dec((() => C6)()) static set x(v) {} | ||
~~ | ||
!!! error TS2449: Class 'C6' used before its declaration. | ||
!!! related TS2728 useBeforeDeclaration_classDecorators.1.ts:43:7: 'C6' is declared here. | ||
@dec((() => C6)()) static y: any; | ||
~~ | ||
!!! error TS2449: Class 'C6' used before its declaration. | ||
!!! related TS2728 useBeforeDeclaration_classDecorators.1.ts:43:7: 'C6' is declared here. | ||
@dec((() => C6)()) static accessor z: any; | ||
~~ | ||
!!! error TS2449: Class 'C6' used before its declaration. | ||
!!! related TS2728 useBeforeDeclaration_classDecorators.1.ts:43:7: 'C6' is declared here. | ||
|
||
@dec((() => C6)()) method() {} | ||
~~ | ||
!!! error TS2449: Class 'C6' used before its declaration. | ||
!!! related TS2728 useBeforeDeclaration_classDecorators.1.ts:43:7: 'C6' is declared here. | ||
@dec((() => C6)()) get x() { return this.y; } | ||
~~ | ||
!!! error TS2449: Class 'C6' used before its declaration. | ||
!!! related TS2728 useBeforeDeclaration_classDecorators.1.ts:43:7: 'C6' is declared here. | ||
@dec((() => C6)()) set x(v) {} | ||
~~ | ||
!!! error TS2449: Class 'C6' used before its declaration. | ||
!!! related TS2728 useBeforeDeclaration_classDecorators.1.ts:43:7: 'C6' is declared here. | ||
@dec((() => C6)()) y: any; | ||
~~ | ||
!!! error TS2449: Class 'C6' used before its declaration. | ||
!!! related TS2728 useBeforeDeclaration_classDecorators.1.ts:43:7: 'C6' is declared here. | ||
@dec((() => C6)()) accessor z: any; | ||
~~ | ||
!!! error TS2449: Class 'C6' used before its declaration. | ||
!!! related TS2728 useBeforeDeclaration_classDecorators.1.ts:43:7: 'C6' is declared here. | ||
} | ||
|
Oops, something went wrong.