Skip to content

Disable constraint reduction in intersections created by constraint hoisting - #58403

Merged
Anders Hejlsberg (ahejlsberg) merged 4 commits into
mainfrom
fix58370
May 2, 2024
Merged

Disable constraint reduction in intersections created by constraint hoisting#58403
Anders Hejlsberg (ahejlsberg) merged 4 commits into
mainfrom
fix58370

Conversation

@ahejlsberg

Copy link
Copy Markdown
Member

Fixes#58370.

@ahejlsberg

Copy link
Copy Markdown
MemberAuthor

@typescript-bot

TypeScript Bot (typescript-bot) commented May 2, 2024

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
test top400✅ Started✅ Results
user test this✅ Started✅ Results
run dt✅ Started✅ Results
perf test this faster✅ Started👀 Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Anders Hejlsberg (@ahejlsberg), the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-bot

Copy link
Copy Markdown
Contributor

Anders Hejlsberg (@ahejlsberg) Here are the results of running the user tests comparing main and refs/pull/58403/merge:

Everything looks good!

@typescript-bot

Copy link
Copy Markdown
Contributor

Anders Hejlsberg (@ahejlsberg)
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
Compiler-Unions - node (v18.15.0, x64)
Errors3030~~~p=1.000 n=6
Symbols62,15462,154~~~p=1.000 n=6
Types50,27350,273~~~p=1.000 n=6
Memory used192,851k (± 0.75%)192,889k (± 0.73%)~192,216k195,765kp=0.471 n=6
Parse Time1.30s (± 0.63%)1.30s (± 0.90%)~1.28s1.31sp=0.498 n=6
Bind Time0.72s0.72s~~~p=1.000 n=6
Check Time9.55s (± 0.35%)9.55s (± 0.44%)~9.51s9.61sp=1.000 n=6
Emit Time2.63s (± 0.51%)2.63s (± 0.61%)~2.61s2.65sp=1.000 n=6
Total Time14.21s (± 0.29%)14.20s (± 0.42%)~14.13s14.29sp=0.810 n=6
angular-1 - node (v18.15.0, x64)
Errors55~~~p=1.000 n=6
Symbols945,322945,322~~~p=1.000 n=6
Types408,088408,110+22 (+ 0.01%)~~p=0.001 n=6
Memory used1,222,849k (± 0.00%)1,222,845k (± 0.00%)~1,222,799k1,222,953kp=0.575 n=6
Parse Time6.78s (± 0.62%)6.79s (± 0.64%)~6.73s6.84sp=0.936 n=6
Bind Time1.87s (± 0.65%)1.88s (± 0.55%)~1.86s1.89sp=0.675 n=6
Check Time31.35s (± 0.45%)31.23s (± 0.38%)~31.03s31.34sp=0.109 n=6
Emit Time14.59s (± 1.49%)14.75s (± 0.82%)~14.56s14.85sp=0.128 n=6
Total Time54.60s (± 0.34%)54.64s (± 0.36%)~54.39s54.85sp=0.688 n=6
mui-docs - node (v18.15.0, x64)
Errors55~~~p=1.000 n=6
Symbols1,956,8261,956,875+49 (+ 0.00%)~~p=0.001 n=6
Types676,443676,637+194 (+ 0.03%)~~p=0.001 n=6
Memory used1,764,744k (± 0.00%)1,765,669k (± 0.00%)+925k (+ 0.05%)1,765,591k1,765,721kp=0.005 n=6
Parse Time6.69s (± 0.25%)6.68s (± 0.21%)~6.66s6.70sp=0.869 n=6
Bind Time2.31s (± 0.64%)2.32s (± 0.22%)~2.31s2.32sp=0.667 n=6
Check Time56.37s (± 0.43%)56.24s (± 0.11%)~56.18s56.32sp=0.336 n=6
Emit Time0.14s0.14s (± 4.51%)~0.13s0.15sp=1.000 n=6
Total Time65.51s (± 0.37%)65.38s (± 0.08%)~65.31s65.43sp=0.375 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,217,3181,217,388+70 (+ 0.01%)~~p=0.001 n=6
Types258,271259,008+737 (+ 0.29%)~~p=0.001 n=6
Memory used2,327,333k (± 0.02%)2,328,074k (± 0.03%)~2,326,835k2,328,636kp=0.128 n=6
Parse Time4.91s (± 1.02%)4.94s (± 0.93%)~4.87s5.00sp=0.261 n=6
Bind Time1.88s (± 1.36%)1.88s (± 0.80%)~1.85s1.89sp=0.871 n=6
Check Time33.48s (± 0.31%)33.48s (± 0.26%)~33.34s33.58sp=1.000 n=6
Emit Time2.60s (± 0.86%)2.63s (± 1.64%)~2.58s2.71sp=0.126 n=6
Total Time42.89s (± 0.26%)42.96s (± 0.35%)~42.75s43.14sp=0.471 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,217,3181,217,388+70 (+ 0.01%)~~p=0.001 n=6
Types258,271259,008+737 (+ 0.29%)~~p=0.001 n=6
Memory used2,402,804k (± 0.04%)2,402,797k (± 0.02%)~2,402,348k2,403,370kp=0.575 n=6
Parse Time7.73s (± 1.10%)7.71s (± 0.63%)~7.65s7.79sp=1.000 n=6
Bind Time2.47s (± 0.71%)2.46s (± 0.56%)~2.44s2.48sp=0.411 n=6
Check Time49.43s (± 0.20%)49.55s (± 0.57%)~49.32s50.11sp=0.689 n=6
Emit Time3.90s (± 4.27%)3.87s (± 1.34%)~3.79s3.95sp=0.748 n=6
Total Time63.54s (± 0.21%)63.60s (± 0.42%)~63.39s64.10sp=1.000 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols256,297256,310+13 (+ 0.01%)~~p=0.001 n=6
Types103,722104,458+736 (+ 0.71%)~~p=0.001 n=6
Memory used424,323k (± 0.01%)424,921k (± 0.01%)+599k (+ 0.14%)424,877k424,950kp=0.005 n=6
Parse Time3.37s (± 0.63%)3.38s (± 0.99%)~3.34s3.43sp=0.466 n=6
Bind Time1.31s (± 0.64%)1.31s (± 0.31%)~1.30s1.31sp=0.527 n=6
Check Time17.76s (± 0.36%)17.79s (± 0.28%)~17.71s17.83sp=0.422 n=6
Emit Time1.36s (± 1.95%)1.35s (± 2.04%)~1.32s1.39sp=0.516 n=6
Total Time23.79s (± 0.22%)23.82s (± 0.25%)~23.76s23.90sp=0.572 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors3535~~~p=1.000 n=6
Symbols224,824224,826+2 (+ 0.00%)~~p=0.001 n=6
Types93,39094,115+725 (+ 0.78%)~~p=0.001 n=6
Memory used369,308k (± 0.01%)369,998k (± 0.03%)+690k (+ 0.19%)369,842k370,175kp=0.005 n=6
Parse Time2.84s (± 0.87%)2.83s (± 0.80%)~2.79s2.85sp=0.468 n=6
Bind Time1.58s (± 0.53%)1.58s (± 0.48%)~1.57s1.59sp=0.172 n=6
Check Time15.52s (± 0.35%)15.57s (± 0.46%)~15.45s15.64sp=0.172 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time19.95s (± 0.25%)19.98s (± 0.35%)~19.85s20.04sp=0.261 n=6
vscode - node (v18.15.0, x64)
Errors44~~~p=1.000 n=6
Symbols2,801,5962,801,607+11 (+ 0.00%)~~p=0.001 n=6
Types951,622951,635+13 (+ 0.00%)~~p=0.001 n=6
Memory used2,949,564k (± 0.01%)2,949,568k (± 0.00%)~2,949,498k2,949,676kp=0.810 n=6
Parse Time13.51s (± 0.37%)13.48s (± 0.11%)~13.45s13.49sp=0.085 n=6
Bind Time4.12s (± 2.36%)4.13s (± 2.10%)~4.08s4.30sp=0.655 n=6
Check Time72.88s (± 0.33%)72.81s (± 0.27%)~72.49s73.05sp=0.689 n=6
Emit Time23.58s (± 0.99%)23.55s (± 0.55%)~23.36s23.70sp=1.000 n=6
Total Time114.09s (± 0.29%)113.98s (± 0.26%)~113.58s114.26sp=0.575 n=6
webpack - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols265,858265,864+6 (+ 0.00%)~~p=0.001 n=6
Types108,442108,449+7 (+ 0.01%)~~p=0.001 n=6
Memory used410,410k (± 0.01%)410,595k (± 0.02%)+185k (+ 0.04%)410,493k410,685kp=0.005 n=6
Parse Time4.78s (± 0.98%)4.80s (± 0.76%)~4.76s4.85sp=0.334 n=6
Bind Time2.07s (± 0.66%)2.07s (± 1.10%)~2.03s2.10sp=0.802 n=6
Check Time20.99s (± 0.39%)21.05s (± 0.29%)~20.99s21.16sp=0.422 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time27.84s (± 0.34%)27.92s (± 0.12%)~27.87s27.95sp=0.148 n=6
xstate-main - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols524,146524,146~~~p=1.000 n=6
Types178,732178,737+5 (+ 0.00%)~~p=0.001 n=6
Memory used462,190k (± 0.02%)462,219k (± 0.02%)~462,123k462,393kp=0.810 n=6
Parse Time3.89s (± 0.60%)3.89s (± 0.62%)~3.86s3.93sp=0.570 n=6
Bind Time1.47s (± 0.96%)1.47s (± 0.79%)~1.45s1.48sp=0.803 n=6
Check Time22.32s (± 0.70%)22.33s (± 0.55%)~22.16s22.48sp=1.000 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time27.67s (± 0.50%)27.69s (± 0.42%)~27.53s27.85sp=0.873 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

Developer Information:

Download Benchmarks

@typescript-bot

Copy link
Copy Markdown
Contributor

Anders Hejlsberg (@ahejlsberg) Here are the results of running the top 400 repos comparing main and refs/pull/58403/merge:

Everything looks good!

@ahejlsberg

Copy link
Copy Markdown
MemberAuthor

Tests and performance all look good. This is ready to review and merge.

// Also, unlike union types, the order of the constituent types is preserved in order that overload resolution
// for intersections of types with signatures can be deterministic.
function getIntersectionType(types: readonly Type[], aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[], noSupertypeReduction?: boolean): Type {
function getIntersectionType(types: readonly Type[], flags = IntersectionFlags.None, aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[]): Type {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this flag something that should be required, in case we forget to pass it? Happens all the time for the relation intersection state...

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's exceedingly rare to need any of these flags (only one place for each flag in entire code base), so I think it's preferable to leave it optional.

@microsoftMicrosoft (microsoft) locked as resolved and limited conversation to collaborators Oct 16, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: TeamFor Milestone BugPRs that fix a bug with a specific milestone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Constraint in generic type forgotten in assignability check

4 participants

@ahejlsberg@typescript-bot@jakebailey@RyanCavanaugh