Skip to content

Fix narrowing of intersections of type variables and primitive types - #43131

Merged
Anders Hejlsberg (ahejlsberg) merged 2 commits into
masterfrom
fix43130
Mar 18, 2021
Merged

Fix narrowing of intersections of type variables and primitive types#43131
Anders Hejlsberg (ahejlsberg) merged 2 commits into
masterfrom
fix43130

Conversation

@ahejlsberg

Copy link
Copy Markdown
Member

Fixes#43130.

@ahejlsberg

Copy link
Copy Markdown
MemberAuthor

@typescript-bot

TypeScript Bot (typescript-bot) commented Mar 8, 2021

Copy link
Copy Markdown
Contributor

Heya Anders Hejlsberg (@ahejlsberg), I've started to run the perf test suite on this PR at 5a8a0bb. You can monitor the build here.

Update: The results are in!

@typescript-bot

TypeScript Bot (typescript-bot) commented Mar 8, 2021

Copy link
Copy Markdown
Contributor

Heya Anders Hejlsberg (@ahejlsberg), I've started to run the extended test suite on this PR at 5a8a0bb. You can monitor the build here.

@typescript-bot

TypeScript Bot (typescript-bot) commented Mar 8, 2021

Copy link
Copy Markdown
Contributor

Heya Anders Hejlsberg (@ahejlsberg), I've started to run the parallelized community code test suite on this PR at 5a8a0bb. You can monitor the build here.

@typescript-bot

TypeScript Bot (typescript-bot) commented Mar 8, 2021

Copy link
Copy Markdown
Contributor

Heya Anders Hejlsberg (@ahejlsberg), I've started to run the parallelized Definitely Typed test suite on this PR at 5a8a0bb. You can monitor the build here.

@typescript-bot

TypeScript Bot (typescript-bot) commented Mar 8, 2021

Copy link
Copy Markdown
Contributor

Heya Anders Hejlsberg (@ahejlsberg), I've started to run the abridged perf test suite on this PR at 5a8a0bb. You can monitor the build here.

Update: The results are in!

@typescript-bot

Copy link
Copy Markdown
Contributor

Anders Hejlsberg (@ahejlsberg)
The results of the perf run you requested are in!

Here they are:

Comparison Report - master..43131

Metricmaster43131DeltaBestWorst
Angular - node (v10.16.3, x64)
Memory used348,551k (± 0.03%)348,531k (± 0.02%)-19k (- 0.01%)348,438k348,646k
Parse Time1.91s (± 0.82%)1.93s (± 0.66%)+0.02s (+ 0.78%)1.90s1.96s
Bind Time0.83s (± 0.87%)0.83s (± 0.72%)+0.00s (+ 0.36%)0.82s0.85s
Check Time5.02s (± 0.78%)5.04s (± 0.60%)+0.01s (+ 0.28%)4.97s5.11s
Emit Time5.92s (± 0.92%)5.96s (± 0.65%)+0.04s (+ 0.64%)5.88s6.03s
Total Time13.69s (± 0.74%)13.77s (± 0.42%)+0.08s (+ 0.57%)13.62s13.92s
Compiler-Unions - node (v10.16.3, x64)
Memory used204,765k (± 0.03%)204,811k (± 0.05%)+47k (+ 0.02%)204,647k205,131k
Parse Time0.78s (± 0.60%)0.78s (± 0.75%)-0.00s (- 0.38%)0.77s0.79s
Bind Time0.52s (± 1.56%)0.52s (± 1.24%)-0.00s (- 0.19%)0.51s0.53s
Check Time7.42s (± 0.80%)7.45s (± 0.66%)+0.03s (+ 0.44%)7.33s7.54s
Emit Time2.59s (± 0.75%)2.59s (± 1.18%)-0.00s (- 0.04%)2.54s2.70s
Total Time11.31s (± 0.62%)11.34s (± 0.48%)+0.03s (+ 0.23%)11.19s11.42s
Monaco - node (v10.16.3, x64)
Memory used356,591k (± 0.02%)356,608k (± 0.03%)+18k (+ 0.00%)356,456k356,973k
Parse Time1.56s (± 0.81%)1.55s (± 0.44%)-0.01s (- 0.83%)1.53s1.56s
Bind Time0.73s (± 0.46%)0.74s (± 0.79%)+0.00s (+ 0.55%)0.73s0.75s
Check Time5.21s (± 0.67%)5.20s (± 0.52%)-0.01s (- 0.17%)5.13s5.25s
Emit Time3.14s (± 0.83%)3.15s (± 1.02%)+0.00s (+ 0.13%)3.10s3.25s
Total Time10.64s (± 0.53%)10.63s (± 0.50%)-0.02s (- 0.14%)10.52s10.77s
TFS - node (v10.16.3, x64)
Memory used308,906k (± 0.02%)308,937k (± 0.01%)+32k (+ 0.01%)308,836k309,017k
Parse Time1.21s (± 0.80%)1.21s (± 0.63%)-0.01s (- 0.41%)1.19s1.22s
Bind Time0.69s (± 0.52%)0.70s (± 0.72%)+0.00s (+ 0.14%)0.69s0.71s
Check Time4.69s (± 0.79%)4.70s (± 0.67%)+0.01s (+ 0.21%)4.64s4.78s
Emit Time3.26s (± 0.74%)3.23s (± 1.88%)-0.02s (- 0.77%)3.10s3.35s
Total Time9.85s (± 0.66%)9.84s (± 0.67%)-0.01s (- 0.15%)9.70s9.97s
material-ui - node (v10.16.3, x64)
Memory used501,596k (± 0.02%)501,603k (± 0.02%)+7k (+ 0.00%)501,397k501,763k
Parse Time1.99s (± 0.72%)2.00s (± 0.86%)+0.01s (+ 0.45%)1.95s2.03s
Bind Time0.66s (± 0.68%)0.64s (± 0.96%)-0.02s (- 2.58%)0.63s0.65s
Check Time14.22s (± 0.49%)14.30s (± 0.97%)+0.08s (+ 0.60%)13.96s14.54s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time16.87s (± 0.44%)16.94s (± 0.91%)+0.07s (+ 0.44%)16.56s17.22s
Angular - node (v12.1.0, x64)
Memory used326,193k (± 0.01%)326,275k (± 0.04%)+82k (+ 0.03%)325,953k326,513k
Parse Time1.91s (± 0.65%)1.91s (± 0.78%)-0.01s (- 0.42%)1.87s1.94s
Bind Time0.81s (± 0.80%)0.81s (± 0.76%)-0.00s (- 0.12%)0.80s0.82s
Check Time4.93s (± 0.49%)4.93s (± 0.53%)-0.00s (- 0.10%)4.88s4.98s
Emit Time6.00s (± 0.88%)6.04s (± 0.68%)+0.04s (+ 0.60%)5.94s6.15s
Total Time13.66s (± 0.58%)13.68s (± 0.47%)+0.02s (+ 0.17%)13.51s13.85s
Compiler-Unions - node (v12.1.0, x64)
Memory used191,480k (± 0.03%)191,305k (± 0.11%)-176k (- 0.09%)190,528k191,545k
Parse Time0.77s (± 0.91%)0.77s (± 0.87%)-0.00s (- 0.52%)0.75s0.78s
Bind Time0.53s (± 0.94%)0.53s (± 1.45%)-0.00s (- 0.19%)0.51s0.54s
Check Time6.99s (± 0.64%)6.97s (± 0.51%)-0.01s (- 0.21%)6.92s7.06s
Emit Time2.57s (± 0.69%)2.57s (± 0.82%)+0.01s (+ 0.23%)2.53s2.63s
Total Time10.85s (± 0.56%)10.84s (± 0.54%)-0.01s (- 0.12%)10.73s11.00s
Monaco - node (v12.1.0, x64)
Memory used339,059k (± 0.02%)339,091k (± 0.04%)+32k (+ 0.01%)338,890k339,490k
Parse Time1.55s (± 0.60%)1.53s (± 1.07%)-0.01s (- 0.90%)1.49s1.58s
Bind Time0.72s (± 0.55%)0.72s (± 0.92%)+0.00s (+ 0.28%)0.71s0.74s
Check Time5.03s (± 0.37%)5.02s (± 0.36%)-0.01s (- 0.20%)4.99s5.08s
Emit Time3.12s (± 1.02%)3.12s (± 0.43%)+0.00s (+ 0.03%)3.10s3.15s
Total Time10.43s (± 0.45%)10.40s (± 0.29%)-0.02s (- 0.23%)10.32s10.45s
TFS - node (v12.1.0, x64)
Memory used293,126k (± 0.03%)293,092k (± 0.02%)-34k (- 0.01%)292,929k293,186k
Parse Time1.22s (± 0.56%)1.22s (± 1.24%)-0.01s (- 0.49%)1.19s1.25s
Bind Time0.68s (± 1.07%)0.68s (± 0.85%)+0.00s (+ 0.15%)0.67s0.69s
Check Time4.59s (± 0.38%)4.59s (± 0.57%)+0.00s (+ 0.02%)4.53s4.66s
Emit Time3.17s (± 0.70%)3.16s (± 0.84%)-0.02s (- 0.47%)3.11s3.24s
Total Time9.67s (± 0.41%)9.65s (± 0.47%)-0.02s (- 0.17%)9.53s9.77s
material-ui - node (v12.1.0, x64)
Memory used479,469k (± 0.02%)479,315k (± 0.06%)-154k (- 0.03%)478,434k479,655k
Parse Time2.00s (± 0.44%)2.00s (± 0.56%)-0.00s (- 0.20%)1.97s2.02s
Bind Time0.64s (± 0.62%)0.64s (± 0.97%)-0.00s (- 0.31%)0.63s0.65s
Check Time12.85s (± 0.57%)12.85s (± 0.70%)+0.00s (+ 0.03%)12.68s13.05s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time15.49s (± 0.47%)15.49s (± 0.55%)-0.00s (- 0.01%)15.33s15.65s
Angular - node (v14.15.1, x64)
Memory used324,915k (± 0.01%)324,809k (± 0.08%)-106k (- 0.03%)323,699k325,015k
Parse Time1.90s (± 0.72%)1.90s (± 0.76%)-0.00s (- 0.11%)1.88s1.94s
Bind Time0.85s (± 1.17%)0.85s (± 0.83%)-0.00s (- 0.47%)0.84s0.87s
Check Time4.92s (± 0.32%)4.92s (± 0.76%)+0.00s (+ 0.10%)4.86s5.05s
Emit Time6.27s (± 0.54%)6.27s (± 0.74%)-0.01s (- 0.10%)6.19s6.39s
Total Time13.95s (± 0.34%)13.94s (± 0.60%)-0.01s (- 0.07%)13.83s14.22s
Compiler-Unions - node (v14.15.1, x64)
Memory used191,048k (± 0.02%)191,057k (± 0.01%)+10k (+ 0.01%)190,990k191,103k
Parse Time0.79s (± 0.43%)0.80s (± 0.63%)+0.00s (+ 0.25%)0.79s0.81s
Bind Time0.55s (± 0.67%)0.55s (± 0.73%)-0.00s (- 0.72%)0.54s0.56s
Check Time7.02s (± 0.88%)7.04s (± 0.67%)+0.02s (+ 0.34%)6.96s7.15s
Emit Time2.54s (± 0.97%)2.55s (± 0.79%)+0.01s (+ 0.51%)2.52s2.61s
Total Time10.90s (± 0.68%)10.94s (± 0.52%)+0.04s (+ 0.33%)10.84s11.10s
Monaco - node (v14.15.1, x64)
Memory used338,052k (± 0.01%)338,065k (± 0.00%)+13k (+ 0.00%)338,020k338,091k
Parse Time1.56s (± 0.67%)1.56s (± 0.69%)-0.00s (- 0.26%)1.53s1.59s
Bind Time0.75s (± 1.03%)0.75s (± 0.30%)-0.00s (- 0.27%)0.74s0.75s
Check Time4.96s (± 0.63%)4.95s (± 0.49%)-0.01s (- 0.22%)4.90s5.02s
Emit Time3.16s (± 1.14%)3.15s (± 0.79%)-0.01s (- 0.22%)3.11s3.23s
Total Time10.43s (± 0.61%)10.41s (± 0.31%)-0.02s (- 0.19%)10.35s10.48s
TFS - node (v14.15.1, x64)
Memory used292,246k (± 0.01%)292,250k (± 0.01%)+4k (+ 0.00%)292,187k292,310k
Parse Time1.25s (± 1.10%)1.26s (± 0.78%)+0.00s (+ 0.24%)1.24s1.28s
Bind Time0.72s (± 1.06%)0.72s (± 0.95%)0.00s ( 0.00%)0.71s0.74s
Check Time4.59s (± 0.55%)4.57s (± 0.56%)-0.02s (- 0.52%)4.53s4.64s
Emit Time3.24s (± 0.60%)3.25s (± 0.73%)+0.00s (+ 0.12%)3.18s3.29s
Total Time9.81s (± 0.50%)9.79s (± 0.39%)-0.02s (- 0.18%)9.73s9.89s
material-ui - node (v14.15.1, x64)
Memory used477,948k (± 0.01%)477,946k (± 0.00%)-2k (- 0.00%)477,909k477,981k
Parse Time2.06s (± 0.67%)2.05s (± 0.61%)-0.01s (- 0.39%)2.03s2.09s
Bind Time0.70s (± 0.74%)0.70s (± 0.80%)-0.00s (- 0.14%)0.69s0.71s
Check Time12.95s (± 0.62%)13.02s (± 0.54%)+0.07s (+ 0.56%)12.86s13.15s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time15.71s (± 0.55%)15.77s (± 0.48%)+0.06s (+ 0.40%)15.60s15.91s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-198-generic
Architecturex64
Available Memory16 GB
Available Memory5 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v10.16.3, x64)
  • node (v12.1.0, x64)
  • node (v14.15.1, x64)
Scenarios
  • Angular - node (v10.16.3, x64)
  • Angular - node (v12.1.0, x64)
  • Angular - node (v14.15.1, x64)
  • Compiler-Unions - node (v10.16.3, x64)
  • Compiler-Unions - node (v12.1.0, x64)
  • Compiler-Unions - node (v14.15.1, x64)
  • Monaco - node (v10.16.3, x64)
  • Monaco - node (v12.1.0, x64)
  • Monaco - node (v14.15.1, x64)
  • TFS - node (v10.16.3, x64)
  • TFS - node (v12.1.0, x64)
  • TFS - node (v14.15.1, x64)
  • material-ui - node (v10.16.3, x64)
  • material-ui - node (v12.1.0, x64)
  • material-ui - node (v14.15.1, x64)
BenchmarkNameIterations
Current4313110
Baselinemaster10

Developer Information:

Download Benchmark

@typescript-bot

Copy link
Copy Markdown
Contributor

Anders Hejlsberg (@ahejlsberg)
The results of the perf run you requested are in!

Here they are:

Comparison Report - master..43131

Metricmaster43131DeltaBestWorst
Angular - node (v14.15.1, x64)
Memory used324,915k (± 0.01%)324,804k (± 0.07%)-112k (- 0.03%)323,834k324,971k
Parse Time1.90s (± 0.72%)1.90s (± 0.50%)+0.00s (+ 0.16%)1.89s1.93s
Bind Time0.85s (± 1.17%)0.85s (± 0.99%)-0.00s (- 0.23%)0.84s0.88s
Check Time4.92s (± 0.32%)4.92s (± 0.65%)+0.01s (+ 0.14%)4.88s5.03s
Emit Time6.27s (± 0.54%)6.29s (± 0.74%)+0.02s (+ 0.29%)6.20s6.45s
Total Time13.95s (± 0.34%)13.97s (± 0.55%)+0.02s (+ 0.16%)13.84s14.25s
Compiler-Unions - node (v14.15.1, x64)
Memory used191,048k (± 0.02%)191,063k (± 0.02%)+15k (+ 0.01%)190,992k191,151k
Parse Time0.79s (± 0.43%)0.79s (± 0.60%)0.00s ( 0.00%)0.78s0.80s
Bind Time0.55s (± 0.67%)0.55s (± 0.73%)-0.00s (- 0.72%)0.54s0.56s
Check Time7.02s (± 0.88%)6.99s (± 0.52%)-0.03s (- 0.41%)6.93s7.07s
Emit Time2.54s (± 0.97%)2.53s (± 0.33%)-0.01s (- 0.47%)2.51s2.55s
Total Time10.90s (± 0.68%)10.86s (± 0.34%)-0.04s (- 0.40%)10.79s10.96s
Monaco - node (v14.15.1, x64)
Memory used338,052k (± 0.01%)338,058k (± 0.01%)+6k (+ 0.00%)338,008k338,111k
Parse Time1.56s (± 0.67%)1.55s (± 0.47%)-0.01s (- 0.70%)1.54s1.57s
Bind Time0.75s (± 1.03%)0.74s (± 0.66%)-0.01s (- 0.93%)0.74s0.76s
Check Time4.96s (± 0.63%)4.94s (± 0.42%)-0.03s (- 0.54%)4.90s4.98s
Emit Time3.16s (± 1.14%)3.15s (± 0.51%)-0.01s (- 0.44%)3.11s3.17s
Total Time10.43s (± 0.61%)10.38s (± 0.30%)-0.05s (- 0.53%)10.31s10.43s
TFS - node (v14.15.1, x64)
Memory used292,246k (± 0.01%)292,246k (± 0.01%)+0k (+ 0.00%)292,221k292,311k
Parse Time1.25s (± 1.10%)1.24s (± 0.89%)-0.01s (- 0.88%)1.22s1.27s
Bind Time0.72s (± 1.06%)0.71s (± 1.06%)-0.00s (- 0.28%)0.70s0.74s
Check Time4.59s (± 0.55%)4.57s (± 0.36%)-0.02s (- 0.48%)4.53s4.61s
Emit Time3.24s (± 0.60%)3.24s (± 0.61%)-0.01s (- 0.18%)3.20s3.30s
Total Time9.81s (± 0.50%)9.76s (± 0.25%)-0.05s (- 0.46%)9.72s9.82s
material-ui - node (v14.15.1, x64)
Memory used477,948k (± 0.01%)477,802k (± 0.06%)-146k (- 0.03%)476,684k477,966k
Parse Time2.06s (± 0.67%)2.06s (± 0.54%)-0.01s (- 0.24%)2.03s2.08s
Bind Time0.70s (± 0.74%)0.70s (± 0.83%)-0.00s (- 0.29%)0.69s0.71s
Check Time12.95s (± 0.62%)12.93s (± 0.72%)-0.01s (- 0.09%)12.82s13.18s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time15.71s (± 0.55%)15.69s (± 0.62%)-0.01s (- 0.10%)15.56s15.94s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-198-generic
Architecturex64
Available Memory16 GB
Available Memory5 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)
BenchmarkNameIterations
Current4313110
Baselinemaster10

Developer Information:

Download Benchmark

@typescript-bot

Copy link
Copy Markdown
Contributor

The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master.

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: TeamFor Milestone BugPRs that fix a bug with a specific milestone

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Missing narrowing of intersections involving type parameter and primitive types

3 participants

@ahejlsberg@typescript-bot@sandersn