-
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.
fix(48031): show circularity error for self referential get accessor …
…annotations (#48050)
- Loading branch information
1 parent
e742625
commit f4d76e5
Showing
10 changed files
with
92 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
10 changes: 10 additions & 0 deletions
10
tests/baselines/reference/circularGetAccessor(noimplicitany=false).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,10 @@ | ||
tests/cases/compiler/circularGetAccessor.ts(2,9): error TS2502: 'foo' is referenced directly or indirectly in its own type annotation. | ||
|
||
|
||
==== tests/cases/compiler/circularGetAccessor.ts (1 errors) ==== | ||
declare class C { | ||
get foo(): typeof this.foo; | ||
~~~ | ||
!!! error TS2502: 'foo' is referenced directly or indirectly in its own type annotation. | ||
} | ||
|
7 changes: 7 additions & 0 deletions
7
tests/baselines/reference/circularGetAccessor(noimplicitany=false).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,7 @@ | ||
//// [circularGetAccessor.ts] | ||
declare class C { | ||
get foo(): typeof this.foo; | ||
} | ||
|
||
|
||
//// [circularGetAccessor.js] |
11 changes: 11 additions & 0 deletions
11
tests/baselines/reference/circularGetAccessor(noimplicitany=false).symbols
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,11 @@ | ||
=== tests/cases/compiler/circularGetAccessor.ts === | ||
declare class C { | ||
>C : Symbol(C, Decl(circularGetAccessor.ts, 0, 0)) | ||
|
||
get foo(): typeof this.foo; | ||
>foo : Symbol(C.foo, Decl(circularGetAccessor.ts, 0, 17)) | ||
>this.foo : Symbol(C.foo, Decl(circularGetAccessor.ts, 0, 17)) | ||
>this : Symbol(C, Decl(circularGetAccessor.ts, 0, 0)) | ||
>foo : Symbol(C.foo, Decl(circularGetAccessor.ts, 0, 17)) | ||
} | ||
|
11 changes: 11 additions & 0 deletions
11
tests/baselines/reference/circularGetAccessor(noimplicitany=false).types
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,11 @@ | ||
=== tests/cases/compiler/circularGetAccessor.ts === | ||
declare class C { | ||
>C : C | ||
|
||
get foo(): typeof this.foo; | ||
>foo : any | ||
>this.foo : any | ||
>this : this | ||
>foo : any | ||
} | ||
|
10 changes: 10 additions & 0 deletions
10
tests/baselines/reference/circularGetAccessor(noimplicitany=true).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,10 @@ | ||
tests/cases/compiler/circularGetAccessor.ts(2,9): error TS2502: 'foo' is referenced directly or indirectly in its own type annotation. | ||
|
||
|
||
==== tests/cases/compiler/circularGetAccessor.ts (1 errors) ==== | ||
declare class C { | ||
get foo(): typeof this.foo; | ||
~~~ | ||
!!! error TS2502: 'foo' is referenced directly or indirectly in its own type annotation. | ||
} | ||
|
7 changes: 7 additions & 0 deletions
7
tests/baselines/reference/circularGetAccessor(noimplicitany=true).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,7 @@ | ||
//// [circularGetAccessor.ts] | ||
declare class C { | ||
get foo(): typeof this.foo; | ||
} | ||
|
||
|
||
//// [circularGetAccessor.js] |
11 changes: 11 additions & 0 deletions
11
tests/baselines/reference/circularGetAccessor(noimplicitany=true).symbols
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,11 @@ | ||
=== tests/cases/compiler/circularGetAccessor.ts === | ||
declare class C { | ||
>C : Symbol(C, Decl(circularGetAccessor.ts, 0, 0)) | ||
|
||
get foo(): typeof this.foo; | ||
>foo : Symbol(C.foo, Decl(circularGetAccessor.ts, 0, 17)) | ||
>this.foo : Symbol(C.foo, Decl(circularGetAccessor.ts, 0, 17)) | ||
>this : Symbol(C, Decl(circularGetAccessor.ts, 0, 0)) | ||
>foo : Symbol(C.foo, Decl(circularGetAccessor.ts, 0, 17)) | ||
} | ||
|
11 changes: 11 additions & 0 deletions
11
tests/baselines/reference/circularGetAccessor(noimplicitany=true).types
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,11 @@ | ||
=== tests/cases/compiler/circularGetAccessor.ts === | ||
declare class C { | ||
>C : C | ||
|
||
get foo(): typeof this.foo; | ||
>foo : any | ||
>this.foo : any | ||
>this : this | ||
>foo : any | ||
} | ||
|
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 @@ | ||
// @noImplicitAny: true, false | ||
|
||
declare class C { | ||
get foo(): typeof this.foo; | ||
} |