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

Exclude mapped types with optionality modifiers and 'as' clauses from constraint logic #48273

Merged
merged 3 commits into from Mar 16, 2022

Conversation

ahejlsberg
Copy link
Member

Fixes #48157.
Fixes #48246.

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Mar 15, 2022
@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
Copy link
Collaborator

typescript-bot commented Mar 15, 2022

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 15, 2022

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 15, 2022

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 15, 2022

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

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

Here they are:

Comparison Report - main..48273

Metric main 48273 Delta Best Worst
Angular - node (v14.15.1, x64)
Memory used 332,456k (± 0.01%) 332,428k (± 0.01%) -28k (- 0.01%) 332,373k 332,479k
Parse Time 2.03s (± 0.43%) 2.03s (± 0.52%) -0.01s (- 0.34%) 2.01s 2.05s
Bind Time 0.87s (± 0.80%) 0.87s (± 0.60%) -0.00s (- 0.23%) 0.86s 0.88s
Check Time 5.60s (± 0.41%) 5.61s (± 0.56%) +0.01s (+ 0.13%) 5.55s 5.68s
Emit Time 6.30s (± 0.73%) 6.27s (± 0.81%) -0.03s (- 0.52%) 6.16s 6.40s
Total Time 14.81s (± 0.46%) 14.77s (± 0.54%) -0.04s (- 0.24%) 14.64s 15.00s
Compiler-Unions - node (v14.15.1, x64)
Memory used 194,479k (± 0.49%) 194,035k (± 0.60%) -444k (- 0.23%) 191,247k 195,221k
Parse Time 0.86s (± 0.80%) 0.86s (± 0.78%) +0.00s (+ 0.12%) 0.85s 0.88s
Bind Time 0.56s (± 0.99%) 0.56s (± 1.15%) 0.00s ( 0.00%) 0.55s 0.58s
Check Time 7.48s (± 0.51%) 7.44s (± 0.68%) -0.05s (- 0.63%) 7.34s 7.59s
Emit Time 2.49s (± 0.99%) 2.51s (± 1.31%) +0.01s (+ 0.44%) 2.45s 2.61s
Total Time 11.39s (± 0.57%) 11.36s (± 0.61%) -0.03s (- 0.29%) 11.23s 11.53s
Monaco - node (v14.15.1, x64)
Memory used 325,416k (± 0.01%) 325,397k (± 0.01%) -18k (- 0.01%) 325,353k 325,430k
Parse Time 1.58s (± 0.48%) 1.56s (± 0.48%) -0.01s (- 0.70%) 1.55s 1.59s
Bind Time 0.78s (± 0.63%) 0.78s (± 1.33%) +0.01s (+ 0.77%) 0.76s 0.81s
Check Time 5.48s (± 0.37%) 5.46s (± 0.47%) -0.02s (- 0.38%) 5.41s 5.55s
Emit Time 3.31s (± 0.88%) 3.30s (± 0.75%) -0.00s (- 0.15%) 3.26s 3.39s
Total Time 11.14s (± 0.35%) 11.11s (± 0.21%) -0.03s (- 0.28%) 11.07s 11.18s
TFS - node (v14.15.1, x64)
Memory used 288,830k (± 0.01%) 288,825k (± 0.01%) -5k (- 0.00%) 288,758k 288,886k
Parse Time 1.32s (± 1.65%) 1.31s (± 0.78%) -0.01s (- 0.68%) 1.29s 1.33s
Bind Time 0.73s (± 0.99%) 0.73s (± 0.71%) -0.00s (- 0.41%) 0.72s 0.74s
Check Time 5.13s (± 0.38%) 5.14s (± 0.63%) +0.01s (+ 0.23%) 5.06s 5.21s
Emit Time 3.56s (± 1.91%) 3.46s (± 1.56%) -0.10s (- 2.78%) 3.38s 3.60s
Total Time 10.74s (± 0.80%) 10.64s (± 0.43%) -0.10s (- 0.88%) 10.52s 10.73s
material-ui - node (v14.15.1, x64)
Memory used 453,572k (± 0.06%) 453,653k (± 0.03%) +82k (+ 0.02%) 453,114k 453,735k
Parse Time 1.86s (± 0.42%) 1.86s (± 0.80%) -0.00s (- 0.16%) 1.84s 1.91s
Bind Time 0.71s (± 0.81%) 0.70s (± 1.00%) -0.01s (- 1.68%) 0.69s 0.72s
Check Time 20.80s (± 1.19%) 20.45s (± 1.14%) -0.35s (- 1.69%) 20.10s 21.07s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 23.37s (± 1.06%) 23.01s (± 1.08%) -0.36s (- 1.56%) 22.64s 23.70s
xstate - node (v14.15.1, x64)
Memory used 535,139k (± 0.01%) 535,120k (± 0.00%) -20k (- 0.00%) 535,073k 535,165k
Parse Time 2.57s (± 0.47%) 2.56s (± 0.33%) -0.00s (- 0.19%) 2.55s 2.58s
Bind Time 1.15s (± 0.41%) 1.14s (± 0.77%) -0.00s (- 0.35%) 1.13s 1.16s
Check Time 1.51s (± 0.61%) 1.50s (± 0.74%) -0.01s (- 0.46%) 1.49s 1.54s
Emit Time 0.07s (± 0.00%) 0.07s (± 0.00%) 0.00s ( 0.00%) 0.07s 0.07s
Total Time 5.30s (± 0.31%) 5.28s (± 0.24%) -0.02s (- 0.30%) 5.26s 5.32s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-210-generic
Architecturex64
Available Memory16 GB
Available Memory4 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v14.15.1, x64)
Scenarios
  • Angular - node (v14.15.1, x64)
  • Compiler-Unions - node (v14.15.1, x64)
  • Monaco - node (v14.15.1, x64)
  • TFS - node (v14.15.1, x64)
  • material-ui - node (v14.15.1, x64)
  • xstate - node (v14.15.1, x64)
Benchmark Name Iterations
Current 48273 10
Baseline main 10

Developer Information:

Download Benchmark

@typescript-bot
Copy link
Collaborator

@ahejlsberg
Great news! no new errors were found between main..refs/pull/48273/merge

return type.flags & TypeFlags.IndexedAccess && getObjectFlags((type as IndexedAccessType).objectType) & ObjectFlags.Mapped &&
!isGenericMappedType((type as IndexedAccessType).objectType) && isGenericIndexType((type as IndexedAccessType).indexType);
let objectType;
return !!(type.flags & TypeFlags.IndexedAccess && getObjectFlags(objectType = (type as IndexedAccessType).objectType) & ObjectFlags.Mapped &&
Copy link
Member

Choose a reason for hiding this comment

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

Seems like this would be improved by De Morgan's law

# Conflicts:
#	src/compiler/checker.ts
@ahejlsberg ahejlsberg merged commit 8e5a84a into main Mar 16, 2022
@ahejlsberg ahejlsberg deleted the fix48157 branch March 16, 2022 00:37
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
None yet
Development

Successfully merging this pull request may close these issues.

Cannot use mapped types to create new mapped types Possible regression in typechecker for Required type
3 participants