- Notifications
You must be signed in to change notification settings - Fork 13.2k
Fix inference of type arguments when source is 'awaited'#37540
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
ahejlsberg commented Mar 24, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Hmm, I'm not sure I follow the rationale here. Just because Can you provide a bit more context on what you're trying to accomplish and why? |
ahejlsberg commented Mar 24, 2020
Is a correct summary that you intend for inference from |
rbuckton commented Mar 24, 2020
At the end of the day, Consider this minimal definition for something promise-like: interfacePromise<T>{then(onfulfilled: (value: awaitedT)=>any): any~~~~~}The type of
In addition, It is possible this proposed heuristic may be too loose. In reality we may only want to perform this inference when the |
rbuckton commented Mar 24, 2020
I believe that would be the case, yes. At least, in cases where the |
ahejlsberg commented Mar 24, 2020
I did a little experiment where I changed inference between references to the same generic type to always proceed structurally if any type parameters have variances marked unreliable (as is the case with |
rbuckton commented Mar 24, 2020
Do we want inference to proceed structurally for all "unreliable" variances or just cases where |
ahejlsberg commented Mar 24, 2020
@rbuckton Just pushed the changes we talked about. We now perform structural type inference for any generic type with a type parameter that occurs in an Only change in baselines is that we flatten inferences from |
rbuckton commented Mar 24, 2020
@typescript-bot perf test |
typescript-bot commented Mar 24, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
typescript-bot commented Mar 24, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
typescript-bot commented Mar 24, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Heya @rbuckton, I've started to run the perf test suite on this PR at 70f92ff. You can monitor the build here. Update: The results are in! |
typescript-bot commented Mar 24, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
typescript-bot commented Mar 24, 2020
The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master. |
typescript-bot commented Mar 24, 2020
@rbuckton Here they are:Comparison Report - master..37540
System
Hosts
Scenarios
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rbuckton commented Mar 25, 2020
This seems to have improved things in vscode: https://github.com/typescript-bot/TypeScript/pull/9/files#diff-0e62d568d28b82cee9e66b2b8fafd290R7, however there seem to be a larger number of errors now in office-ui-fabric (https://github.com/typescript-bot/TypeScript/pull/9/files#diff-976ec9fe54f7b841cd49ec069e0303a9L135), though that may not be related to this change. |
rbuckton commented Mar 25, 2020
Closing this in favor of #37610 for now while we continue to investigate the impact of |
This changes inference behavior when inferring a type argument that is
awaited:Fixes#37526