Skip to content

Fix relations for instantiations of same generic signature - #31029

Closed
Anders Hejlsberg (ahejlsberg) wants to merge 13 commits into
masterfrom
fixGenericSignatureRelation
Closed

Fix relations for instantiations of same generic signature#31029
Anders Hejlsberg (ahejlsberg) wants to merge 13 commits into
masterfrom
fixGenericSignatureRelation

Conversation

@ahejlsberg

Copy link
Copy Markdown
Member

Fixes#31006.

@ahejlsberg

Copy link
Copy Markdown
MemberAuthor

TypeScript Bot (@typescript-bot) test this

@typescript-bot

TypeScript Bot (typescript-bot) commented Apr 19, 2019

Copy link
Copy Markdown
Contributor

Heya Anders Hejlsberg (@ahejlsberg), I've started to run the extended test suite on this PR at 78f54c5. You can monitor the build here. It should now contribute to this PR's status checks.

@ahejlsberg

Copy link
Copy Markdown
MemberAuthor

@typescript-bot

TypeScript Bot (typescript-bot) commented Apr 19, 2019

Copy link
Copy Markdown
Contributor

Heya Anders Hejlsberg (@ahejlsberg), I've started to run the parallelized Definitely Typed test suite on this PR at 78f54c5. You can monitor the build here. It should now contribute to this PR's status checks.

@RyanCavanaugh

Copy link
Copy Markdown
Member

RWC summary

One error elaboration change (possibly unrelated?)

A somewhat interesting example

interfaceAlpha<S>{foo<TextendsS>(s: T): any;}interfaceBetaextendsAlpha<"b">{}interfaceGammaextendsAlpha<"c">{}// Previously not an error// Now an error because of conflicting definitions of 'foo'interfaceDeltaextendsBeta,Gamma{}

This one is from TSLint:

exportfunctionancestorWhere<Textendsts.Node>(node: ts.Node,predicate: (n: ts.Node)=>n is T): T|undefined;exportfunctionancestorWhere(node: ts.Node,predicate: (n: ts.Node)=>boolean): ts.Node|undefined;~~~~~~~~~~~~~!!!errorTS2394: Thisoverloadsignatureisnotcompatiblewithitsimplementationsignature.!!!relatedTS2750language/utils.ts:98:17: Theimplementationsignature is declaredhere.exportfunctionancestorWhere<Textendsts.Node>(node: ts.Node,predicate: (n: ts.Node)=>n is T): T|undefined{

@jack-williams

Jack Williams (jack-williams) commented Apr 19, 2019

Copy link
Copy Markdown
Collaborator

Does this also fix #30988?

EDIT: No

@ahejlsberg

Copy link
Copy Markdown
MemberAuthor

@typescript-bot

TypeScript Bot (typescript-bot) commented Apr 21, 2019

Copy link
Copy Markdown
Contributor

Heya Anders Hejlsberg (@ahejlsberg), I've started to run the parallelized Definitely Typed test suite on this PR at df50477. You can monitor the build here. It should now contribute to this PR's status checks.

@ahejlsberg

Copy link
Copy Markdown
MemberAuthor

@typescript-bot

TypeScript Bot (typescript-bot) commented Apr 21, 2019

Copy link
Copy Markdown
Contributor

Heya Anders Hejlsberg (@ahejlsberg), I've started to run the parallelized Definitely Typed test suite on this PR at df50477. You can monitor the build here. It should now contribute to this PR's status checks.

@ahejlsberg

Copy link
Copy Markdown
MemberAuthor

TypeScript Bot (@typescript-bot) test this

@typescript-bot

TypeScript Bot (typescript-bot) commented Apr 21, 2019

Copy link
Copy Markdown
Contributor

Heya Anders Hejlsberg (@ahejlsberg), I've started to run the extended test suite on this PR at 39c263b. You can monitor the build here. It should now contribute to this PR's status checks.

@ahejlsberg

Copy link
Copy Markdown
MemberAuthor

TypeScript Bot (@typescript-bot) run dt slower

@typescript-bot

TypeScript Bot (typescript-bot) commented Apr 21, 2019

Copy link
Copy Markdown
Contributor

Heya Anders Hejlsberg (@ahejlsberg), I've started to run the Definitely Typed test suite on this PR at 39c263b. You can monitor the build here. It should now contribute to this PR's status checks.

@ahejlsberg

Copy link
Copy Markdown
MemberAuthor

Wesley Wigham (@weswigham) Looks like the DT test runner has an issue. The last three runs above all failed with OOM errors towards the end, but not in a consistent spot.

@weswigham

Copy link
Copy Markdown
Member

Even the "slower" runner is still running DT in multiple threads in parallel on a single container, so the output log order isn't strictly deterministic. Since in the container-sharded run only one shard runs OOM I'd wager a specific package is running OOM - Nathan Shively-Sanders (@sandersn) do you know if we can get better logging so we know which?

@ahejlsberg

Copy link
Copy Markdown
MemberAuthor

The RWC tests now look good. One insignificant change in an error elaboration and one new error related to multiple inherited methods. Since we've always had a rule that multiple inherited methods must be identical I think the new error is fine. The methods aren't identical, we just failed to detect it before.

There are two issues in Ember that are uncovered by the stricter checking. One is in ember/v2Observable.addObserver and Observable.removeObserver, both of which use keyof this and their Target type parameter in both co- and contra-variant positions. We didn't detect it before because Target was erased to any during checking. Another is use of the non-distributive Pick type in various getter and setter methods in Observable. Both are relatively easy to fix.

Even with fixes, I did notice that ember__array jumps from about 4 seconds to about 9 seconds of check time. It's directly related to Observable's use of keyof this in many places. It generates large union types that sometimes are turned into large intersection types (in contra-variant positions).

Also, we need to figure out what the OOM error in the DT runs is about.

@sandersn

Copy link
Copy Markdown
Member

Wesley Wigham (@weswigham) are you starting dtslint-runner with 4GB of max old space? The nightly run does that, so that may already be true.

Ron Buckton (@rbuckton) improved types-publisher’s parallel runner to report oom failures correctly on Friday. Probably the right thing to do is port that code to dtslint-runner.

Anders Hejlsberg (@ahejlsberg) I believe you can run dtslint-runner with a local typescript and only one thread, so you can that as a workaround for now.

@softagram-bot

This comment has been minimized.

@weswigham

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) run dt since now it should log what's running OOM.

@typescript-bot

TypeScript Bot (typescript-bot) commented Apr 24, 2019

Copy link
Copy Markdown
Contributor

Heya Wesley Wigham (@weswigham), I've started to run the parallelized Definitely Typed test suite on this PR at c2b79df. You can monitor the build here. It should now contribute to this PR's status checks.

@sandersn

Nathan Shively-Sanders (sandersn) commented Apr 24, 2019

Copy link
Copy Markdown
Member

strophe is still running out of memory
Edit: Nope, it was styled-components/v3

@sandersn

Copy link
Copy Markdown
Member

I think this looks good as long as it no longer breaks DT. I'll merge from master and re-run.

@sandersn

Copy link
Copy Markdown
Member

Unfortunately when I merge from master, another test is now broken, bestChoiceType. I may have made a mistake trying to convert the callbackCheck usage to checkMode. Anders Hejlsberg (@ahejlsberg) can you try merging from master and see if you run into the same problem?

# Conflicts:
#	src/compiler/checker.ts
#	tests/baselines/reference/keyofAndIndexedAccess2.errors.txt
#	tests/baselines/reference/keyofAndIndexedAccess2.symbols
@ahejlsberg

Copy link
Copy Markdown
MemberAuthor

@typescript-bot

TypeScript Bot (typescript-bot) commented Mar 7, 2020

Copy link
Copy Markdown
Contributor

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

@typescript-bot

TypeScript Bot (typescript-bot) commented Mar 7, 2020

Copy link
Copy Markdown
Contributor

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

@typescript-bot

TypeScript Bot (typescript-bot) commented Mar 7, 2020

Copy link
Copy Markdown
Contributor

Heya Anders Hejlsberg (@ahejlsberg), I've started to run the perf test suite on this PR at e262f49. 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..31029

Metricmaster31029DeltaBestWorst
Angular - node (v10.16.3, x64)
Memory used334,430k (± 0.02%)333,942k (± 0.02%)-488k (- 0.15%)333,826k334,043k
Parse Time1.63s (± 0.37%)1.63s (± 0.42%)+0.00s (+ 0.06%)1.61s1.64s
Bind Time0.90s (± 0.92%)0.89s (± 0.91%)-0.00s (- 0.33%)0.88s0.91s
Check Time4.72s (± 0.61%)4.72s (± 0.46%)+0.00s (+ 0.08%)4.67s4.77s
Emit Time5.28s (± 0.67%)5.30s (± 0.44%)+0.01s (+ 0.23%)5.25s5.37s
Total Time12.52s (± 0.48%)12.54s (± 0.36%)+0.02s (+ 0.13%)12.44s12.65s
Monaco - node (v10.16.3, x64)
Memory used335,336k (± 0.02%)335,394k (± 0.02%)+58k (+ 0.02%)335,304k335,532k
Parse Time1.26s (± 0.58%)1.25s (± 0.60%)-0.00s (- 0.32%)1.24s1.27s
Bind Time0.78s (± 0.61%)0.78s (± 0.48%)-0.00s (- 0.26%)0.77s0.78s
Check Time4.73s (± 0.56%)4.70s (± 0.47%)-0.03s (- 0.70%)4.64s4.75s
Emit Time2.92s (± 0.93%)2.93s (± 1.01%)+0.01s (+ 0.24%)2.89s3.02s
Total Time9.69s (± 0.48%)9.66s (± 0.38%)-0.03s (- 0.35%)9.59s9.74s
TFS - node (v10.16.3, x64)
Memory used299,533k (± 0.02%)299,491k (± 0.02%)-42k (- 0.01%)299,324k299,620k
Parse Time0.95s (± 0.59%)0.94s (± 0.50%)-0.00s (- 0.53%)0.93s0.95s
Bind Time0.75s (± 0.77%)0.75s (± 0.67%)-0.00s (- 0.67%)0.73s0.75s
Check Time4.25s (± 0.59%)4.24s (± 0.53%)-0.01s (- 0.19%)4.20s4.29s
Emit Time3.04s (± 0.62%)3.05s (± 0.63%)+0.01s (+ 0.33%)3.01s3.10s
Total Time8.99s (± 0.40%)8.98s (± 0.31%)-0.01s (- 0.06%)8.93s9.04s
material-ui - node (v10.16.3, x64)
Memory used489,098k (± 0.01%)488,879k (± 0.02%)-219k (- 0.04%)488,583k489,012k
Parse Time1.78s (± 0.50%)1.78s (± 0.38%)-0.00s (- 0.06%)1.76s1.79s
Bind Time0.69s (± 0.53%)0.68s (± 1.09%)-0.00s (- 0.44%)0.66s0.70s
Check Time13.51s (± 0.82%)13.63s (± 0.75%)+0.12s (+ 0.90%)13.45s13.87s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time15.98s (± 0.71%)16.09s (± 0.65%)+0.12s (+ 0.73%)15.89s16.34s
Angular - node (v12.1.0, x64)
Memory used310,183k (± 0.03%)309,652k (± 0.06%)-531k (- 0.17%)308,971k309,967k
Parse Time1.58s (± 0.42%)1.58s (± 0.87%)-0.00s (- 0.00%)1.55s1.60s
Bind Time0.87s (± 0.81%)0.87s (± 1.04%)+0.00s (+ 0.23%)0.85s0.89s
Check Time4.62s (± 0.52%)4.63s (± 0.92%)+0.01s (+ 0.26%)4.57s4.78s
Emit Time5.50s (± 1.59%)5.46s (± 0.95%)-0.04s (- 0.75%)5.38s5.62s
Total Time12.57s (± 0.71%)12.54s (± 0.63%)-0.03s (- 0.22%)12.38s12.77s
Monaco - node (v12.1.0, x64)
Memory used315,221k (± 0.02%)315,262k (± 0.02%)+41k (+ 0.01%)315,054k315,361k
Parse Time1.21s (± 0.62%)1.21s (± 0.87%)-0.00s (- 0.08%)1.19s1.23s
Bind Time0.74s (± 0.90%)0.74s (± 0.75%)-0.01s (- 0.67%)0.73s0.75s
Check Time4.55s (± 0.55%)4.56s (± 0.68%)+0.02s (+ 0.35%)4.47s4.64s
Emit Time2.95s (± 1.09%)2.95s (± 0.66%)+0.01s (+ 0.20%)2.92s3.00s
Total Time9.45s (± 0.47%)9.47s (± 0.49%)+0.02s (+ 0.17%)9.32s9.56s
TFS - node (v12.1.0, x64)
Memory used281,810k (± 0.03%)281,743k (± 0.02%)-67k (- 0.02%)281,571k281,869k
Parse Time0.93s (± 0.89%)0.93s (± 0.48%)-0.01s (- 0.64%)0.92s0.94s
Bind Time0.70s (± 1.16%)0.71s (± 0.52%)+0.00s (+ 0.43%)0.70s0.71s
Check Time4.19s (± 0.59%)4.19s (± 0.44%)-0.00s (- 0.02%)4.16s4.24s
Emit Time3.08s (± 0.80%)3.08s (± 0.68%)0.00s ( 0.00%)3.04s3.13s
Total Time8.90s (± 0.62%)8.90s (± 0.28%)-0.00s (- 0.00%)8.84s8.95s
material-ui - node (v12.1.0, x64)
Memory used466,467k (± 0.01%)466,106k (± 0.06%)-361k (- 0.08%)465,372k466,451k
Parse Time1.76s (± 0.53%)1.76s (± 0.63%)+0.00s (+ 0.06%)1.74s1.79s
Bind Time0.63s (± 1.11%)0.62s (± 1.17%)-0.01s (- 1.11%)0.61s0.64s
Check Time12.06s (± 0.76%)12.12s (± 0.80%)+0.06s (+ 0.51%)11.96s12.35s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time14.45s (± 0.67%)14.51s (± 0.70%)+0.06s (+ 0.38%)14.34s14.75s
Angular - node (v8.9.0, x64)
Memory used329,420k (± 0.02%)329,059k (± 0.01%)-361k (- 0.11%)328,991k329,170k
Parse Time2.11s (± 0.26%)2.11s (± 0.42%)-0.00s (- 0.09%)2.09s2.13s
Bind Time0.92s (± 0.76%)0.92s (± 0.94%)+0.00s (+ 0.33%)0.90s0.94s
Check Time5.47s (± 0.49%)5.55s (± 0.66%)+0.08s (+ 1.46%)5.50s5.65s
Emit Time6.21s (± 0.69%)6.28s (± 1.37%)+0.07s (+ 1.18%)6.01s6.43s
Total Time14.72s (± 0.37%)14.87s (± 0.45%)+0.15s (+ 1.04%)14.73s15.02s
Monaco - node (v8.9.0, x64)
Memory used333,603k (± 0.01%)333,609k (± 0.02%)+6k (+ 0.00%)333,460k333,755k
Parse Time1.54s (± 0.40%)1.54s (± 0.54%)+0.01s (+ 0.39%)1.53s1.57s
Bind Time0.91s (± 1.00%)0.91s (± 1.34%)-0.00s (- 0.44%)0.89s0.94s
Check Time5.40s (± 0.48%)5.40s (± 0.38%)-0.01s (- 0.11%)5.35s5.45s
Emit Time3.52s (± 0.50%)3.52s (± 0.29%)-0.00s (- 0.06%)3.50s3.55s
Total Time11.37s (± 0.35%)11.37s (± 0.16%)-0.01s (- 0.05%)11.33s11.43s
TFS - node (v8.9.0, x64)
Memory used298,929k (± 0.01%)298,947k (± 0.02%)+19k (+ 0.01%)298,853k299,036k
Parse Time1.25s (± 0.49%)1.25s (± 0.49%)0.00s ( 0.00%)1.24s1.26s
Bind Time0.75s (± 0.90%)0.75s (± 0.74%)-0.00s (- 0.27%)0.74s0.76s
Check Time4.91s (± 1.83%)4.85s (± 1.72%)-0.06s (- 1.18%)4.73s5.13s
Emit Time3.28s (± 2.78%)3.34s (± 2.28%)+0.06s (+ 1.83%)3.07s3.48s
Total Time10.19s (± 0.36%)10.20s (± 0.50%)+0.01s (+ 0.08%)10.10s10.31s
material-ui - node (v8.9.0, x64)
Memory used494,854k (± 0.01%)494,823k (± 0.01%)-31k (- 0.01%)494,718k494,936k
Parse Time2.10s (± 0.35%)2.12s (± 1.10%)+0.01s (+ 0.67%)2.08s2.20s
Bind Time0.81s (± 0.83%)0.81s (± 0.99%)+0.00s (+ 0.12%)0.79s0.82s
Check Time19.50s (± 0.81%)19.66s (± 0.74%)+0.16s (+ 0.82%)19.27s19.95s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time22.40s (± 0.74%)22.58s (± 0.71%)+0.17s (+ 0.77%)22.19s22.89s
Angular - node (v8.9.0, x86)
Memory used188,980k (± 0.02%)188,745k (± 0.03%)-235k (- 0.12%)188,593k188,855k
Parse Time2.06s (± 0.50%)2.05s (± 0.63%)-0.01s (- 0.58%)2.02s2.08s
Bind Time1.08s (± 0.64%)1.07s (± 1.03%)-0.00s (- 0.47%)1.06s1.11s
Check Time5.04s (± 0.55%)5.04s (± 0.56%)+0.00s (+ 0.06%)5.00s5.12s
Emit Time6.17s (± 0.89%)6.11s (± 0.41%)-0.05s (- 0.86%)6.07s6.20s
Total Time14.35s (± 0.49%)14.28s (± 0.41%)-0.07s (- 0.49%)14.19s14.49s
Monaco - node (v8.9.0, x86)
Memory used189,247k (± 0.01%)189,250k (± 0.03%)+3k (+ 0.00%)189,073k189,313k
Parse Time1.59s (± 0.92%)1.59s (± 0.51%)-0.00s (- 0.13%)1.57s1.60s
Bind Time0.76s (± 0.68%)0.77s (± 1.52%)+0.01s (+ 1.31%)0.76s0.81s
Check Time5.30s (± 1.62%)5.22s (± 1.15%)-0.07s (- 1.40%)5.13s5.39s
Emit Time3.05s (± 3.43%)3.14s (± 2.79%)+0.09s (+ 2.85%)2.84s3.28s
Total Time10.70s (± 0.37%)10.72s (± 0.55%)+0.02s (+ 0.16%)10.59s10.90s
TFS - node (v8.9.0, x86)
Memory used170,470k (± 0.02%)170,463k (± 0.02%)-7k (- 0.00%)170,370k170,553k
Parse Time1.29s (± 1.40%)1.28s (± 0.39%)-0.01s (- 0.70%)1.27s1.29s
Bind Time0.71s (± 0.56%)0.71s (± 0.48%)+0.00s (+ 0.56%)0.71s0.72s
Check Time4.58s (± 0.57%)4.62s (± 0.57%)+0.04s (+ 0.90%)4.55s4.67s
Emit Time3.01s (± 2.38%)2.95s (± 1.05%)-0.06s (- 1.86%)2.89s3.01s
Total Time9.58s (± 0.91%)9.57s (± 0.48%)-0.02s (- 0.19%)9.47s9.66s
material-ui - node (v8.9.0, x86)
Memory used277,292k (± 0.01%)277,231k (± 0.01%)-61k (- 0.02%)277,139k277,331k
Parse Time2.18s (± 0.61%)2.17s (± 0.39%)-0.01s (- 0.50%)2.15s2.19s
Bind Time0.68s (± 0.91%)0.69s (± 1.70%)+0.01s (+ 1.17%)0.66s0.71s
Check Time17.67s (± 0.71%)17.58s (± 0.52%)-0.09s (- 0.50%)17.43s17.84s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time20.54s (± 0.62%)20.44s (± 0.47%)-0.09s (- 0.46%)20.28s20.72s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-166-generic
Architecturex64
Available Memory16 GB
Available Memory1 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v10.16.3, x64)
  • node (v12.1.0, x64)
  • node (v8.9.0, x64)
  • node (v8.9.0, x86)
Scenarios
  • Angular - node (v10.16.3, x64)
  • Angular - node (v12.1.0, x64)
  • Angular - node (v8.9.0, x64)
  • Angular - node (v8.9.0, x86)
  • Monaco - node (v10.16.3, x64)
  • Monaco - node (v12.1.0, x64)
  • Monaco - node (v8.9.0, x64)
  • Monaco - node (v8.9.0, x86)
  • TFS - node (v10.16.3, x64)
  • TFS - node (v12.1.0, x64)
  • TFS - node (v8.9.0, x64)
  • TFS - node (v8.9.0, x86)
  • material-ui - node (v10.16.3, x64)
  • material-ui - node (v12.1.0, x64)
  • material-ui - node (v8.9.0, x64)
  • material-ui - node (v8.9.0, x86)
BenchmarkNameIterations
Current3102910
Baselinemaster10

@sandersn

Copy link
Copy Markdown
Member

Anders Hejlsberg (@ahejlsberg) unfortunately, this now needs another merge from master

@sandersn

Copy link
Copy Markdown
Member

In the design meeting, we decided to see whether it makes sense to put this under strictFunctionTypes, or some other strict flag -- possibly a new one.

@sandersn

Copy link
Copy Markdown
Member

Anders Hejlsberg (@ahejlsberg) Is it worthwhile to keep working on this fix? It's been inactive for 6 months now.

@sandersn

Copy link
Copy Markdown
Member

This PR hasn't seen any activity for quite a while, so I'm going to close it to keep the number of open PRs manageable.

@microsoftMicrosoft (microsoft) locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Milestone BugPRs that fix a bug with a specific milestone

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Generic type alias produces erroneously compatible types

8 participants

@ahejlsberg@typescript-bot@RyanCavanaugh@jack-williams@weswigham@sandersn@softagram-bot@DanielRosenwasser