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

Fix creation of composite union type predicates #54169

Merged
merged 2 commits into from
May 19, 2023
Merged

Fix creation of composite union type predicates #54169

merged 2 commits into from
May 19, 2023

Conversation

ahejlsberg
Copy link
Member

Fixes #54143.

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels May 7, 2023
@ahejlsberg ahejlsberg requested a review from RyanCavanaugh May 7, 2023 15:34
@ahejlsberg
Copy link
Member Author

@typescript-bot test this
@typescript-bot user test this inline
@typescript-bot run dt
@typescript-bot perf test faster
@typescript-bot test top100

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 7, 2023

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 7, 2023

Heya @ahejlsberg, I've started to run the abridged perf test suite on this PR at 98c0460. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 7, 2023

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 7, 2023

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 7, 2023

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

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

There were infrastructure failures potentially unrelated to your change:

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

Otherwise...

Everything looks good!

@typescript-bot
Copy link
Collaborator

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

Something interesting changed - please have a look.

Details

microsoft/vscode

4 of 53 projects failed to build with the old tsc and were ignored

src/tsconfig.tsec.json

@typescript-bot
Copy link
Collaborator

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

@ahejlsberg
Copy link
Member Author

The new error in the vscode project is precisely an example of relying on the issue we're fixing: A union of two function types where one is a type predicate and the other is just a boolean returning function. It definitely isn't sound to rely on the boolean function proving or disproving anything, so the new error is correct.

@typescript-bot
Copy link
Collaborator

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

Here they are:

Comparison Report - main..54169

Metric main 54169 Delta Best Worst p-value
Angular - node (v16.17.1, x64)
Memory used 365,352k (± 0.01%) 365,349k (± 0.00%) ~ 365,329k 365,379k p=0.810 n=6
Parse Time 3.55s (± 0.48%) 3.55s (± 0.49%) ~ 3.54s 3.58s p=0.737 n=6
Bind Time 1.17s (± 0.54%) 1.17s (± 0.54%) ~ 1.16s 1.18s p=1.000 n=6
Check Time 9.56s (± 0.37%) 9.58s (± 0.40%) ~ 9.54s 9.62s p=0.418 n=6
Emit Time 7.91s (± 0.34%) 7.94s (± 0.38%) ~ 7.91s 7.98s p=0.077 n=6
Total Time 22.19s (± 0.26%) 22.25s (± 0.28%) ~ 22.19s 22.35s p=0.227 n=6
Compiler-Unions - node (v16.17.1, x64)
Memory used 192,810k (± 0.02%) 192,710k (± 0.08%) ~ 192,416k 192,853k p=0.093 n=6
Parse Time 1.61s (± 0.96%) 1.59s (± 1.75%) ~ 1.54s 1.62s p=0.220 n=6
Bind Time 0.82s (± 0.63%) 0.83s (± 0.91%) ~ 0.82s 0.84s p=0.247 n=6
Check Time 10.29s (± 0.43%) 10.28s (± 0.39%) ~ 10.24s 10.33s p=0.748 n=6
Emit Time 3.02s (± 0.65%) 3.02s (± 0.92%) ~ 3.00s 3.07s p=0.803 n=6
Total Time 15.74s (± 0.21%) 15.72s (± 0.46%) ~ 15.61s 15.82s p=0.809 n=6
Monaco - node (v16.17.1, x64)
Memory used 345,862k (± 0.00%) 345,863k (± 0.01%) ~ 345,839k 345,893k p=0.810 n=6
Parse Time 2.72s (± 0.44%) 2.73s (± 0.54%) ~ 2.71s 2.75s p=0.623 n=6
Bind Time 1.08s (± 0.77%) 1.08s (± 0.70%) ~ 1.07s 1.09s p=0.432 n=6
Check Time 7.88s (± 0.72%) 7.87s (± 0.42%) ~ 7.82s 7.91s p=0.808 n=6
Emit Time 4.47s (± 0.59%) 4.45s (± 0.49%) ~ 4.41s 4.47s p=0.090 n=6
Total Time 16.15s (± 0.38%) 16.13s (± 0.25%) ~ 16.09s 16.19s p=0.421 n=6
TFS - node (v16.17.1, x64)
Memory used 300,105k (± 0.01%) 300,100k (± 0.01%) ~ 300,078k 300,126k p=0.689 n=6
Parse Time 2.16s (± 0.64%) 2.16s (± 0.72%) ~ 2.14s 2.18s p=0.676 n=6
Bind Time 1.23s (± 0.66%) 1.24s (± 0.79%) ~ 1.23s 1.25s p=0.498 n=6
Check Time 7.27s (± 0.45%) 7.29s (± 0.48%) ~ 7.23s 7.33s p=0.421 n=6
Emit Time 4.34s (± 0.89%) 4.38s (± 0.91%) ~ 4.33s 4.42s p=0.334 n=6
Total Time 15.00s (± 0.51%) 15.06s (± 0.34%) ~ 14.97s 15.11s p=0.196 n=6
material-ui - node (v16.17.1, x64)
Memory used 481,623k (± 0.01%) 481,595k (± 0.01%) ~ 481,534k 481,636k p=0.336 n=6
Parse Time 3.24s (± 0.28%) 3.23s (± 0.47%) ~ 3.22s 3.26s p=0.458 n=6
Bind Time 0.94s (± 0.80%) 0.94s (± 0.55%) ~ 0.93s 0.94s p=0.784 n=6
Check Time 17.86s (± 0.47%) 17.85s (± 0.53%) ~ 17.71s 17.96s p=1.000 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 22.04s (± 0.40%) 22.02s (± 0.47%) ~ 21.86s 22.12s p=0.872 n=6
xstate - node (v16.17.1, x64)
Memory used 560,369k (± 0.02%) 560,377k (± 0.02%) ~ 560,279k 560,519k p=0.810 n=6
Parse Time 4.00s (± 0.31%) 4.00s (± 0.16%) ~ 3.99s 4.01s p=0.591 n=6
Bind Time 1.76s (± 0.51%) 1.76s (± 0.66%) ~ 1.75s 1.78s p=0.933 n=6
Check Time 3.06s (± 0.67%) 3.06s (± 0.34%) ~ 3.04s 3.07s p=0.802 n=6
Emit Time 0.09s (± 0.00%) 0.09s (± 4.45%) ~ 0.09s 0.10s p=0.405 n=6
Total Time 8.92s (± 0.31%) 8.91s (± 0.27%) ~ 8.88s 8.94s p=0.624 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 (v16.17.1, x64)
Scenarios
  • Angular - node (v16.17.1, x64)
  • Compiler-Unions - node (v16.17.1, x64)
  • Monaco - node (v16.17.1, x64)
  • TFS - node (v16.17.1, x64)
  • material-ui - node (v16.17.1, x64)
  • xstate - node (v16.17.1, x64)
Benchmark Name Iterations
Current 54169 6
Baseline main 6

Developer Information:

Download Benchmark

@ahejlsberg ahejlsberg merged commit 215fe6e into main May 19, 2023
@ahejlsberg ahejlsberg deleted the fix54143 branch May 19, 2023 20:15
@DanielRosenwasser
Copy link
Member

@typescript-bot cherry-pick this to release-5.1

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 26, 2023

Heya @DanielRosenwasser, I've started to run the task to cherry-pick this into release-5.1 on this PR at 98c0460. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

Hey @DanielRosenwasser, I've opened #54412 for you.

typescript-bot pushed a commit to typescript-bot/TypeScript that referenced this pull request May 26, 2023
Component commits:
a54709c Revise creation of composite union/intersection type predicates

98c0460 Add tests
DanielRosenwasser pushed a commit that referenced this pull request May 29, 2023
…e-5.1 (#54412)

Co-authored-by: Anders Hejlsberg <andersh@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Type guard incorrectly erases union type
4 participants