Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix35982: allow BigIntLiteral to parse as PropertyName for literal object and indices #58608

Merged
merged 17 commits into from
Jul 20, 2024

Conversation

iisaduan
Copy link
Member

@iisaduan iisaduan commented May 21, 2024

Fixes #35982

This PR allows more valid bigint uses in JS to parse and emit correctly. We will parse (and correctly emit) the following cases, but give the following errors:

{ ({1n: 123}); };
    ~~ 1538: A `bigint` literal may not be used as a property name.

[1,2,3][1n]; 
        ~~ 2538: Type `bigint` cannot be used as an index type.

const arr = [1,2,3];
const { 0n: f } = arr; 
       ~~ 2538: Type `bigint` cannot be used as an index type.

class K {
    4n = 0;
    ~~ 1538: A `bigint` literal may not be used as a property name.
}

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels May 21, 2024
@typescript-bot
Copy link
Collaborator

Looks like you're introducing a change to the public API surface area. If this includes breaking changes, please document them on our wiki's API Breaking Changes page.

Also, please make sure @DanielRosenwasser and @RyanCavanaugh are aware of the changes, just as a heads up.

@iisaduan
Copy link
Member Author

@typescript-bot test it

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 21, 2024

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

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

@typescript-bot
Copy link
Collaborator

Hey @iisaduan, the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-bot
Copy link
Collaborator

@iisaduan Here are the results of running the user tests comparing main and refs/pull/58608/merge:

Everything looks good!

@typescript-bot
Copy link
Collaborator

@iisaduan
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-Unions - node (v18.15.0, x64)
Errors 30 30 ~ ~ ~ p=1.000 n=6
Symbols 62,154 62,154 ~ ~ ~ p=1.000 n=6
Types 50,248 50,248 ~ ~ ~ p=1.000 n=6
Memory used 193,446k (± 0.95%) 192,952k (± 0.75%) ~ 192,172k 195,875k p=0.689 n=6
Parse Time 1.55s (± 2.16%) 1.54s (± 1.40%) ~ 1.51s 1.57s p=0.686 n=6
Bind Time 0.87s (± 1.26%) 0.86s (± 1.41%) ~ 0.85s 0.88s p=0.476 n=6
Check Time 11.35s (± 0.47%) 11.32s (± 0.18%) ~ 11.29s 11.34s p=0.227 n=6
Emit Time 3.14s (± 1.00%) 3.15s (± 0.71%) ~ 3.13s 3.19s p=1.000 n=6
Total Time 16.92s (± 0.30%) 16.88s (± 0.13%) ~ 16.84s 16.90s p=0.062 n=6
angular-1 - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 944,110 944,110 ~ ~ ~ p=1.000 n=6
Types 407,140 407,140 ~ ~ ~ p=1.000 n=6
Memory used 1,222,028k (± 0.00%) 1,222,038k (± 0.00%) ~ 1,222,011k 1,222,077k p=1.000 n=6
Parse Time 8.10s (± 0.45%) 8.13s (± 0.42%) ~ 8.09s 8.19s p=0.145 n=6
Bind Time 2.24s (± 0.63%) 2.25s (± 0.56%) ~ 2.23s 2.26s p=0.249 n=6
Check Time 36.47s (± 0.31%) 36.40s (± 0.31%) ~ 36.25s 36.55s p=0.377 n=6
Emit Time 17.53s (± 0.92%) 17.54s (± 0.59%) ~ 17.39s 17.68s p=0.872 n=6
Total Time 64.35s (± 0.22%) 64.33s (± 0.17%) ~ 64.15s 64.42s p=0.936 n=6
mui-docs - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 1,978,789 1,978,789 ~ ~ ~ p=1.000 n=6
Types 882,017 882,017 ~ ~ ~ p=1.000 n=6
Memory used 1,884,687k (± 0.01%) 1,884,644k (± 0.00%) ~ 1,884,551k 1,884,696k p=0.066 n=6
Parse Time 8.02s (± 0.29%) 8.02s (± 0.35%) ~ 7.97s 8.04s p=0.867 n=6
Bind Time 2.67s (± 5.33%) 2.73s (± 0.73%) ~ 2.69s 2.74s p=0.300 n=6
Check Time 71.01s (± 0.46%) 70.87s (± 0.28%) ~ 70.67s 71.17s p=0.575 n=6
Emit Time 0.17s (± 3.72%) 0.17s (± 2.42%) ~ 0.16s 0.17s p=0.673 n=6
Total Time 81.87s (± 0.52%) 81.79s (± 0.26%) ~ 81.53s 82.13s p=0.936 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,223,198 1,223,681 +483 (+ 0.04%) ~ ~ p=0.001 n=6
Types 260,141 260,452 +311 (+ 0.12%) ~ ~ p=0.001 n=6
Memory used 2,340,437k (± 0.05%) 2,340,209k (± 0.03%) ~ 2,339,523k 2,341,237k p=0.689 n=6
Parse Time 5.00s (± 1.44%) 4.98s (± 1.62%) ~ 4.88s 5.09s p=0.689 n=6
Bind Time 1.90s (± 0.64%) 1.89s (± 0.62%) ~ 1.87s 1.90s p=0.323 n=6
Check Time 33.81s (± 0.39%) 33.75s (± 0.45%) ~ 33.54s 33.96s p=0.630 n=6
Emit Time 2.63s (± 3.81%) 2.70s (± 1.48%) ~ 2.64s 2.76s p=0.521 n=6
Total Time 43.35s (± 0.60%) 43.35s (± 0.49%) ~ 43.06s 43.55s p=1.000 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,223,198 1,223,681 +483 (+ 0.04%) ~ ~ p=0.001 n=6
Types 260,141 260,452 +311 (+ 0.12%) ~ ~ p=0.001 n=6
Memory used 2,415,349k (± 0.03%) 2,416,424k (± 0.03%) +1,075k (+ 0.04%) 2,415,535k 2,417,111k p=0.031 n=6
Parse Time 6.30s (± 1.30%) 6.31s (± 0.65%) ~ 6.26s 6.36s p=0.936 n=6
Bind Time 2.04s (± 0.95%) 2.04s (± 1.19%) ~ 1.99s 2.06s p=1.000 n=6
Check Time 40.16s (± 0.49%) 40.21s (± 0.38%) ~ 39.98s 40.42s p=0.810 n=6
Emit Time 3.22s (± 1.62%) 3.19s (± 2.28%) ~ 3.05s 3.26s p=0.471 n=6
Total Time 51.72s (± 0.51%) 51.76s (± 0.40%) ~ 51.45s 51.98s p=0.689 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 257,714 258,106 +392 (+ 0.15%) ~ ~ p=0.001 n=6
Types 104,904 105,170 +266 (+ 0.25%) ~ ~ p=0.001 n=6
Memory used 426,512k (± 0.02%) 427,412k (± 0.01%) +900k (+ 0.21%) 427,391k 427,454k p=0.005 n=6
Parse Time 4.18s (± 0.61%) 4.18s (± 0.49%) ~ 4.15s 4.21s p=0.454 n=6
Bind Time 1.62s (± 0.72%) 1.62s (± 0.91%) ~ 1.59s 1.63s p=0.666 n=6
Check Time 22.26s (± 0.27%) 22.26s (± 0.37%) ~ 22.11s 22.36s p=0.872 n=6
Emit Time 1.72s (± 1.50%) 1.70s (± 1.21%) ~ 1.67s 1.73s p=0.105 n=6
Total Time 29.79s (± 0.28%) 29.76s (± 0.31%) ~ 29.63s 29.90s p=0.747 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 35 35 ~ ~ ~ p=1.000 n=6
Symbols 224,575 224,575 ~ ~ ~ p=1.000 n=6
Types 93,785 93,785 ~ ~ ~ p=1.000 n=6
Memory used 369,881k (± 0.03%) 369,826k (± 0.02%) ~ 369,765k 369,969k p=0.575 n=6
Parse Time 3.50s (± 0.44%) 3.50s (± 0.53%) ~ 3.47s 3.52s p=0.370 n=6
Bind Time 1.94s (± 1.10%) 1.94s (± 0.83%) ~ 1.91s 1.95s p=0.934 n=6
Check Time 19.31s (± 0.17%) 19.33s (± 0.44%) ~ 19.24s 19.46s p=0.809 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 24.75s (± 0.18%) 24.78s (± 0.33%) ~ 24.65s 24.86s p=0.377 n=6
vscode - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,823,879 2,823,879 ~ ~ ~ p=1.000 n=6
Types 957,876 957,876 ~ ~ ~ p=1.000 n=6
Memory used 2,998,648k (± 0.00%) 2,998,669k (± 0.00%) ~ 2,998,573k 2,998,765k p=0.936 n=6
Parse Time 13.87s (± 0.30%) 13.90s (± 0.23%) ~ 13.86s 13.95s p=0.196 n=6
Bind Time 4.13s (± 0.25%) 4.13s (± 0.34%) ~ 4.11s 4.15s p=0.738 n=6
Check Time 73.48s (± 0.40%) 73.57s (± 0.33%) ~ 73.33s 73.96s p=0.575 n=6
Emit Time 23.42s (± 1.02%) 23.43s (± 1.08%) ~ 23.06s 23.73s p=0.810 n=6
Total Time 114.90s (± 0.43%) 115.02s (± 0.17%) ~ 114.70s 115.25s p=0.936 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 265,866 265,866 ~ ~ ~ p=1.000 n=6
Types 108,401 108,401 ~ ~ ~ p=1.000 n=6
Memory used 410,505k (± 0.01%) 410,540k (± 0.01%) ~ 410,487k 410,602k p=0.173 n=6
Parse Time 3.82s (± 1.07%) 3.84s (± 0.88%) ~ 3.80s 3.89s p=0.518 n=6
Bind Time 1.67s (± 1.03%) 1.68s (± 1.24%) ~ 1.65s 1.70s p=0.744 n=6
Check Time 16.91s (± 0.63%) 16.90s (± 0.40%) ~ 16.79s 16.97s p=0.748 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 22.41s (± 0.46%) 22.42s (± 0.47%) ~ 22.27s 22.55s p=1.000 n=6
xstate-main - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 524,654 524,654 ~ ~ ~ p=1.000 n=6
Types 178,920 178,920 ~ ~ ~ p=1.000 n=6
Memory used 462,683k (± 0.03%) 462,756k (± 0.03%) ~ 462,633k 462,994k p=0.575 n=6
Parse Time 3.90s (± 0.51%) 3.91s (± 0.53%) ~ 3.88s 3.94s p=0.615 n=6
Bind Time 1.45s (± 1.31%) 1.45s (± 1.34%) ~ 1.42s 1.47s p=0.935 n=6
Check Time 22.48s (± 0.87%) 22.63s (± 0.40%) ~ 22.52s 22.76s p=0.149 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 27.83s (± 0.65%) 27.98s (± 0.35%) ~ 27.82s 28.09s p=0.148 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)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@typescript-bot
Copy link
Collaborator

@iisaduan Here are the results of running the top 400 repos comparing main and refs/pull/58608/merge:

Everything looks good!

@iisaduan
Copy link
Member Author

@typescript-bot test it

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 23, 2024

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

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

@iisaduan iisaduan changed the title fix35982: allow BigIntLiteral to parse as PropertyName for literal object fix35982: allow BigIntLiteral to parse as PropertyName for literal object and indices May 23, 2024
@typescript-bot
Copy link
Collaborator

Hey @iisaduan, the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-bot
Copy link
Collaborator

@iisaduan Here are the results of running the user tests comparing main and refs/pull/58608/merge:

Everything looks good!

@typescript-bot
Copy link
Collaborator

@iisaduan
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-Unions - node (v18.15.0, x64)
Errors 30 30 ~ ~ ~ p=1.000 n=6
Symbols 62,154 62,154 ~ ~ ~ p=1.000 n=6
Types 50,248 50,248 ~ ~ ~ p=1.000 n=6
Memory used 192,946k (± 0.73%) 192,908k (± 0.76%) ~ 192,160k 195,894k p=0.936 n=6
Parse Time 1.30s (± 0.63%) 1.29s (± 1.50%) ~ 1.26s 1.31s p=0.157 n=6
Bind Time 0.72s 0.72s ~ ~ ~ p=1.000 n=6
Check Time 9.56s (± 0.56%) 9.54s (± 0.44%) ~ 9.49s 9.59s p=0.469 n=6
Emit Time 2.65s (± 0.52%) 2.64s (± 0.75%) ~ 2.62s 2.67s p=0.247 n=6
Total Time 14.23s (± 0.20%) 14.18s (± 0.41%) ~ 14.09s 14.23s p=0.183 n=6
angular-1 - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 944,110 944,110 ~ ~ ~ p=1.000 n=6
Types 407,140 407,140 ~ ~ ~ p=1.000 n=6
Memory used 1,222,015k (± 0.00%) 1,222,009k (± 0.01%) ~ 1,221,856k 1,222,126k p=0.575 n=6
Parse Time 8.06s (± 0.22%) 8.12s (± 0.78%) ~ 8.05s 8.22s p=0.158 n=6
Bind Time 2.25s (± 0.86%) 2.25s (± 0.61%) ~ 2.23s 2.27s p=0.459 n=6
Check Time 36.45s (± 0.37%) 36.59s (± 0.63%) ~ 36.26s 36.82s p=0.378 n=6
Emit Time 17.53s (± 0.58%) 17.58s (± 0.55%) ~ 17.45s 17.71s p=0.470 n=6
Total Time 64.29s (± 0.24%) 64.54s (± 0.43%) ~ 64.09s 64.78s p=0.128 n=6
mui-docs - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 1,978,570 1,978,570 ~ ~ ~ p=1.000 n=6
Types 882,090 882,090 ~ ~ ~ p=1.000 n=6
Memory used 1,885,387k (± 0.00%) 1,885,367k (± 0.00%) ~ 1,885,341k 1,885,421k p=0.199 n=6
Parse Time 6.76s (± 0.36%) 6.80s (± 0.41%) ~ 6.76s 6.83s p=0.052 n=6
Bind Time 2.29s (± 0.76%) 2.30s (± 0.76%) ~ 2.27s 2.32s p=0.684 n=6
Check Time 60.71s (± 0.32%) 60.74s (± 0.31%) ~ 60.42s 60.96s p=0.688 n=6
Emit Time 0.15s (± 2.75%) 0.15s (± 3.77%) ~ 0.14s 0.15s p=0.282 n=6
Total Time 69.92s (± 0.30%) 69.98s (± 0.26%) ~ 69.71s 70.24s p=0.687 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,225,000 1,225,496 +496 (+ 0.04%) ~ ~ p=0.001 n=6
Types 260,662 260,983 +321 (+ 0.12%) ~ ~ p=0.001 n=6
Memory used 2,341,618k (± 0.03%) 2,343,070k (± 0.04%) +1,453k (+ 0.06%) 2,342,133k 2,344,638k p=0.020 n=6
Parse Time 4.98s (± 0.68%) 4.96s (± 0.96%) ~ 4.90s 5.02s p=0.688 n=6
Bind Time 1.91s (± 0.57%) 1.89s (± 0.27%) -0.02s (- 0.87%) 1.89s 1.90s p=0.023 n=6
Check Time 33.81s (± 0.31%) 33.96s (± 0.43%) ~ 33.71s 34.13s p=0.128 n=6
Emit Time 2.67s (± 2.06%) 2.67s (± 1.75%) ~ 2.62s 2.76s p=0.575 n=6
Total Time 43.38s (± 0.26%) 43.50s (± 0.36%) ~ 43.27s 43.69s p=0.230 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,225,000 1,225,496 +496 (+ 0.04%) ~ ~ p=0.001 n=6
Types 260,662 260,983 +321 (+ 0.12%) ~ ~ p=0.001 n=6
Memory used 2,418,024k (± 0.01%) 2,469,490k (± 3.15%) +51,466k (+ 2.13%) 2,417,832k 2,571,118k p=0.045 n=6
Parse Time 6.21s (± 1.34%) 6.16s (± 0.78%) ~ 6.09s 6.21s p=0.230 n=6
Bind Time 2.05s (± 0.99%) 2.05s (± 1.26%) ~ 2.01s 2.08s p=0.744 n=6
Check Time 40.32s (± 0.21%) 40.32s (± 0.32%) ~ 40.17s 40.50s p=1.000 n=6
Emit Time 3.08s (± 2.07%) 3.16s (± 6.05%) ~ 2.97s 3.50s p=0.575 n=6
Total Time 51.67s (± 0.20%) 51.71s (± 0.27%) ~ 51.55s 51.93s p=0.748 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 257,735 258,129 +394 (+ 0.15%) ~ ~ p=0.001 n=6
Types 104,934 105,209 +275 (+ 0.26%) ~ ~ p=0.001 n=6
Memory used 426,658k (± 0.01%) 427,626k (± 0.02%) +968k (+ 0.23%) 427,516k 427,729k p=0.005 n=6
Parse Time 4.18s (± 0.62%) 4.17s (± 0.80%) ~ 4.12s 4.20s p=0.871 n=6
Bind Time 1.62s (± 1.44%) 1.62s (± 1.72%) ~ 1.58s 1.65s p=0.809 n=6
Check Time 22.26s (± 0.49%) 22.36s (± 0.38%) ~ 22.24s 22.47s p=0.228 n=6
Emit Time 1.69s (± 1.48%) 1.67s (± 0.76%) ~ 1.65s 1.68s p=0.102 n=6
Total Time 29.74s (± 0.38%) 29.81s (± 0.45%) ~ 29.67s 29.98s p=0.521 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 35 35 ~ ~ ~ p=1.000 n=6
Symbols 224,575 224,575 ~ ~ ~ p=1.000 n=6
Types 93,785 93,785 ~ ~ ~ p=1.000 n=6
Memory used 369,936k (± 0.03%) 369,917k (± 0.03%) ~ 369,797k 370,074k p=0.689 n=6
Parse Time 2.83s (± 1.17%) 2.85s (± 0.72%) ~ 2.82s 2.87s p=0.292 n=6
Bind Time 1.59s (± 1.22%) 1.57s (± 0.53%) ~ 1.56s 1.58s p=0.162 n=6
Check Time 15.68s (± 0.35%) 15.61s (± 0.33%) ~ 15.56s 15.70s p=0.078 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 20.10s (± 0.27%) 20.04s (± 0.36%) ~ 19.95s 20.15s p=0.199 n=6
vscode - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,835,595 2,835,595 ~ ~ ~ p=1.000 n=6
Types 961,025 961,025 ~ ~ ~ p=1.000 n=6
Memory used 3,008,099k (± 0.00%) 3,008,021k (± 0.00%) ~ 3,007,932k 3,008,125k p=0.093 n=6
Parse Time 17.02s (± 0.21%) 17.10s (± 0.88%) ~ 16.99s 17.39s p=0.514 n=6
Bind Time 5.06s (± 0.48%) 5.04s (± 0.77%) ~ 5.01s 5.11s p=0.260 n=6
Check Time 90.14s (± 2.17%) 88.98s (± 0.26%) ~ 88.70s 89.30s p=0.471 n=6
Emit Time 27.47s (± 7.39%) 28.59s (± 0.70%) ~ 28.35s 28.85s p=0.748 n=6
Total Time 139.69s (± 0.24%) 139.71s (± 0.24%) ~ 139.37s 140.32s p=1.000 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 266,087 266,087 ~ ~ ~ p=1.000 n=6
Types 108,518 108,518 ~ ~ ~ p=1.000 n=6
Memory used 410,934k (± 0.02%) 410,960k (± 0.01%) ~ 410,866k 411,035k p=0.471 n=6
Parse Time 4.75s (± 0.75%) 4.75s (± 0.41%) ~ 4.72s 4.77s p=0.628 n=6
Bind Time 2.07s (± 0.90%) 2.05s (± 1.29%) ~ 2.00s 2.07s p=0.563 n=6
Check Time 21.01s (± 0.18%) 21.03s (± 0.26%) ~ 20.95s 21.08s p=0.419 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 27.83s (± 0.23%) 27.83s (± 0.23%) ~ 27.74s 27.90s p=1.000 n=6
xstate-main - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 535,745 535,745 ~ ~ ~ p=1.000 n=6
Types 182,753 182,753 ~ ~ ~ p=1.000 n=6
Memory used 470,453k (± 0.02%) 470,445k (± 0.02%) ~ 470,351k 470,611k p=0.936 n=6
Parse Time 3.18s (± 0.69%) 3.16s (± 0.77%) ~ 3.13s 3.20s p=0.062 n=6
Bind Time 1.20s (± 0.86%) 1.20s (± 0.34%) ~ 1.19s 1.20s p=0.924 n=6
Check Time 18.43s (± 0.29%) 18.36s (± 0.37%) ~ 18.29s 18.46s p=0.199 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 22.80s (± 0.33%) 22.72s (± 0.33%) ~ 22.62s 22.80s p=0.128 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)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@typescript-bot
Copy link
Collaborator

@iisaduan Here are the results of running the top 400 repos comparing main and refs/pull/58608/merge:

Everything looks good!

@iisaduan
Copy link
Member Author

@typescript-bot test it

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 13, 2024

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

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

@typescript-bot
Copy link
Collaborator

Hey @iisaduan, the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-bot
Copy link
Collaborator

@iisaduan
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-Unions - node (v18.15.0, x64)
Errors 30 30 ~ ~ ~ p=1.000 n=6
Symbols 62,153 62,153 ~ ~ ~ p=1.000 n=6
Types 50,242 50,242 ~ ~ ~ p=1.000 n=6
Memory used 192,750k (± 0.76%) 193,357k (± 0.94%) ~ 192,136k 195,703k p=0.298 n=6
Parse Time 1.95s (± 0.95%) 1.94s (± 0.60%) ~ 1.92s 1.95s p=0.357 n=6
Bind Time 1.05s (± 0.93%) 1.07s (± 0.76%) +0.01s (+ 1.43%) 1.06s 1.08s p=0.026 n=6
Check Time 13.89s (± 0.29%) 13.87s (± 0.44%) ~ 13.81s 13.97s p=0.571 n=6
Emit Time 4.03s (± 0.53%) 4.00s (± 0.65%) ~ 3.96s 4.03s p=0.102 n=6
Total Time 20.93s (± 0.13%) 20.88s (± 0.34%) ~ 20.82s 20.98s p=0.257 n=6
angular-1 - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 944,114 944,114 ~ ~ ~ p=1.000 n=6
Types 407,050 407,050 ~ ~ ~ p=1.000 n=6
Memory used 1,218,410k (± 0.00%) 1,218,395k (± 0.00%) ~ 1,218,350k 1,218,456k p=0.689 n=6
Parse Time 6.70s (± 0.51%) 6.72s (± 0.46%) ~ 6.69s 6.78s p=0.373 n=6
Bind Time 1.87s (± 0.68%) 1.86s (± 0.74%) ~ 1.85s 1.88s p=0.564 n=6
Check Time 30.73s (± 0.18%) 30.72s (± 0.36%) ~ 30.59s 30.89s p=0.936 n=6
Emit Time 13.55s (± 0.62%) 13.57s (± 0.49%) ~ 13.47s 13.65s p=0.936 n=6
Total Time 52.85s (± 0.19%) 52.88s (± 0.26%) ~ 52.70s 53.10s p=0.748 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,148,730 2,148,730 ~ ~ ~ p=1.000 n=6
Types 929,320 929,320 ~ ~ ~ p=1.000 n=6
Memory used 2,116,402k (± 0.01%) 2,116,449k (± 0.01%) ~ 2,116,230k 2,116,690k p=0.471 n=6
Parse Time 6.58s (± 0.25%) 6.59s (± 0.12%) ~ 6.58s 6.60s p=0.934 n=6
Bind Time 2.33s (± 0.24%) 2.32s (± 0.47%) ~ 2.30s 2.33s p=0.476 n=6
Check Time 70.68s (± 0.12%) 70.66s (± 0.43%) ~ 70.36s 71.06s p=0.810 n=6
Emit Time 0.14s (± 3.77%) 0.14s (± 2.88%) ~ 0.14s 0.15s p=0.114 n=6
Total Time 79.73s (± 0.11%) 79.71s (± 0.39%) ~ 79.40s 80.12s p=0.936 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,225,948 1,226,432 +484 (+ 0.04%) ~ ~ p=0.001 n=6
Types 261,589 261,903 +314 (+ 0.12%) ~ ~ p=0.001 n=6
Memory used 2,338,875k (± 0.01%) 2,340,095k (± 0.03%) +1,221k (+ 0.05%) 2,339,334k 2,340,856k p=0.008 n=6
Parse Time 5.08s (± 0.67%) 5.05s (± 0.85%) ~ 4.98s 5.10s p=0.297 n=6
Bind Time 1.90s (± 0.86%) 1.91s (± 0.39%) ~ 1.90s 1.92s p=0.189 n=6
Check Time 34.15s (± 0.25%) 34.16s (± 0.40%) ~ 34.01s 34.36s p=1.000 n=6
Emit Time 3.24s (± 1.36%) 3.25s (± 1.68%) ~ 3.19s 3.34s p=1.000 n=6
Total Time 44.39s (± 0.20%) 44.38s (± 0.36%) ~ 44.23s 44.64s p=0.810 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,225,948 1,226,432 +484 (+ 0.04%) ~ ~ p=0.001 n=6
Types 261,589 261,903 +314 (+ 0.12%) ~ ~ p=0.001 n=6
Memory used 2,413,293k (± 0.03%) 2,414,369k (± 0.04%) ~ 2,413,444k 2,415,752k p=0.066 n=6
Parse Time 5.20s (± 1.09%) 5.23s (± 0.72%) ~ 5.19s 5.28s p=0.574 n=6
Bind Time 1.70s (± 0.62%) 1.71s (± 1.21%) ~ 1.69s 1.74s p=0.405 n=6
Check Time 34.66s (± 0.29%) 34.65s (± 0.20%) ~ 34.55s 34.73s p=0.936 n=6
Emit Time 3.31s (± 2.10%) 3.30s (± 2.53%) ~ 3.19s 3.40s p=0.809 n=6
Total Time 44.88s (± 0.22%) 44.88s (± 0.19%) ~ 44.79s 45.02s p=0.810 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 258,230 258,623 +393 (+ 0.15%) ~ ~ p=0.001 n=6
Types 104,789 105,058 +269 (+ 0.26%) ~ ~ p=0.001 n=6
Memory used 427,103k (± 0.03%) 428,136k (± 0.04%) +1,033k (+ 0.24%) 427,960k 428,413k p=0.005 n=6
Parse Time 3.32s (± 0.70%) 3.31s (± 1.06%) ~ 3.27s 3.36s p=0.746 n=6
Bind Time 1.32s (± 1.49%) 1.32s (± 0.88%) ~ 1.30s 1.33s p=0.868 n=6
Check Time 17.84s (± 0.26%) 17.93s (± 0.24%) +0.10s (+ 0.54%) 17.86s 17.98s p=0.016 n=6
Emit Time 1.66s (± 0.91%) 1.65s (± 1.40%) ~ 1.62s 1.68s p=0.806 n=6
Total Time 24.13s (± 0.15%) 24.22s (± 0.29%) +0.09s (+ 0.38%) 24.12s 24.29s p=0.037 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 35 35 ~ ~ ~ p=1.000 n=6
Symbols 224,565 224,565 ~ ~ ~ p=1.000 n=6
Types 93,734 93,734 ~ ~ ~ p=1.000 n=6
Memory used 369,466k (± 0.03%) 369,519k (± 0.01%) ~ 369,477k 369,556k p=0.128 n=6
Parse Time 3.43s (± 1.35%) 3.44s (± 0.68%) ~ 3.41s 3.47s p=0.687 n=6
Bind Time 1.93s (± 0.60%) 1.93s (± 0.89%) ~ 1.91s 1.95s p=0.935 n=6
Check Time 19.14s (± 0.46%) 19.16s (± 0.35%) ~ 19.04s 19.23s p=0.572 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 24.51s (± 0.45%) 24.53s (± 0.35%) ~ 24.39s 24.63s p=0.810 n=6
vscode - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,891,160 2,891,160 ~ ~ ~ p=1.000 n=6
Types 978,184 978,184 ~ ~ ~ p=1.000 n=6
Memory used 3,054,909k (± 0.00%) 3,054,954k (± 0.00%) ~ 3,054,858k 3,055,012k p=0.173 n=6
Parse Time 13.70s (± 0.14%) 13.69s (± 0.22%) ~ 13.64s 13.73s p=0.570 n=6
Bind Time 4.18s (± 0.82%) 4.18s (± 0.28%) ~ 4.16s 4.19s p=0.681 n=6
Check Time 74.29s (± 2.08%) 74.73s (± 3.04%) ~ 72.97s 77.73s p=0.810 n=6
Emit Time 23.06s (± 6.80%) 22.50s (± 8.89%) ~ 19.87s 24.13s p=1.000 n=6
Total Time 115.22s (± 0.35%) 115.10s (± 0.31%) ~ 114.56s 115.54s p=0.630 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 267,239 267,239 ~ ~ ~ p=1.000 n=6
Types 108,815 108,815 ~ ~ ~ p=1.000 n=6
Memory used 411,860k (± 0.02%) 411,845k (± 0.03%) ~ 411,702k 411,960k p=1.000 n=6
Parse Time 4.75s (± 0.54%) 4.73s (± 0.55%) ~ 4.69s 4.76s p=0.107 n=6
Bind Time 2.10s (± 0.63%) 2.09s (± 0.49%) ~ 2.07s 2.10s p=0.134 n=6
Check Time 20.76s (± 0.31%) 20.78s (± 0.35%) ~ 20.64s 20.85s p=0.572 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 27.61s (± 0.20%) 27.60s (± 0.19%) ~ 27.51s 27.67s p=0.687 n=6
xstate-main - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 510,479 510,479 ~ ~ ~ p=1.000 n=6
Types 161,600 161,600 ~ ~ ~ p=1.000 n=6
Memory used 448,002k (± 0.05%) 447,988k (± 0.07%) ~ 447,649k 448,501k p=0.810 n=6
Parse Time 3.17s (± 0.62%) 3.17s (± 0.59%) ~ 3.14s 3.19s p=0.870 n=6
Bind Time 1.17s (± 0.35%) 1.17s (± 1.00%) ~ 1.16s 1.19s p=0.242 n=6
Check Time 17.00s (± 0.21%) 17.05s (± 0.42%) ~ 16.97s 17.14s p=0.295 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 21.34s (± 0.25%) 21.39s (± 0.30%) ~ 21.33s 21.48s p=0.291 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)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@typescript-bot
Copy link
Collaborator

@iisaduan Here are the results of running the top 400 repos with tsc comparing main and refs/pull/58608/merge:

Everything looks good!

@iisaduan
Copy link
Member Author

@typescript-bot user test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 13, 2024

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

Command Status Results
user test this ✅ Started ✅ Results

@typescript-bot
Copy link
Collaborator

@iisaduan Here are the results of running the user tests with tsc comparing main and refs/pull/58608/merge:

Everything looks good!

error(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, "" + (indexType as StringLiteralType | NumberLiteralType).value, typeToString(objectType));
}
else if (indexType.flags & (TypeFlags.String | TypeFlags.Number)) {
error(indexNode, Diagnostics.Type_0_has_no_matching_index_signature_for_type_1, typeToString(objectType), typeToString(indexType));
}
else {
error(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
const typeString = typeToString(indexNode.kind === SyntaxKind.BigIntLiteral ? getBaseTypeOfLiteralType(getContextFreeTypeOfExpression(indexNode)) : indexType);
Copy link
Member

Choose a reason for hiding this comment

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

Does this just end up producing bigint or do we expect something else to show up here? If something other than bigint can appear, we should add tests as the tests only show bigint. If this can only ever produce bigint, then I would just use the literal string.

Also, unless anyone else has a particular preference, I think Type '1n' cannot be used as an index type is also acceptable, so leaving this as typeToString(indexType) might be fine.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not really sure how the latest push resolved this; "bigInt" isn't a thing in TS or JS and I think Ron was suggesting to actually write the value? (See also my comment on the earlier thread with suggested code)

Copy link
Member

Choose a reason for hiding this comment

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

We should either write the value, or bigint (all lowercase) as it's the underlying base type.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, I've been looking at the tests, and some of the test cases have been inconsistent with the caps. I'll fix that.

Would you prefer the "property does not exist on type" error? I was using the "bigint literal type cannot be used as an index" error because the original design choice was the bigintliteral type cannot be used as an index, as you should use a string or number instead. "cannot be used as index" seemed more descriptive of what was happening than "property does not exist".

I don't mind using the value in the error message (1n cannot be used as an index type) if you like that better, and it is what you would get with typeToString(indexType). I changed it because bigint made the above more clear as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I guess if you just swap it back to bigint, that should be sufficient. I see what you mean about the inconsistency; it's not that say 1n doesn't exist on the type, but that bigint isn't supported at all?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it's valid syntactically in js to index with bigints, but we've disallowed them when type checking

src/compiler/types.ts Show resolved Hide resolved
@DanielRosenwasser DanielRosenwasser added Breaking Change Would introduce errors in existing code API Relates to the public API for TypeScript labels Jul 19, 2024
Copy link
Member

@DanielRosenwasser DanielRosenwasser left a comment

Choose a reason for hiding this comment

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

There are a few things that I didn't catch before that I want addressed, but I'm going to mark this as approved so you're not blocked on merging.

src/compiler/checker.ts Show resolved Hide resolved
src/compiler/diagnosticMessages.json Outdated Show resolved Hide resolved
@iisaduan iisaduan merged commit dfb8701 into microsoft:main Jul 20, 2024
32 checks passed
@iisaduan iisaduan deleted the parse-bigint-index branch July 20, 2024 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Relates to the public API for TypeScript Author: Team Breaking Change Would introduce errors in existing code For Milestone Bug PRs that fix a bug with a specific milestone
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

LiteralPropertyName should allow BigInt
5 participants