Repository navigation
Negated Types: Remove the concept of control-flow made "fresh" negations - #65286
Wesley Wigham (weswigham) wants to merge 26 commits into
Conversation
…t literal handling
Deduplicate fresh negations against their regular counterparts during union collection and intersection insertion. Preserve the first intersection position and ordered-set membership when replacing a fresh member, while leaving standalone fresh negations eligible for widening. Add compiler coverage for explicit exclusions, generic array narrowing, both union operand orders, and fresh-only widening.
…ntial structures, broaden negation reduction applicability
4e31f35 to
bf68b75
Compare
|
TypeScript Bot (@typescript-bot) test this |
|
Hey Wesley Wigham (@weswigham), this PR is in an unmergable state, so is missing a merge commit to run against; please resolve conflicts and try again. |
9952925 to
6e68877
Compare
|
TypeScript Bot (@typescript-bot) test this |
|
Hey Wesley Wigham (@weswigham), the results of running the DT tests are ready. There were interesting changes: Branch only errors:
|
|
Wesley Wigham (@weswigham) Here are the results of running the user tests with tsc comparing Something interesting changed - please have a look. Details
|
|
Wesley Wigham (@weswigham), the perf run you requested failed. You can check the log here. |
|
Wesley Wigham (@weswigham) Here are the results of running the top 400 repos with tsc comparing Something interesting changed - please have a look. Details
|
|
Wesley Wigham (@weswigham) Here are some more interesting changes from running the top 400 repos suite Details
|
|
Wesley Wigham (@weswigham) Here are some more interesting changes from running the top 400 repos suite Details
|
|
Wesley Wigham (@weswigham) Here are some more interesting changes from running the top 400 repos suite Details
|
|
TypeScript Bot (@typescript-bot) pack this |
|
Hey, Wesley Wigham (@weswigham)! I've packed 6e68877 into an installable package. You can install it for testing by referencing it in your {
"devDependencies": {
"typescript": "npm:@typescript-deploys/pr-build@7.1.0-pr.65286.7"
}
}and then running There is also a playground for this build. |
|
TypeScript Bot (@typescript-bot) perf test this |
|
Note form design: put this behind a flag |
|
Wesley Wigham (@weswigham) Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
lspComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
startupComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Experiment done, work will continue in #64375 - this one's going to be merged into the base PR behind a flag; we think the behavior is good, and a lot of the breaks it exposes have the potential to show real mistakes - we just think the change in control flow specificity needs to be opt-in, since existing code will fail to compile, and not always for provably correct reasons (sometimes it's just because you captured a refined control flow type and didn't repeat the refinement at a later assignment). |
This change allows full negated types to be created in control flow, not just "fresh" ones that widen away when a position isn't contextually typed by something implying a need for a negation.
This is going to break any "exact" type matching (eg, DT) on locations where these negations are introduced, but logically shouldn't be too breaky otherwise. The other potential downside is possible performance costs - by unconditionally introducing negations, we're unconditionally growing the number of elements in control-flow produced types, in all branches.