Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report error for invalid 'this' type during 'await' #48946

Merged
merged 1 commit into from
May 9, 2022
Merged

Conversation

rbuckton
Copy link
Member

@rbuckton rbuckton commented May 4, 2022

Fixes #47711

@rbuckton rbuckton requested review from sandersn and weswigham May 4, 2022 02:53
@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels May 4, 2022
Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, although I would personally collapse the two error parameters into one since they seem to be mutually exclusive.

@@ -36256,7 +36256,7 @@ namespace ts {
* @param type The type of the promise.
* @remarks The "promised type" of a type is the type of the "value" parameter of the "onfulfilled" callback.
*/
function getPromisedTypeOfPromise(type: Type, errorNode?: Node): Type | undefined {
function getPromisedTypeOfPromise(type: Type, errorNode?: Node, thisTypeForErrorOut?: { value?: Type }): Type | undefined {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should be a union since you don't want to issue the error twice, and the only place thisTypeForErrorOut is added did not previously pass errorNode.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to have to test whether errorNode is a Node and I'd also rather not allocate a nursery object for { errorNode } if I don't have to.

@rbuckton
Copy link
Member Author

rbuckton commented May 5, 2022

@DanielRosenwasser worth taking for 4.7? If so I can merge now.

@rbuckton
Copy link
Member Author

rbuckton commented May 5, 2022

@typescript-bot test this
@typescript-bot user test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 5, 2022

Heya @rbuckton, I've started to run the parallelized community code test suite on this PR at 0b6ad03. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 5, 2022

Heya @rbuckton, I've started to run the extended test suite on this PR at 0b6ad03. You can monitor the build here.

@DanielRosenwasser
Copy link
Member

@typescript-bot user test this inline
@typescript-bot perf test faster

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 5, 2022

Heya @DanielRosenwasser, I've started to run the diff-based community code test suite on this PR at 0b6ad03. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 5, 2022

Heya @DanielRosenwasser, I've started to run the abridged perf test suite on this PR at 0b6ad03. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

@DanielRosenwasser
The results of the perf run you requested are in!

Here they are:

Comparison Report - main..48946

Metric main 48946 Delta Best Worst
Angular - node (v14.15.1, x64)
Memory used 333,432k (± 0.01%) 333,547k (± 0.01%) +115k (+ 0.03%) 333,514k 333,618k
Parse Time 2.02s (± 0.70%) 2.05s (± 0.54%) +0.02s (+ 1.19%) 2.03s 2.07s
Bind Time 0.87s (± 0.77%) 0.87s (± 0.46%) -0.00s (- 0.46%) 0.86s 0.88s
Check Time 5.63s (± 0.37%) 5.64s (± 0.40%) +0.01s (+ 0.12%) 5.59s 5.68s
Emit Time 6.31s (± 0.50%) 6.31s (± 0.70%) -0.00s (- 0.02%) 6.24s 6.42s
Total Time 14.84s (± 0.35%) 14.87s (± 0.38%) +0.03s (+ 0.17%) 14.74s 14.99s
Compiler-Unions - node (v14.15.1, x64)
Memory used 192,034k (± 0.13%) 192,205k (± 0.01%) +171k (+ 0.09%) 192,153k 192,266k
Parse Time 0.86s (± 0.43%) 0.85s (± 0.68%) -0.01s (- 1.05%) 0.84s 0.86s
Bind Time 0.56s (± 0.59%) 0.56s (± 0.65%) -0.00s (- 0.71%) 0.55s 0.56s
Check Time 7.48s (± 0.59%) 7.51s (± 0.30%) +0.03s (+ 0.37%) 7.47s 7.55s
Emit Time 2.53s (± 1.21%) 2.51s (± 1.30%) -0.02s (- 0.75%) 2.45s 2.61s
Total Time 11.43s (± 0.46%) 11.42s (± 0.33%) -0.01s (- 0.06%) 11.32s 11.51s
Monaco - node (v14.15.1, x64)
Memory used 325,505k (± 0.01%) 325,609k (± 0.01%) +104k (+ 0.03%) 325,556k 325,661k
Parse Time 1.57s (± 0.63%) 1.58s (± 0.61%) +0.00s (+ 0.19%) 1.56s 1.60s
Bind Time 0.77s (± 0.47%) 0.78s (± 1.00%) +0.01s (+ 0.65%) 0.76s 0.80s
Check Time 5.56s (± 0.53%) 5.51s (± 0.32%) -0.05s (- 0.94%) 5.47s 5.54s
Emit Time 3.32s (± 0.55%) 3.32s (± 0.94%) -0.00s (- 0.09%) 3.28s 3.43s
Total Time 11.23s (± 0.40%) 11.18s (± 0.32%) -0.04s (- 0.38%) 11.12s 11.27s
TFS - node (v14.15.1, x64)
Memory used 289,078k (± 0.00%) 289,130k (± 0.01%) +52k (+ 0.02%) 289,070k 289,181k
Parse Time 1.37s (± 1.11%) 1.36s (± 1.29%) -0.00s (- 0.22%) 1.34s 1.42s
Bind Time 0.72s (± 0.41%) 0.72s (± 0.97%) -0.00s (- 0.14%) 0.71s 0.74s
Check Time 5.20s (± 0.44%) 5.20s (± 0.54%) +0.00s (+ 0.08%) 5.14s 5.26s
Emit Time 3.54s (± 1.76%) 3.55s (± 2.06%) +0.01s (+ 0.31%) 3.39s 3.65s
Total Time 10.83s (± 0.75%) 10.84s (± 0.66%) +0.01s (+ 0.10%) 10.67s 11.01s
material-ui - node (v14.15.1, x64)
Memory used 447,804k (± 0.00%) 447,540k (± 0.00%) -264k (- 0.06%) 447,495k 447,569k
Parse Time 1.86s (± 0.62%) 1.87s (± 0.53%) +0.01s (+ 0.43%) 1.85s 1.90s
Bind Time 0.70s (± 0.95%) 0.70s (± 0.74%) -0.00s (- 0.14%) 0.69s 0.71s
Check Time 13.04s (± 0.57%) 13.08s (± 1.05%) +0.05s (+ 0.38%) 12.88s 13.51s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 15.60s (± 0.56%) 15.65s (± 0.91%) +0.05s (+ 0.35%) 15.44s 16.09s
xstate - node (v14.15.1, x64)
Memory used 535,910k (± 0.00%) 535,158k (± 0.00%) -752k (- 0.14%) 535,106k 535,188k
Parse Time 2.59s (± 0.52%) 2.58s (± 0.46%) -0.01s (- 0.46%) 2.56s 2.62s
Bind Time 1.14s (± 0.65%) 1.14s (± 1.16%) 0.00s ( 0.00%) 1.12s 1.18s
Check Time 1.51s (± 0.38%) 1.51s (± 0.33%) -0.01s (- 0.46%) 1.50s 1.52s
Emit Time 0.07s (± 0.00%) 0.07s (± 0.00%) 0.00s ( 0.00%) 0.07s 0.07s
Total Time 5.32s (± 0.22%) 5.31s (± 0.30%) -0.01s (- 0.28%) 5.27s 5.35s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-210-generic
Architecturex64
Available Memory16 GB
Available Memory2 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v14.15.1, x64)
Scenarios
  • Angular - node (v14.15.1, x64)
  • Compiler-Unions - node (v14.15.1, x64)
  • Monaco - node (v14.15.1, x64)
  • TFS - node (v14.15.1, x64)
  • material-ui - node (v14.15.1, x64)
  • xstate - node (v14.15.1, x64)
Benchmark Name Iterations
Current 48946 10
Baseline main 10

Developer Information:

Download Benchmark

@typescript-bot
Copy link
Collaborator

@DanielRosenwasser
Great news! no new errors were found between main..refs/pull/48946/merge

@typescript-bot
Copy link
Collaborator

The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master.

@rbuckton rbuckton merged commit e2bd89b into main May 9, 2022
@rbuckton rbuckton deleted the fix47711 branch May 9, 2022 20:58
@rbuckton rbuckton restored the fix47711 branch May 9, 2022 20:58
@jakebailey jakebailey deleted the fix47711 branch November 7, 2022 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

await does not respect this types in .then method
4 participants