Skip to content

Conversation

@kring
Copy link

@kring kring commented Jul 9, 2023

Fixes #54879

Please don't be alarmed by the large number of changed files here. The code change is only to the addPropertyToElementList function in checker.ts. The rest of the changes update the baseline and fourslash files for the large number of cases where the compiler was previously incorrectly (AFAICT) emitting regular properties where it should have emitted get or set accessors.

I've looked at all the baseline changes in detail and I believe them to now be more correct. I hope you will agree!

As I undersand it, prior to TS 3.7 this difference between properties and accessors was mostly moot. But more recently it has become quite important (TS2611 errors), and so this PR makes the compiler emit the accessors in a significant set of cases where it should.

One possibly important thing I noticed while reviewing the baseline changes... tests/cases/compiler/divergentAccessorsTypes6.ts has some code that looks like this:

const o2 = {
    // ...
    get p2(): number { return 0; },
    set p2(value: string) {},
};

Before this PR, the type of o2 was:

o2 : { p2: number; }

Now it is:

o2 : { get p2(): number; set p2(value: number); }

The original (before this PR) was wrong. It didn't capture the divergent accessor. The version in this PR is wrong, too, in much the same way. But because the accessors are separate now, maybe it's a little more problematic for the setter's type be wrong. Let me know if you think this needs to be fixed as part of this PR.

@typescript-bot typescript-bot added the For Milestone Bug PRs that fix a bug with a specific milestone label Jul 9, 2023
@jakebailey
Copy link
Member

@typescript-bot test this
@typescript-bot test top100
@typescript-bot user test this
@typescript-bot run dt
@typescript-bot perf test this
@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 9, 2023

Heya @jakebailey, I've started to run the parallelized Definitely Typed test suite on this PR at faf9843. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 9, 2023

Heya @jakebailey, I've started to run the perf test suite on this PR at faf9843. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 9, 2023

Heya @jakebailey, I've started to run the diff-based top-repos suite on this PR at faf9843. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 9, 2023

Heya @jakebailey, I've started to run the extended test suite on this PR at faf9843. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 9, 2023

Heya @jakebailey, I've started to run the tarball bundle task on this PR at faf9843. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 9, 2023

Heya @jakebailey, I've started to run the diff-based user code test suite on this PR at faf9843. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 9, 2023

Hey @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/155831/artifacts?artifactName=tgz&fileId=AAAE80ED9A1C752EF39808F7899F2B7E2322BFCA09CC0DFE65C15EADC9CB0AB902&fileName=/typescript-5.2.0-insiders.20230709.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.2.0-pr-54935-7".;

@typescript-bot
Copy link
Collaborator

@jakebailey Here are the results of running the user test suite comparing main and refs/pull/54935/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Unknown failure"
  • 1 instance of "Package install failed"

Otherwise...

Something interesting changed - please have a look.

Details

rxjs-src

/mnt/ts_downloads/rxjs-src/build.sh

  • [NEW] error TS2428: All declarations of 'WeakMap' must have identical type parameters.
    • /home/vsts/work/1/s/typescript-54935/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-54935/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-54935/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-54935/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-54935/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-54935/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-54935/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-54935/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-54935/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-54935/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-54935/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-54935/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-54935/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-54935/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-54935/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
  • [MISSING] error TS2428: All declarations of 'WeakMap' must have identical type parameters.
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
    • /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)

@typescript-bot
Copy link
Collaborator

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

Here they are:

Compiler

Comparison Report - main..54935
Metric main 54935 Delta Best Worst p-value
Angular - node (v18.10.0, x64)
Memory used 366,855k (± 0.01%) 366,856k (± 0.01%) ~ 366,824k 366,911k p=1.000 n=6
Parse Time 3.40s (± 0.57%) 3.42s (± 0.71%) ~ 3.38s 3.45s p=0.257 n=6
Bind Time 1.12s (± 1.13%) 1.12s (± 0.36%) ~ 1.11s 1.12s p=0.930 n=6
Check Time 8.88s (± 0.30%) 8.89s (± 0.41%) ~ 8.84s 8.94s p=0.570 n=6
Emit Time 7.56s (± 0.85%) 7.52s (± 0.94%) ~ 7.43s 7.60s p=0.377 n=6
Total Time 20.96s (± 0.42%) 20.95s (± 0.53%) ~ 20.80s 21.07s p=0.872 n=6
Compiler-Unions - node (v18.10.0, x64)
Memory used 192,114k (± 1.19%) 193,026k (± 1.50%) ~ 191,038k 196,779k p=0.872 n=6
Parse Time 1.50s (± 0.70%) 1.51s (± 0.77%) ~ 1.50s 1.53s p=0.406 n=6
Bind Time 0.78s (± 0.97%) 0.78s (± 0.71%) ~ 0.77s 0.78s p=0.476 n=6
Check Time 9.54s (± 0.69%) 9.53s (± 0.87%) ~ 9.42s 9.65s p=0.810 n=6
Emit Time 2.74s (± 1.02%) 2.76s (± 0.87%) ~ 2.72s 2.78s p=0.197 n=6
Total Time 14.56s (± 0.61%) 14.57s (± 0.64%) ~ 14.47s 14.71s p=0.936 n=6
Monaco - node (v18.10.0, x64)
Memory used 346,845k (± 0.00%) 346,875k (± 0.01%) ~ 346,836k 346,949k p=0.128 n=6
Parse Time 2.61s (± 1.31%) 2.60s (± 0.66%) ~ 2.57s 2.62s p=0.517 n=6
Bind Time 1.01s (± 0.63%) 1.01s (± 0.97%) ~ 1.00s 1.02s p=0.733 n=6
Check Time 7.29s (± 0.31%) 7.27s (± 0.44%) ~ 7.24s 7.31s p=0.375 n=6
Emit Time 4.25s (± 0.55%) 4.25s (± 1.20%) ~ 4.21s 4.32s p=0.809 n=6
Total Time 15.15s (± 0.30%) 15.14s (± 0.52%) ~ 15.02s 15.24s p=0.748 n=6
TFS - node (v18.10.0, x64)
Memory used 300,909k (± 0.01%) 300,911k (± 0.01%) ~ 300,879k 300,939k p=0.810 n=6
Parse Time 2.08s (± 0.88%) 2.09s (± 1.45%) ~ 2.03s 2.11s p=0.251 n=6
Bind Time 1.13s (± 0.49%) 1.13s (± 1.33%) ~ 1.12s 1.16s p=0.342 n=6
Check Time 6.63s (± 0.54%) 6.67s (± 0.74%) ~ 6.61s 6.75s p=0.107 n=6
Emit Time 3.85s (± 0.30%) 3.86s (± 1.18%) ~ 3.80s 3.92s p=0.808 n=6
Total Time 13.69s (± 0.21%) 13.76s (± 0.96%) ~ 13.55s 13.94s p=0.149 n=6
material-ui - node (v18.10.0, x64)
Memory used 482,402k (± 0.01%) 482,441k (± 0.02%) ~ 482,354k 482,566k p=0.423 n=6
Parse Time 3.07s (± 2.76%) 3.10s (± 2.59%) ~ 2.94s 3.15s p=0.570 n=6
Bind Time 0.95s (± 6.06%) 0.94s (± 4.53%) ~ 0.92s 1.03s p=0.459 n=6
Check Time 17.34s (± 0.36%) 17.39s (± 0.77%) ~ 17.20s 17.53s p=0.471 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 21.37s (± 0.35%) 21.43s (± 0.68%) ~ 21.23s 21.58s p=0.575 n=6
xstate - node (v18.10.0, x64)
Memory used 563,718k (± 0.02%) 563,655k (± 0.02%) ~ 563,554k 563,771k p=0.230 n=6
Parse Time 3.83s (± 0.65%) 3.88s (± 0.60%) +0.05s (+ 1.22%) 3.86s 3.92s p=0.013 n=6
Bind Time 1.65s (± 0.91%) 1.66s (± 1.10%) ~ 1.64s 1.69s p=0.288 n=6
Check Time 2.80s (± 0.32%) 2.82s (± 1.30%) ~ 2.75s 2.86s p=0.089 n=6
Emit Time 0.08s (± 0.00%) 0.08s (± 0.00%) ~ 0.08s 0.08s p=1.000 n=6
Total Time 8.36s (± 0.47%) 8.44s (± 0.68%) +0.07s (+ 0.88%) 8.34s 8.50s p=0.045 n=6
Angular - node (v16.17.1, x64)
Memory used 366,240k (± 0.01%) 366,253k (± 0.01%) ~ 366,202k 366,324k p=0.689 n=6
Parse Time 3.57s (± 0.46%) 3.58s (± 0.84%) ~ 3.53s 3.62s p=0.415 n=6
Bind Time 1.19s (± 0.43%) 1.19s (± 0.43%) ~ 1.19s 1.20s p=0.069 n=6
Check Time 9.66s (± 0.54%) 9.67s (± 0.51%) ~ 9.62s 9.76s p=0.574 n=6
Emit Time 8.01s (± 0.63%) 8.04s (± 0.78%) ~ 7.96s 8.13s p=0.471 n=6
Total Time 22.42s (± 0.32%) 22.48s (± 0.45%) ~ 22.35s 22.61s p=0.471 n=6
Compiler-Unions - node (v16.17.1, x64)
Memory used 192,900k (± 0.03%) 193,470k (± 0.72%) ~ 192,861k 196,307k p=0.575 n=6
Parse Time 1.59s (± 0.86%) 1.59s (± 1.17%) ~ 1.56s 1.61s p=0.868 n=6
Bind Time 0.83s (± 1.01%) 0.82s (± 0.99%) ~ 0.81s 0.83s p=0.718 n=6
Check Time 10.19s (± 0.90%) 10.17s (± 0.66%) ~ 10.08s 10.26s p=0.748 n=6
Emit Time 3.02s (± 1.27%) 3.00s (± 0.50%) ~ 2.98s 3.02s p=0.257 n=6
Total Time 15.63s (± 0.67%) 15.58s (± 0.49%) ~ 15.44s 15.66s p=0.520 n=6
Monaco - node (v16.17.1, x64)
Memory used 346,186k (± 0.01%) 346,184k (± 0.00%) ~ 346,169k 346,208k p=0.748 n=6
Parse Time 2.78s (± 0.45%) 2.77s (± 0.42%) ~ 2.75s 2.78s p=0.122 n=6
Bind Time 1.08s (± 0.48%) 1.08s (± 0.51%) ~ 1.07s 1.08s p=0.640 n=6
Check Time 7.97s (± 0.32%) 8.00s (± 0.39%) ~ 7.96s 8.04s p=0.169 n=6
Emit Time 4.46s (± 0.51%) 4.47s (± 0.33%) ~ 4.45s 4.49s p=0.935 n=6
Total Time 16.28s (± 0.35%) 16.31s (± 0.20%) ~ 16.28s 16.37s p=0.798 n=6
TFS - node (v16.17.1, x64)
Memory used 300,239k (± 0.01%) 300,224k (± 0.01%) ~ 300,186k 300,242k p=0.419 n=6
Parse Time 2.20s (± 0.67%) 2.21s (± 1.16%) ~ 2.18s 2.25s p=0.416 n=6
Bind Time 1.21s (± 1.12%) 1.22s (± 1.87%) ~ 1.20s 1.26s p=0.871 n=6
Check Time 7.32s (± 0.48%) 7.35s (± 1.35%) ~ 7.28s 7.54s p=1.000 n=6
Emit Time 4.33s (± 0.50%) 4.35s (± 0.79%) ~ 4.31s 4.39s p=0.293 n=6
Total Time 15.06s (± 0.30%) 15.13s (± 0.95%) ~ 15.01s 15.40s p=0.687 n=6
material-ui - node (v16.17.1, x64)
Memory used 481,657k (± 0.01%) 481,692k (± 0.01%) ~ 481,605k 481,734k p=0.173 n=6
Parse Time 3.25s (± 0.46%) 3.28s (± 0.59%) +0.03s (+ 0.77%) 3.26s 3.31s p=0.035 n=6
Bind Time 0.96s (± 0.78%) 0.96s (± 0.66%) ~ 0.95s 0.97s p=0.718 n=6
Check Time 18.27s (± 0.37%) 18.31s (± 0.65%) ~ 18.17s 18.47s p=0.628 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 22.48s (± 0.37%) 22.54s (± 0.54%) ~ 22.39s 22.72s p=0.336 n=6
xstate - node (v16.17.1, x64)
Memory used 561,284k (± 0.01%) 561,287k (± 0.02%) ~ 561,097k 561,433k p=0.936 n=6
Parse Time 4.01s (± 0.29%) 4.03s (± 0.46%) ~ 4.01s 4.06s p=0.084 n=6
Bind Time 1.76s (± 4.54%) 1.79s (± 0.96%) ~ 1.77s 1.81s p=0.371 n=6
Check Time 3.09s (± 2.91%) 3.08s (± 0.17%) ~ 3.07s 3.08s p=0.060 n=6
Emit Time 0.09s (± 0.00%) 0.09s (± 4.45%) ~ 0.09s 0.10s p=0.405 n=6
Total Time 8.94s (± 0.31%) 8.99s (± 0.29%) +0.05s (+ 0.54%) 8.96s 9.03s p=0.019 n=6
Angular - node (v14.21.3, x64)
Memory used 360,172k (± 0.01%) 360,178k (± 0.01%) ~ 360,103k 360,256k p=0.688 n=6
Parse Time 3.73s (± 0.55%) 3.73s (± 0.82%) ~ 3.69s 3.78s p=0.683 n=6
Bind Time 1.22s (± 0.62%) 1.21s (± 0.67%) ~ 1.20s 1.22s p=0.383 n=6
Check Time 10.09s (± 0.60%) 10.12s (± 0.69%) ~ 10.03s 10.20s p=0.520 n=6
Emit Time 8.32s (± 0.54%) 8.33s (± 0.43%) ~ 8.30s 8.39s p=0.870 n=6
Total Time 23.36s (± 0.38%) 23.40s (± 0.45%) ~ 23.25s 23.53s p=0.630 n=6
Compiler-Unions - node (v14.21.3, x64)
Memory used 188,134k (± 0.07%) 188,195k (± 0.01%) ~ 188,173k 188,228k p=0.689 n=6
Parse Time 1.60s (± 0.52%) 1.61s (± 0.65%) ~ 1.59s 1.62s p=1.000 n=6
Bind Time 0.84s (± 0.61%) 0.85s (± 0.61%) ~ 0.84s 0.85s p=0.311 n=6
Check Time 10.28s (± 0.36%) 10.25s (± 0.42%) ~ 10.18s 10.30s p=0.295 n=6
Emit Time 3.17s (± 4.09%) 3.15s (± 0.82%) ~ 3.12s 3.18s p=0.252 n=6
Total Time 15.90s (± 0.91%) 15.85s (± 0.26%) ~ 15.77s 15.88s p=0.936 n=6
Monaco - node (v14.21.3, x64)
Memory used 341,172k (± 0.01%) 341,190k (± 0.01%) ~ 341,157k 341,233k p=0.199 n=6
Parse Time 2.81s (± 0.49%) 2.81s (± 0.66%) ~ 2.78s 2.83s p=0.618 n=6
Bind Time 1.10s (± 0.37%) 1.10s (± 1.41%) ~ 1.09s 1.13s p=0.584 n=6
Check Time 8.24s (± 0.87%) 8.30s (± 0.48%) ~ 8.24s 8.35s p=0.171 n=6
Emit Time 4.67s (± 0.58%) 4.66s (± 0.66%) ~ 4.63s 4.71s p=0.226 n=6
Total Time 16.83s (± 0.44%) 16.86s (± 0.26%) ~ 16.80s 16.92s p=0.377 n=6
TFS - node (v14.21.3, x64)
Memory used 295,330k (± 0.00%) 295,325k (± 0.00%) ~ 295,316k 295,344k p=0.630 n=6
Parse Time 2.43s (± 0.95%) 2.42s (± 0.89%) ~ 2.40s 2.45s p=0.684 n=6
Bind Time 1.08s (± 0.91%) 1.08s (± 0.91%) ~ 1.06s 1.09s p=1.000 n=6
Check Time 7.62s (± 0.62%) 7.63s (± 0.20%) ~ 7.60s 7.64s p=0.806 n=6
Emit Time 4.31s (± 0.62%) 4.31s (± 0.41%) ~ 4.28s 4.32s p=1.000 n=6
Total Time 15.44s (± 0.38%) 15.43s (± 0.26%) ~ 15.39s 15.49s p=0.630 n=6
material-ui - node (v14.21.3, x64)
Memory used 477,176k (± 0.00%) 477,177k (± 0.00%) ~ 477,158k 477,198k p=0.873 n=6
Parse Time 3.30s (± 0.33%) 3.32s (± 0.40%) +0.02s (+ 0.56%) 3.31s 3.34s p=0.038 n=6
Bind Time 0.99s (± 0.41%) 0.99s (± 0.41%) ~ 0.98s 0.99s p=0.218 n=6
Check Time 19.17s (± 0.30%) 19.20s (± 0.24%) ~ 19.15s 19.28s p=0.328 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 23.45s (± 0.25%) 23.51s (± 0.18%) ~ 23.46s 23.58s p=0.226 n=6
xstate - node (v14.21.3, x64)
Memory used 550,156k (± 0.00%) 550,144k (± 0.00%) ~ 550,126k 550,167k p=0.470 n=6
Parse Time 4.24s (± 0.46%) 4.24s (± 0.67%) ~ 4.21s 4.28s p=0.685 n=6
Bind Time 1.68s (± 0.82%) 1.68s (± 0.48%) ~ 1.67s 1.69s p=0.868 n=6
Check Time 3.13s (± 0.73%) 3.14s (± 0.58%) ~ 3.12s 3.17s p=0.492 n=6
Emit Time 0.09s (± 0.00%) 0.09s (± 0.00%) ~ 0.09s 0.09s p=1.000 n=6
Total Time 9.15s (± 0.34%) 9.16s (± 0.44%) ~ 9.11s 9.22s p=0.469 n=6
System
Machine Namets-ci-ubuntu
Platformlinux 5.4.0-148-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v18.10.0, x64)
  • node (v16.17.1, x64)
  • node (v14.21.3, x64)
Scenarios
  • Angular - node (v18.10.0, x64)
  • Angular - node (v16.17.1, x64)
  • Angular - node (v14.21.3, x64)
  • Compiler-Unions - node (v18.10.0, x64)
  • Compiler-Unions - node (v16.17.1, x64)
  • Compiler-Unions - node (v14.21.3, x64)
  • Monaco - node (v18.10.0, x64)
  • Monaco - node (v16.17.1, x64)
  • Monaco - node (v14.21.3, x64)
  • TFS - node (v18.10.0, x64)
  • TFS - node (v16.17.1, x64)
  • TFS - node (v14.21.3, x64)
  • material-ui - node (v18.10.0, x64)
  • material-ui - node (v16.17.1, x64)
  • material-ui - node (v14.21.3, x64)
  • xstate - node (v18.10.0, x64)
  • xstate - node (v16.17.1, x64)
  • xstate - node (v14.21.3, x64)
Benchmark Name Iterations
Current 54935 6
Baseline main 6

TSServer

Comparison Report - main..54935
Metric main 54935 Delta Best Worst p-value
Compiler-UnionsTSServer - node (v18.10.0, x64)
Req 1 - updateOpen 2,553ms (± 0.51%) 2,566ms (± 0.90%) ~ 2,537ms 2,600ms p=0.336 n=6
Req 2 - geterr 5,371ms (± 0.86%) 5,378ms (± 0.59%) ~ 5,331ms 5,423ms p=0.689 n=6
Req 3 - references 348ms (± 0.97%) 347ms (± 1.31%) ~ 338ms 351ms p=0.936 n=6
Req 4 - navto 288ms (± 0.28%) 289ms (± 0.34%) ~ 288ms 290ms p=0.498 n=6
Req 5 - completionInfo count 1,356 (± 0.00%) 1,356 (± 0.00%) ~ 1,356 1,356 p=1.000 n=6
Req 5 - completionInfo 76ms (± 1.39%) 75ms (± 1.00%) ~ 74ms 76ms p=0.611 n=6
CompilerTSServer - node (v18.10.0, x64)
Req 1 - updateOpen 2,616ms (± 1.13%) 2,662ms (± 0.66%) +46ms (+ 1.74%) 2,635ms 2,678ms p=0.020 n=6
Req 2 - geterr 4,102ms (± 0.31%) 4,102ms (± 0.56%) ~ 4,063ms 4,130ms p=0.810 n=6
Req 3 - references 350ms (± 1.18%) 351ms (± 0.81%) ~ 348ms 354ms p=0.872 n=6
Req 4 - navto 289ms (± 1.02%) 289ms (± 0.65%) ~ 286ms 291ms p=0.809 n=6
Req 5 - completionInfo count 1,518 (± 0.00%) 1,518 (± 0.00%) ~ 1,518 1,518 p=1.000 n=6
Req 5 - completionInfo 81ms (± 3.43%) 81ms (± 3.20%) ~ 78ms 83ms p=0.507 n=6
xstateTSServer - node (v18.10.0, x64)
Req 1 - updateOpen 3,093ms (± 0.52%) 3,108ms (± 0.68%) ~ 3,082ms 3,141ms p=0.298 n=6
Req 2 - geterr 1,594ms (± 1.40%) 1,594ms (± 0.82%) ~ 1,578ms 1,610ms p=0.810 n=6
Req 3 - references 114ms (± 1.03%) 117ms (± 6.48%) ~ 112ms 132ms p=0.744 n=6
Req 4 - navto 369ms (± 0.68%) 370ms (± 0.30%) ~ 369ms 371ms p=0.167 n=6
Req 5 - completionInfo count 2,872 (± 0.00%) 2,872 (± 0.00%) ~ 2,872 2,872 p=1.000 n=6
Req 5 - completionInfo 379ms (± 2.35%) 377ms (± 1.49%) ~ 371ms 385ms p=0.810 n=6
Compiler-UnionsTSServer - node (v16.17.1, x64)
Req 1 - updateOpen 2,644ms (± 0.83%) 2,650ms (± 1.20%) ~ 2,616ms 2,687ms p=0.810 n=6
Req 2 - geterr 6,002ms (± 0.82%) 5,979ms (± 0.64%) ~ 5,925ms 6,028ms p=0.378 n=6
Req 3 - references 350ms (± 0.61%) 354ms (± 1.55%) ~ 348ms 363ms p=0.294 n=6
Req 4 - navto 288ms (± 0.98%) 288ms (± 0.54%) ~ 285ms 289ms p=0.870 n=6
Req 5 - completionInfo count 1,356 (± 0.00%) 1,356 (± 0.00%) ~ 1,356 1,356 p=1.000 n=6
Req 5 - completionInfo 84ms (± 4.67%) 86ms (± 4.76%) ~ 80ms 89ms p=0.328 n=6
CompilerTSServer - node (v16.17.1, x64)
Req 1 - updateOpen 2,810ms (± 0.12%) 2,817ms (± 0.74%) ~ 2,778ms 2,834ms p=0.149 n=6
Req 2 - geterr 4,658ms (± 0.41%) 4,678ms (± 0.41%) ~ 4,652ms 4,698ms p=0.199 n=6
Req 3 - references 365ms (± 0.62%) 364ms (± 0.33%) ~ 362ms 365ms p=0.739 n=6
Req 4 - navto 281ms (± 1.05%) 281ms (± 1.11%) ~ 276ms 284ms p=0.743 n=6
Req 5 - completionInfo count 1,518 (± 0.00%) 1,518 (± 0.00%) ~ 1,518 1,518 p=1.000 n=6
Req 5 - completionInfo 76ms (± 1.11%) 76ms (± 1.44%) ~ 75ms 78ms p=0.383 n=6
xstateTSServer - node (v16.17.1, x64)
Req 1 - updateOpen 3,233ms (± 0.41%) 3,246ms (± 0.44%) ~ 3,231ms 3,272ms p=0.092 n=6
Req 2 - geterr 1,728ms (± 1.00%) 1,742ms (± 1.07%) ~ 1,709ms 1,761ms p=0.298 n=6
Req 3 - references 124ms (± 7.41%) 127ms (± 6.55%) ~ 119ms 143ms p=0.225 n=6
Req 4 - navto 353ms (± 0.42%) 354ms (± 0.99%) ~ 351ms 361ms p=0.870 n=6
Req 5 - completionInfo count 2,872 (± 0.00%) 2,872 (± 0.00%) ~ 2,872 2,872 p=1.000 n=6
Req 5 - completionInfo 413ms (± 2.24%) 409ms (± 2.69%) ~ 394ms 422ms p=0.810 n=6
Compiler-UnionsTSServer - node (v14.21.3, x64)
Req 1 - updateOpen 2,790ms (± 0.52%) 2,800ms (± 0.47%) ~ 2,784ms 2,820ms p=0.125 n=6
Req 2 - geterr 6,154ms (± 0.18%) 6,172ms (± 0.34%) ~ 6,145ms 6,197ms p=0.230 n=6
Req 3 - references 361ms (± 1.00%) 360ms (± 0.49%) ~ 357ms 361ms p=0.935 n=6
Req 4 - navto 292ms (± 0.95%) 293ms (± 0.34%) ~ 292ms 294ms p=0.411 n=6
Req 5 - completionInfo count 1,356 (± 0.00%) 1,356 (± 0.00%) ~ 1,356 1,356 p=1.000 n=6
Req 5 - completionInfo 107ms (± 7.17%) 110ms (± 4.07%) ~ 102ms 114ms p=0.193 n=6
CompilerTSServer - node (v14.21.3, x64)
Req 1 - updateOpen 2,953ms (± 0.39%) 2,953ms (± 0.43%) ~ 2,938ms 2,974ms p=0.936 n=6
Req 2 - geterr 4,545ms (± 0.35%) 4,558ms (± 0.52%) ~ 4,525ms 4,598ms p=0.335 n=6
Req 3 - references 375ms (± 0.28%) 377ms (± 0.61%) ~ 373ms 379ms p=0.103 n=6
Req 4 - navto 298ms (± 0.39%) 296ms (± 0.58%) ~ 294ms 298ms p=0.183 n=6
Req 5 - completionInfo count 1,518 (± 0.00%) 1,518 (± 0.00%) ~ 1,518 1,518 p=1.000 n=6
Req 5 - completionInfo 83ms (± 0.62%) 82ms (± 2.09%) ~ 80ms 84ms p=0.351 n=6
xstateTSServer - node (v14.21.3, x64)
Req 1 - updateOpen 3,475ms (± 0.37%) 3,476ms (± 0.30%) ~ 3,458ms 3,486ms p=0.689 n=6
Req 2 - geterr 1,845ms (± 0.33%) 1,840ms (± 0.76%) ~ 1,823ms 1,859ms p=0.572 n=6
Req 3 - references 145ms (± 7.82%) 151ms (± 6.77%) ~ 138ms 160ms p=0.411 n=6
Req 4 - navto 386ms (± 0.21%) 389ms (± 0.63%) +3ms (+ 0.69%) 386ms 393ms p=0.048 n=6
Req 5 - completionInfo count 2,872 (± 0.00%) 2,872 (± 0.00%) ~ 2,872 2,872 p=1.000 n=6
Req 5 - completionInfo 444ms (± 0.84%) 439ms (± 1.67%) ~ 427ms 447ms p=0.336 n=6
System
Machine Namets-ci-ubuntu
Platformlinux 5.4.0-148-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v18.10.0, x64)
  • node (v16.17.1, x64)
  • node (v14.21.3, x64)
Scenarios
  • Compiler-UnionsTSServer - node (v18.10.0, x64)
  • Compiler-UnionsTSServer - node (v16.17.1, x64)
  • Compiler-UnionsTSServer - node (v14.21.3, x64)
  • CompilerTSServer - node (v18.10.0, x64)
  • CompilerTSServer - node (v16.17.1, x64)
  • CompilerTSServer - node (v14.21.3, x64)
  • xstateTSServer - node (v18.10.0, x64)
  • xstateTSServer - node (v16.17.1, x64)
  • xstateTSServer - node (v14.21.3, x64)
Benchmark Name Iterations
Current 54935 6
Baseline main 6

Startup

Comparison Report - main..54935
Metric main 54935 Delta Best Worst p-value
tsc-startup - node (v16.17.1, x64)
Execution time 142.34ms (± 0.18%) 143.57ms (± 0.24%) +1.23ms (+ 0.87%) 142.36ms 148.51ms p=0.000 n=600
tsserver-startup - node (v16.17.1, x64)
Execution time 221.54ms (± 0.16%) 227.60ms (± 0.33%) +6.06ms (+ 2.73%) 222.50ms 232.89ms p=0.000 n=600
tsserverlibrary-startup - node (v16.17.1, x64)
Execution time 223.09ms (± 0.15%) 228.32ms (± 0.19%) +5.23ms (+ 2.35%) 224.25ms 232.19ms p=0.000 n=600
typescript-startup - node (v16.17.1, x64)
Execution time 205.05ms (± 0.15%) 208.61ms (± 0.35%) +3.57ms (+ 1.74%) 205.52ms 214.26ms p=0.000 n=600
System
Machine Namets-ci-ubuntu
Platformlinux 5.4.0-148-generic
Architecturex64
Available Memory16 GB
Available Memory15 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v16.17.1, x64)
Scenarios
  • tsc-startup - node (v16.17.1, x64)
  • tsserver-startup - node (v16.17.1, x64)
  • tsserverlibrary-startup - node (v16.17.1, x64)
  • typescript-startup - node (v16.17.1, x64)
Benchmark Name Iterations
Current 54935 6
Baseline main 6

Developer Information:

Download Benchmark

@typescript-bot
Copy link
Collaborator

@jakebailey Here are the results of running the top-repos suite comparing main and refs/pull/54935/merge:

Everything looks good!

@typescript-bot
Copy link
Collaborator

Hey @jakebailey, the results of running the DT tests are ready.
Everything looks the same!
You can check the log here.

@kring
Copy link
Author

kring commented Jul 9, 2023

The rxjs-src errors occur in the latest nightly, too (5.2.0-dev.20230709), so I think they're unrelated to this PR. Let me know if you think otherwise!

@jakebailey
Copy link
Member

You can ignore the rxjs thing; the bot is apparently not smart enough to handle paths in error elaborations.

propertyTypeNode
)],
/*body*/ undefined);
typeElements.push(preserveCommentsOn(setAccessorSignature));
Copy link
Member

Choose a reason for hiding this comment

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

So, as-is, by using preserveCommentsOn in both the get and set branches, this'll duplicate comments from the valueDeclaration of the symbol onto both the emitted get and set accessors. You probably wanna do something a bit more bespoke that lookups up the get/set accessor declarations and copies the comments from that specific matching declaration kind. setCommentRange(setAccessorSignature, setAccessorDecl) should do.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks @weswigham. I've made the change you suggested, and also added a test for it.

@kring
Copy link
Author

kring commented Jul 16, 2023

I also made another change to this PR, just FYI. Previously it would add all the modifiers from the source properties, except for a list I knew to be problematic. But then I ran into at least one more problematic one (abstract) in using this branch with my own code and came to the conclusion that including none of the modifiers is probably the right thing. But of course let me know if you think otherwise.

Not sure if typescript-bot will respond to me, but wanted to try:
@typescript-bot pack this

@jakebailey
Copy link
Member

I can repack it if you want; the bot only responds to team members given it'd not be so great for arbitrary PRs to get published to npm without human interaction.

@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 18, 2023

Heya @jakebailey, I've started to run the tarball bundle task on this PR at 616c614. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 18, 2023

Hey @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/155908/artifacts?artifactName=tgz&fileId=BA2663BE4611C06F1BCA08ACEB4F633C382902C636DCC277E3BB9D0FFE0B0CD102&fileName=/typescript-5.2.0-insiders.20230718.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.2.0-pr-54935-17".;

/*dotDotDotToken*/ undefined,
parameterName,
/*questionToken*/ undefined,
propertyTypeNode
Copy link
Member

Choose a reason for hiding this comment

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

Rather than reusing the propertyTypeNode, we'd need to at least (deep) clone it - potentially putting the same node in the tree at two places can have funky results sometimes. But, better yet, would be fixing the differing get/set type bug while we're here! You can get the seter type by using getWriteTypeOfSymbol on the propertySymbol, which you can then feed through serializeTypeForDeclaration, same as is done for the reading type. You might need to duplicate the getNonMissingTypeOfSymbol into a getNonMissingWriteTypeOfSymbol to handle the missing type (the special undefined-like type we represent non-existent properties with in some compiler settings) correctly, though.

Copy link
Author

Choose a reason for hiding this comment

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

Makes sense, @weswigham. I should be able to implement it this weekend.

Copy link
Author

Choose a reason for hiding this comment

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

This is done, and I think the updated baselines demonstrate it's working. I wasn't sure if any of the createElidedInformationPlaceholder or propertyIsReverseMapped stuff applies to the setter type. If the answer is "yes" (or even "maybe"), let me know and I'll dig deeper. Thanks for the ongoing review!

@kring
Copy link
Author

kring commented Aug 1, 2023

@sandersn just a bump on this because it's in the "Waiting on Author" state, but I don't think it's actually waiting on anything from me anymore. Sorry for the noise if I just need to be more patient!

@sandersn
Copy link
Member

sandersn commented Aug 2, 2023

Woops, I misread the comment history. I moved it back to Waiting on Reviewers.

@athewsey
Copy link

@sandersn / @weswigham any update on this? Seems like it's been waiting for review for a while and I just ran in to the same issue it's trying to solve. Thanks for your help!

@RyanCavanaugh
Copy link
Member

This seems to change too much for what it's doing -- there's no need to modify all object type emit here when the only problem has to do with class types, and people are going to be confused to see readonly replaced with just a getter. This is marginally risky since duplicate property logic (that checks if two declarations of the same property are equivalent or not) doesn't consider readonly x: string and get x(): string to be "the same".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Milestone Bug PRs that fix a bug with a specific milestone

Projects

Status: Waiting on reviewers

Development

Successfully merging this pull request may close these issues.

A function that returns a class with a property getter is unusable via a declaration file (TS2611)

7 participants