forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revise accessor resolution logic and error reporting (microsoft#48459)
* Revise accessor resolution logic and error reporting * Accept new baselines * Update isTypeElement * Add tests
- Loading branch information
1 parent
c720ad6
commit df7ed82
Showing
9 changed files
with
330 additions
and
127 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
41 changes: 41 additions & 0 deletions
41
tests/baselines/reference/circularAccessorAnnotations.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,41 @@ | ||
tests/cases/compiler/circularAccessorAnnotations.ts(2,9): error TS2502: 'foo' is referenced directly or indirectly in its own type annotation. | ||
tests/cases/compiler/circularAccessorAnnotations.ts(6,9): error TS2502: 'foo' is referenced directly or indirectly in its own type annotation. | ||
tests/cases/compiler/circularAccessorAnnotations.ts(15,9): error TS2502: 'foo' is referenced directly or indirectly in its own type annotation. | ||
tests/cases/compiler/circularAccessorAnnotations.ts(19,9): error TS2502: 'foo' is referenced directly or indirectly in its own type annotation. | ||
|
||
|
||
==== tests/cases/compiler/circularAccessorAnnotations.ts (4 errors) ==== | ||
declare const c1: { | ||
get foo(): typeof c1.foo; | ||
~~~ | ||
!!! error TS2502: 'foo' is referenced directly or indirectly in its own type annotation. | ||
} | ||
|
||
declare const c2: { | ||
set foo(value: typeof c2.foo); | ||
~~~ | ||
!!! error TS2502: 'foo' is referenced directly or indirectly in its own type annotation. | ||
} | ||
|
||
declare const c3: { | ||
get foo(): string; | ||
set foo(value: typeof c3.foo); | ||
} | ||
|
||
type T1 = { | ||
get foo(): T1["foo"]; | ||
~~~ | ||
!!! error TS2502: 'foo' is referenced directly or indirectly in its own type annotation. | ||
} | ||
|
||
type T2 = { | ||
set foo(value: T2["foo"]); | ||
~~~ | ||
!!! error TS2502: 'foo' is referenced directly or indirectly in its own type annotation. | ||
} | ||
|
||
type T3 = { | ||
get foo(): string; | ||
set foo(value: T3["foo"]); | ||
} | ||
|
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,53 @@ | ||
//// [circularAccessorAnnotations.ts] | ||
declare const c1: { | ||
get foo(): typeof c1.foo; | ||
} | ||
|
||
declare const c2: { | ||
set foo(value: typeof c2.foo); | ||
} | ||
|
||
declare const c3: { | ||
get foo(): string; | ||
set foo(value: typeof c3.foo); | ||
} | ||
|
||
type T1 = { | ||
get foo(): T1["foo"]; | ||
} | ||
|
||
type T2 = { | ||
set foo(value: T2["foo"]); | ||
} | ||
|
||
type T3 = { | ||
get foo(): string; | ||
set foo(value: T3["foo"]); | ||
} | ||
|
||
|
||
//// [circularAccessorAnnotations.js] | ||
"use strict"; | ||
|
||
|
||
//// [circularAccessorAnnotations.d.ts] | ||
declare const c1: { | ||
get foo(): typeof c1.foo; | ||
}; | ||
declare const c2: { | ||
set foo(value: typeof c2.foo); | ||
}; | ||
declare const c3: { | ||
get foo(): string; | ||
set foo(value: typeof c3.foo); | ||
}; | ||
declare type T1 = { | ||
get foo(): T1["foo"]; | ||
}; | ||
declare type T2 = { | ||
set foo(value: T2["foo"]); | ||
}; | ||
declare type T3 = { | ||
get foo(): string; | ||
set foo(value: T3["foo"]); | ||
}; |
Oops, something went wrong.