Uh oh!
There was an error while loading. Please reload this page.
Divide-and-conquer strategy for intersections of unions - #57871
Conversation
Anders Hejlsberg (ahejlsberg)
commented
Mar 21, 2024
TypeScript Bot (@typescript-bot) test top200 |
TypeScript Bot (typescript-bot)
commented
Mar 21, 2024
Anders Hejlsberg (@ahejlsberg) Here are the results of running the user test suite comparing Everything looks good! |
TypeScript Bot (typescript-bot)
commented
Mar 21, 2024
Anders Hejlsberg (@ahejlsberg) Here they are:tscComparison Report - baseline..pr
System info unknown Hosts
Scenarios
Developer Information: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
TypeScript Bot (typescript-bot)
commented
Mar 21, 2024
Anders Hejlsberg (@ahejlsberg) Here are the results of running the top-repos suite comparing Everything looks good! |
Anders Hejlsberg (ahejlsberg)
commented
Mar 21, 2024
TypeScript Bot (@typescript-bot) run dt |
TypeScript Bot (typescript-bot)
commented
Mar 21, 2024
Hey Anders Hejlsberg (@ahejlsberg), the results of running the DT tests are ready. Branch only errors:Package: amap-js-api-driving Package: amap-js-api-riding Package: amap-js-api-transfer |
TypeScript Bot (typescript-bot)
commented
Mar 21, 2024
Anders Hejlsberg (@ahejlsberg) Here they are:tscComparison Report - baseline..pr
System info unknown Hosts
Scenarios
Developer Information: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Anders Hejlsberg (ahejlsberg)
commented
Mar 21, 2024
TypeScript Bot (typescript-bot)
commented
Mar 21, 2024
Hey Anders Hejlsberg (@ahejlsberg), the results of running the DT tests are ready. |
Anders Hejlsberg (ahejlsberg)
commented
Mar 21, 2024
Tests and performance are unaffected. This is ready for a review. |
Uh oh!
There was an error while loading. Please reload this page.
Jake Bailey (jakebailey)
commented
Mar 21, 2024
TypeScript Bot (@typescript-bot) cherry-pick this to release-5.4 |
TypeScript Bot (typescript-bot)
commented
Mar 21, 2024
Hey, Jake Bailey (@jakebailey)! I was unable to cherry-pick this PR. Check the logs at: https://github.com/microsoft/TypeScript/actions/runs/8380435679 |
Jake Bailey (jakebailey)
commented
Mar 21, 2024
TypeScript Bot (@typescript-bot) cherry-pick this to release-5.4 |
TypeScript Bot (typescript-bot)
commented
Mar 21, 2024
Hey, Jake Bailey (@jakebailey)! I've created #57893 for you. This involved updating baselines; please check the diff. |
KnorpelSenf (KnorpelSenf)
commented
Mar 22, 2024
This is huge, thank you so much! I've been working around this limitation in my library for almost a year now. These changes allow me to do so much more now! 🎉❤️ |
KnorpelSenf (KnorpelSenf)
commented
Mar 31, 2024
Anders Hejlsberg (@ahejlsberg) I would like to see a patch release on top of 5.4 with these changes. Is there anything I can do to help get this out there? |
…e-5.4 (#57893) Co-authored-by: Anders Hejlsberg <andersh@microsoft.com>
Jake Bailey (jakebailey)
commented
Apr 2, 2024
This is backported (see above), and will be in the next patch. |
With this PR we implement a "divide and conquer" strategy for handling large intersections of union types. Specifically, when creating an intersection with four or more constituents, some of which are unions, we divide the constituents into two groups such that
A & B & C & Dis processed as(A & B) & (C & D). Since intersections of unions often produce far smaller unions of intersections than the full cartesian product (due to some intersections becomingnever), this can dramatically reduce the overall work at the cost of generating slightly more types (because of the temporary intersections). For example, the reduced repro from #57863 that barely passes before this PR takes 0.28s to type check. That drops to 0.08s with this PR.Fixes#57863.