Infer into recursive mapped type targets - #53647
Conversation
| /** Key is "/path/to/a.ts|/path/to/b.ts". */ | ||
| var amalgamatedDuplicates: Map<string, DuplicateInfoForFiles> | undefined; | ||
| var reverseMappedCache = new Map<string, Type | undefined>(); | ||
| var inInferTypeForHomomorphicMappedType = false; |
There was a problem hiding this comment.
the flag was "global" and thus prevented recursing here just for any type even if source was different or if we'd encounter different targets
| const key = source.id + "," + target.id + "," + constraint.id; | ||
| if (reverseMappedCache.has(key)) { | ||
| return reverseMappedCache.get(key); | ||
| const recursionKey = source.id + "," + (target.target || target).id; |
There was a problem hiding this comment.
(target.target || target).id bit could theoretically be grabbed from getRecursionIdentity if only we'd add a special branch for mapped types there. I've done a preliminary experiment and it seems that the whole test suite would pass with such a change but at the same time... I know what kind of a type I have here and thus I can compute this key directly instead of going through an abstraction so I decided to stick with this.
Wesley Wigham (weswigham)
left a comment
There was a problem hiding this comment.
Assuming perf/extended suites are fine, I like this, iirc there was just a test/project which crashed without some kind of stop like this originally, and the globally flag was simply expedient - definitely not complete.
|
TypeScript Bot (@typescript-bot) test this |
|
Heya Wesley Wigham (@weswigham), I've started to run the extended test suite on this PR at 7e9a77a. You can monitor the build here. |
|
Heya Wesley Wigham (@weswigham), I've started to run the perf test suite on this PR at 7e9a77a. You can monitor the build here. Update: The results are in! |
|
Heya Wesley Wigham (@weswigham), I've started to run the parallelized Definitely Typed test suite on this PR at 7e9a77a. You can monitor the build here. Update: The results are in! |
|
Heya Wesley Wigham (@weswigham), I've started to run the diff-based top-repos suite on this PR at 7e9a77a. You can monitor the build here. Update: The results are in! |
|
Wesley Wigham (@weswigham) Here they are:
CompilerComparison Report - main..53647
System
Hosts
Scenarios
TSServerComparison Report - main..53647
System
Hosts
Scenarios
StartupComparison Report - main..53647
System
Hosts
Scenarios
Developer Information: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hey Wesley Wigham (@weswigham), the results of running the DT tests are ready. |
|
Wesley Wigham (@weswigham) Here are the results of running the top-repos suite comparing Everything looks good! |
…ped-type # Conflicts: # tests/baselines/reference/mappedTypeRecursiveInference.errors.txt
…ped-type # Conflicts: # tests/baselines/reference/mappedTypeRecursiveInference.errors.txt # tests/baselines/reference/mappedTypeRecursiveInference.types
|
TypeScript Bot (@typescript-bot) test this |
|
Heya Jake Bailey (@jakebailey), I've started to run the diff-based top-repos suite on this PR at ef2984b. You can monitor the build here. Update: The results are in! |
|
Heya Jake Bailey (@jakebailey), I've started to run the parallelized Definitely Typed test suite on this PR at ef2984b. You can monitor the build here. Update: The results are in! |
|
Heya Jake Bailey (@jakebailey), I've started to run the perf test suite on this PR at ef2984b. You can monitor the build here. Update: The results are in! |
|
Heya Jake Bailey (@jakebailey), I've started to run the diff-based user code test suite on this PR at ef2984b. You can monitor the build here. Update: The results are in! |
|
Heya Jake Bailey (@jakebailey), I've started to run the extended test suite on this PR at ef2984b. You can monitor the build here. |
|
Heya Jake Bailey (@jakebailey), I've started to run the diff-based top-repos suite (tsserver) on this PR at ef2984b. You can monitor the build here. Update: The results are in! |
|
Heya Jake Bailey (@jakebailey), I've started to run the tarball bundle task on this PR at ef2984b. You can monitor the build here. |
|
Heya Jake Bailey (@jakebailey), I've started to run the diff-based user code test suite (tsserver) on this PR at ef2984b. You can monitor the build here. Update: The results are in! |
|
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 |
|
Jake Bailey (@jakebailey) 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
|
|
Jake Bailey (@jakebailey) Here are the results of running the user test suite comparing Everything looks good! |
|
Jake Bailey (@jakebailey) Here they are:
CompilerComparison Report - main..53647
System
Hosts
Scenarios
TSServerComparison Report - main..53647
System
Hosts
Scenarios
StartupComparison Report - main..53647
System
Hosts
Scenarios
Developer Information: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Jake Bailey (@jakebailey) Here are the results of running the top-repos suite comparing Everything looks good! |
|
Hey Jake Bailey (@jakebailey), the results of running the DT tests are ready. |
|
Jake Bailey (@jakebailey) Here are the results of running the top-repos suite comparing Everything looks good! |
|
Is there anything left here? This is approved and seems to be fine to my eye. |
Yes, merging it 😜 |
|
Just looking back at this, the variable mentioned above is from #38224; presumably, the test case from that PR still exists and is passing and I haven't been able to find a linked project which shows a perf issue being fixed by it, so I guess things seem safe? I'm not the assignee so I didn't want to click the green button, but I'm not sure how pressing / safe this one is. |
|
I definitely won't argue that this is a pressing PR so if you don't feel like merging this, don't feel pressured to do it. I'd consider this one to be on the safer side of things though (especially with Wes' approval) 😉 |
|
Jake Bailey (@jakebailey) My total lack of context on the underlying changes notwithstanding, I'd still like to take the opportunity to express my appreciation of this work and hopes that the PR will be merged so I can also close the associated issue in ArkType !🙏 |
|
I think everyone on the review list is out; I'm gonna click the green button so we can get this tested pre-RC (and it's also a bugfix that does not seem to show any regression in extended testing); if it is a problem I'll "unclick" the green button. |
fixes #53650