Skip to content

Allow references to const enums when provably emitted via preserveConstEnums - #57996

Closed
Jake Bailey (jakebailey) wants to merge 6 commits into
microsoft:mainfrom
jakebailey:const-enum-value
Closed

Allow references to const enums when provably emitted via preserveConstEnums#57996
Jake Bailey (jakebailey) wants to merge 6 commits into
microsoft:mainfrom
jakebailey:const-enum-value

Conversation

@jakebailey

@jakebaileyJake Bailey (jakebailey) commented Mar 29, 2024

Copy link
Copy Markdown
Member

This builds on #57914, allowing references to const enums in value space when we can "prove" that they will actually be emitted due to preserveConstEnums.

Fixes#51530

@jakebailey

Copy link
Copy Markdown
MemberAuthor

Also, maybe this fixes #37774?

@jakebailey

Copy link
Copy Markdown
MemberAuthor

@typescript-bot

TypeScript Bot (typescript-bot) commented Mar 29, 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
pack this✅ Started✅ Results

Comment threadsrc/compiler/checker.ts Outdated
@typescript-bot

TypeScript Bot (typescript-bot) commented Mar 29, 2024

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
"devDependencies": {
"typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/160843/artifacts?artifactName=tgz&fileId=DE8A6B6A55FC275C2C80E9AD8BC0CF251E1483AAE628B14D800392428040634102&fileName=/typescript-5.5.0-insiders.20240329.tgz"
}
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/pr-build@5.5.0-pr-57996-3".;

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), 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

Jake Bailey (@jakebailey) Here are the results of running the user tests comparing main and refs/pull/57996/merge:

Everything looks good!

@typescript-bot

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey)
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
Angular - node (v18.15.0, x64)
Memory used295,676k (± 0.01%)295,674k (± 0.01%)~295,632k295,713kp=1.000 n=6
Parse Time2.66s (± 0.24%)2.67s (± 0.15%)+0.01s (+ 0.31%)2.66s2.67sp=0.033 n=6
Bind Time0.83s (± 0.98%)0.83s (± 0.00%)~0.83s0.83sp=0.405 n=6
Check Time8.24s (± 0.32%)8.24s (± 0.38%)~8.20s8.28sp=0.936 n=6
Emit Time7.05s (± 0.39%)7.04s (± 0.24%)~7.01s7.06sp=0.466 n=6
Total Time18.79s (± 0.21%)18.78s (± 0.21%)~18.71s18.83sp=0.688 n=6
Compiler-Unions - node (v18.15.0, x64)
Memory used193,888k (± 1.03%)193,853k (± 1.03%)~191,982k195,811kp=0.748 n=6
Parse Time1.64s (± 1.52%)1.65s (± 1.42%)~1.62s1.68sp=0.871 n=6
Bind Time0.88s (± 1.33%)0.88s (± 0.93%)~0.87s0.89sp=0.738 n=6
Check Time11.28s (± 0.53%)11.25s (± 0.34%)~11.21s11.30sp=0.260 n=6
Emit Time3.15s (± 0.49%)3.15s (± 0.44%)~3.14s3.17sp=0.557 n=6
Total Time16.95s (± 0.40%)16.92s (± 0.27%)~16.87s16.98sp=0.294 n=6
Monaco - node (v18.15.0, x64)
Memory used347,397k (± 0.01%)347,420k (± 0.00%)~347,410k347,427kp=0.054 n=6
Parse Time3.70s (± 0.89%)3.69s (± 0.77%)~3.65s3.73sp=0.686 n=6
Bind Time1.38s (± 0.40%)1.37s (± 0.75%)~1.36s1.39sp=0.663 n=6
Check Time10.24s (± 0.65%)10.24s (± 0.28%)~10.20s10.28sp=0.630 n=6
Emit Time6.03s (± 0.47%)6.00s (± 0.54%)~5.97s6.06sp=0.172 n=6
Total Time21.34s (± 0.36%)21.30s (± 0.29%)~21.23s21.40sp=0.336 n=6
TFS - node (v18.15.0, x64)
Memory used302,781k (± 0.01%)302,800k (± 0.02%)~302,753k302,879kp=0.688 n=6
Parse Time2.43s (± 0.96%)2.41s (± 1.25%)~2.37s2.45sp=0.293 n=6
Bind Time1.19s (± 0.88%)1.22s (± 1.98%)~1.18s1.25sp=0.053 n=6
Check Time7.52s (± 0.34%)7.52s (± 0.37%)~7.47s7.55sp=0.737 n=6
Emit Time4.25s (± 0.52%)4.27s (± 0.57%)~4.25s4.32sp=0.180 n=6
Total Time15.39s (± 0.17%)15.43s (± 0.23%)~15.40s15.49sp=0.220 n=6
material-ui - node (v18.15.0, x64)
Memory used510,183k (± 0.01%)510,157k (± 0.01%)~510,043k510,273kp=0.521 n=6
Parse Time3.92s (± 0.50%)3.93s (± 0.71%)~3.90s3.98sp=0.934 n=6
Bind Time1.46s (± 1.33%)1.45s (± 0.68%)~1.44s1.46sp=0.508 n=6
Check Time25.42s (± 0.21%)25.45s (± 0.22%)~25.39s25.55sp=0.421 n=6
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)~0.00s0.00sp=1.000 n=6
Total Time30.80s (± 0.22%)30.83s (± 0.22%)~30.74s30.93sp=0.469 n=6
mui-docs - node (v18.15.0, x64)
Memory used1,744,651k (± 0.00%)1,744,680k (± 0.00%)~1,744,644k1,744,753kp=0.173 n=6
Parse Time9.63s (± 0.71%)9.63s (± 0.65%)~9.55s9.72sp=1.000 n=6
Bind Time3.43s (± 1.04%)3.43s (± 1.42%)~3.37s3.48sp=0.935 n=6
Check Time81.77s (± 0.54%)81.57s (± 0.55%)~81.03s82.05sp=0.471 n=6
Emit Time0.19s (± 4.29%)0.19s (± 2.81%)~0.19s0.20sp=0.855 n=6
Total Time95.02s (± 0.52%)94.83s (± 0.46%)~94.26s95.31sp=0.470 n=6
self-build-src - node (v18.15.0, x64)
Memory used2,397,089k (± 0.03%)2,397,332k (± 0.01%)~2,396,858k2,397,682kp=0.575 n=6
Parse Time7.45s (± 0.82%)7.48s (± 0.62%)~7.40s7.52sp=0.689 n=6
Bind Time2.78s (± 0.37%)2.77s (± 1.06%)~2.73s2.81sp=0.808 n=6
Check Time49.31s (± 0.39%)49.39s (± 0.45%)~49.13s49.68sp=0.521 n=6
Emit Time3.98s (± 1.23%)3.90s (± 1.66%)~3.79s3.97sp=0.065 n=6
Total Time63.53s (± 0.41%)63.55s (± 0.43%)~63.23s63.91sp=0.936 n=6
self-compiler - node (v18.15.0, x64)
Memory used416,181k (± 0.01%)416,174k (± 0.01%)~416,137k416,227kp=0.810 n=6
Parse Time3.34s (± 1.02%)3.35s (± 0.99%)~3.31s3.39sp=0.573 n=6
Bind Time1.30s (± 0.63%)1.30s (± 0.58%)~1.29s1.31sp=0.729 n=6
Check Time18.28s (± 0.35%)18.22s (± 0.26%)~18.17s18.28sp=0.199 n=6
Emit Time1.36s (± 1.80%)1.36s (± 1.36%)~1.34s1.39sp=1.000 n=6
Total Time24.27s (± 0.33%)24.23s (± 0.25%)~24.17s24.32sp=0.470 n=6
vscode - node (v18.15.0, x64)
Memory used2,898,560k (± 0.00%)2,898,566k (± 0.00%)~2,898,516k2,898,618kp=1.000 n=6
Parse Time12.96s (± 0.31%)12.96s (± 0.41%)~12.90s13.04sp=0.872 n=6
Bind Time4.13s (± 0.60%)4.14s (± 0.52%)~4.11s4.17sp=0.517 n=6
Check Time72.11s (± 0.55%)71.89s (± 0.42%)~71.38s72.24sp=0.521 n=6
Emit Time19.48s (± 0.79%)19.42s (± 0.31%)~19.34s19.51sp=0.230 n=6
Total Time108.67s (± 0.40%)108.41s (± 0.23%)~107.98s108.65sp=0.471 n=6
webpack - node (v18.15.0, x64)
Memory used408,804k (± 0.02%)408,793k (± 0.01%)~408,748k408,849kp=0.689 n=6
Parse Time3.22s (± 0.64%)3.23s (± 0.30%)~3.22s3.24sp=0.565 n=6
Bind Time1.41s (± 0.45%)1.41s (± 0.98%)~1.38s1.42sp=0.654 n=6
Check Time14.30s (± 0.45%)14.31s (± 0.45%)~14.24s14.42sp=0.810 n=6
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)~0.00s0.00sp=1.000 n=6
Total Time18.93s (± 0.24%)18.95s (± 0.37%)~18.87s19.07sp=0.936 n=6
xstate - node (v18.15.0, x64)
Memory used513,438k (± 0.01%)513,457k (± 0.01%)~513,406k513,548kp=0.810 n=6
Parse Time3.95s (± 0.34%)3.96s (± 0.71%)~3.93s4.01sp=0.572 n=6
Bind Time1.89s (± 1.49%)1.88s (± 0.87%)~1.86s1.90sp=1.000 n=6
Check Time3.42s (± 0.30%)3.43s (± 0.32%)~3.42s3.44sp=0.337 n=6
Emit Time0.08s (± 4.99%)0.09s (± 4.62%)🔻+0.01s (+ 8.16%)0.08s0.09sp=0.034 n=6
Total Time9.35s (± 0.47%)9.37s (± 0.48%)~9.29s9.42sp=0.470 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Angular - node (v18.15.0, x64)
  • Compiler-Unions - node (v18.15.0, x64)
  • Monaco - node (v18.15.0, x64)
  • TFS - node (v18.15.0, x64)
  • material-ui - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate - node (v18.15.0, x64)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

Developer Information:

Download Benchmarks

@typescript-bot

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey) Here are the results of running the top 400 repos comparing main and refs/pull/57996/merge:

Everything looks good!

@jakebailey
Jake Bailey (jakebailey) marked this pull request as ready for review March 29, 2024 19:01
@jakebailey
Jake Bailey (jakebailey) marked this pull request as draft March 29, 2024 19:01
@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 Uncommitted BugPR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow use of const enums in value space when preserveConstEnums=true

3 participants

@jakebailey@typescript-bot@andrewbranch