-
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.
Cache started nonexistent property error checks to prevent reentrancy…
… in the check (#60683)
- Loading branch information
Showing
7 changed files
with
111 additions
and
0 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
16 changes: 16 additions & 0 deletions
16
tests/baselines/reference/checkingObjectWithThisInNamePositionNoCrash.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,16 @@ | ||
checkingObjectWithThisInNamePositionNoCrash.ts(2,5): error TS7023: 'doit' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. | ||
checkingObjectWithThisInNamePositionNoCrash.ts(4,19): error TS2339: Property 'a' does not exist on type '{ doit(): { [x: number]: string; }; }'. | ||
|
||
|
||
==== checkingObjectWithThisInNamePositionNoCrash.ts (2 errors) ==== | ||
export const thing = { | ||
doit() { | ||
~~~~ | ||
!!! error TS7023: 'doit' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. | ||
return { | ||
[this.a]: "", // should refer to the outer object with the doit method, notably not present | ||
~ | ||
!!! error TS2339: Property 'a' does not exist on type '{ doit(): { [x: number]: string; }; }'. | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
tests/baselines/reference/checkingObjectWithThisInNamePositionNoCrash.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,31 @@ | ||
//// [tests/cases/compiler/checkingObjectWithThisInNamePositionNoCrash.ts] //// | ||
|
||
//// [checkingObjectWithThisInNamePositionNoCrash.ts] | ||
export const thing = { | ||
doit() { | ||
return { | ||
[this.a]: "", // should refer to the outer object with the doit method, notably not present | ||
} | ||
} | ||
} | ||
|
||
//// [checkingObjectWithThisInNamePositionNoCrash.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.thing = void 0; | ||
exports.thing = { | ||
doit: function () { | ||
var _a; | ||
return _a = {}, | ||
_a[this.a] = "", | ||
_a; | ||
} | ||
}; | ||
|
||
|
||
//// [checkingObjectWithThisInNamePositionNoCrash.d.ts] | ||
export declare const thing: { | ||
doit(): { | ||
[x: number]: string; | ||
}; | ||
}; |
16 changes: 16 additions & 0 deletions
16
tests/baselines/reference/checkingObjectWithThisInNamePositionNoCrash.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,16 @@ | ||
//// [tests/cases/compiler/checkingObjectWithThisInNamePositionNoCrash.ts] //// | ||
|
||
=== checkingObjectWithThisInNamePositionNoCrash.ts === | ||
export const thing = { | ||
>thing : Symbol(thing, Decl(checkingObjectWithThisInNamePositionNoCrash.ts, 0, 12)) | ||
|
||
doit() { | ||
>doit : Symbol(doit, Decl(checkingObjectWithThisInNamePositionNoCrash.ts, 0, 22)) | ||
|
||
return { | ||
[this.a]: "", // should refer to the outer object with the doit method, notably not present | ||
>[this.a] : Symbol([this.a], Decl(checkingObjectWithThisInNamePositionNoCrash.ts, 2, 16)) | ||
>this : Symbol(thing, Decl(checkingObjectWithThisInNamePositionNoCrash.ts, 0, 20)) | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
tests/baselines/reference/checkingObjectWithThisInNamePositionNoCrash.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,31 @@ | ||
//// [tests/cases/compiler/checkingObjectWithThisInNamePositionNoCrash.ts] //// | ||
|
||
=== checkingObjectWithThisInNamePositionNoCrash.ts === | ||
export const thing = { | ||
>thing : { doit(): { [x: number]: string; }; } | ||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
>{ doit() { return { [this.a]: "", // should refer to the outer object with the doit method, notably not present } }} : { doit(): { [x: number]: string; }; } | ||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
doit() { | ||
>doit : () => { [x: number]: string; } | ||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
return { | ||
>{ [this.a]: "", // should refer to the outer object with the doit method, notably not present } : { [x: number]: string; } | ||
> : ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
[this.a]: "", // should refer to the outer object with the doit method, notably not present | ||
>[this.a] : string | ||
> : ^^^^^^ | ||
>this.a : any | ||
> : ^^^ | ||
>this : { doit(): { [x: number]: string; }; } | ||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
>a : any | ||
> : ^^^ | ||
>"" : "" | ||
> : ^^ | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
tests/cases/compiler/checkingObjectWithThisInNamePositionNoCrash.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,9 @@ | ||
// @strict: true | ||
// @declaration: true | ||
export const thing = { | ||
doit() { | ||
return { | ||
[this.a]: "", // should refer to the outer object with the doit method, notably not present | ||
} | ||
} | ||
} |