Ignore self tail calls when collecting the return type of a function - #53995
Conversation
|
TypeScript Bot (@typescript-bot) test this |
|
Heya Ryan Cavanaugh (@RyanCavanaugh), I've started to run the diff-based user code test suite (tsserver) on this PR at b0f4ad7. You can monitor the build here. Update: The results are in! |
|
Heya Ryan Cavanaugh (@RyanCavanaugh), I've started to run the diff-based user code test suite on this PR at b0f4ad7. You can monitor the build here. Update: The results are in! |
|
Heya Ryan Cavanaugh (@RyanCavanaugh), I've started to run the diff-based top-repos suite (tsserver) on this PR at b0f4ad7. You can monitor the build here. Update: The results are in! |
|
Heya Ryan Cavanaugh (@RyanCavanaugh), I've started to run the diff-based top-repos suite on this PR at b0f4ad7. You can monitor the build here. Update: The results are in! |
|
Heya Ryan Cavanaugh (@RyanCavanaugh), I've started to run the extended test suite on this PR at b0f4ad7. You can monitor the build here. |
|
Heya Ryan Cavanaugh (@RyanCavanaugh), I've started to run the tarball bundle task on this PR at b0f4ad7. You can monitor the build here. |
|
Heya Ryan Cavanaugh (@RyanCavanaugh), I've started to run the perf test suite on this PR at b0f4ad7. You can monitor the build here. Update: The results are in! |
|
Heya Ryan Cavanaugh (@RyanCavanaugh), I've started to run the parallelized Definitely Typed test suite on this PR at b0f4ad7. You can monitor the build here. Update: The results are in! |
|
Hey Ryan Cavanaugh (@RyanCavanaugh), I've packed this into an installable tgz. You can install it for testing by referencing it in your and then running |
|
Ryan Cavanaugh (@RyanCavanaugh) Here are the results of running the user test suite comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Something interesting changed - please have a look. Details
|
|
Heya Ryan Cavanaugh (@RyanCavanaugh), I've run the RWC suite on this PR - assuming you're on the TS core team, you can view the resulting diff here. |
|
This looks great! Should be able to remove quite a few unnecessary explicit return signatures 😊 |
|
Ryan Cavanaugh (@RyanCavanaugh) Here are the results of running the user test suite comparing Everything looks good! |
|
Inferring |
Question: What happens here? function foo() {
return bar(); // not mutually recursive
}Nothing in the OP suggests this is only for self-recursive functions, so I want to check. |
|
Just an imprecise title; this is only about self-recursive tail calls to the same function as the one being checked. So this doesn't enable automatic checking of e.g. mutual recursion either |
|
Ryan Cavanaugh (@RyanCavanaugh) Here they are:
CompilerComparison Report - main..53995
System
Hosts
Scenarios
TSServerComparison Report - main..53995
System
Hosts
Scenarios
StartupComparison Report - main..53995
System
Hosts
Scenarios
Developer Information: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Ryan Cavanaugh (@RyanCavanaugh) Here are the results of running the top-repos suite comparing Everything looks good! |
|
Hey Ryan Cavanaugh (@RyanCavanaugh), the results of running the DT tests are ready. |
|
TypeScript Bot (@typescript-bot) pack this |
|
Heya Jake Bailey (@jakebailey), I've started to run the tarball bundle task on this PR at b0f4ad7. You can monitor the build here. |
|
Hey Jake Bailey (@jakebailey), I've packed this into an installable tgz. You can install it for testing by referencing it in your and then running There is also a playground for this build and an npm module you can use via |
|
Ryan Cavanaugh (@RyanCavanaugh) Here are the results of running the top-repos suite comparing Everything looks good! |
|
Ryan Cavanaugh (@RyanCavanaugh) is this PR also can be resolved for generator function? |
Fixes longstanding complaints about simple recursive functions!
When you have a recursive function with a base case and a self-recursive tail call, there's no reason we can't correctly handle it. With this PR:
and
I believe the blocker we had to doing this originally was the lack of a
nevertype, but now we have that, it's straightforward to do this and everything just sort of works out.