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 relations for instantiations of same generic signature #31029

Closed
wants to merge 13 commits into from

Conversation

ahejlsberg
Copy link
Member

Fixes #31006.

@ahejlsberg
Copy link
Member Author

@typescript-bot test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 19, 2019

Heya @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
Member Author

@typescript-bot run dt

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 19, 2019

Heya @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
Member

RWC summary

One error elaboration change (possibly unrelated?)

A somewhat interesting example

interface Alpha<S> {
    foo<T extends S>(s: T): any;
}

interface Beta extends Alpha<"b"> { }
interface Gamma extends Alpha<"c"> { }

// Previously not an error
// Now an error because of conflicting definitions of 'foo'
interface Delta extends Beta, Gamma { }

This one is from TSLint:

    export function ancestorWhere<T extends ts.Node>(node: ts.Node, predicate: (n: ts.Node) => n is T): T | undefined;
    export function ancestorWhere(node: ts.Node, predicate: (n: ts.Node) => boolean): ts.Node | undefined;
                    ~~~~~~~~~~~~~
!!! error TS2394: This overload signature is not compatible with its implementation signature.
!!! related TS2750 language/utils.ts:98:17: The implementation signature is declared here.
    export function ancestorWhere<T extends ts.Node>(node: ts.Node, predicate: (n: ts.Node) => n is T): T | undefined {

@jack-williams
Copy link
Collaborator

jack-williams commented Apr 19, 2019

Does this also fix #30988?

EDIT: No

@ahejlsberg
Copy link
Member Author

@typescript-bot run dt

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 21, 2019

Heya @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
Member Author

@typescript-bot run dt

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 21, 2019

Heya @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
Member Author

@typescript-bot test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 21, 2019

Heya @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
Member Author

@typescript-bot run dt slower

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 21, 2019

Heya @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
Member Author

@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
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 - @sandersn do you know if we can get better logging so we know which?

@ahejlsberg
Copy link
Member Author

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/v2 Observable.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
Member

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

@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.

@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
Member

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 24, 2019

Heya @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
Copy link
Member

sandersn commented Apr 24, 2019

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

@sandersn sandersn added the For Milestone Bug PRs that fix a bug with a specific milestone label Feb 1, 2020
@sandersn
Copy link
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
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. @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
Member Author

@typescript-bot test this
@typescript-bot run dt
@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 7, 2020

Heya @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
Copy link
Collaborator

typescript-bot commented Mar 7, 2020

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 7, 2020

Heya @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
Collaborator

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

Here they are:

Comparison Report - master..31029

Metric master 31029 Delta Best Worst
Angular - node (v10.16.3, x64)
Memory used 334,430k (± 0.02%) 333,942k (± 0.02%) -488k (- 0.15%) 333,826k 334,043k
Parse Time 1.63s (± 0.37%) 1.63s (± 0.42%) +0.00s (+ 0.06%) 1.61s 1.64s
Bind Time 0.90s (± 0.92%) 0.89s (± 0.91%) -0.00s (- 0.33%) 0.88s 0.91s
Check Time 4.72s (± 0.61%) 4.72s (± 0.46%) +0.00s (+ 0.08%) 4.67s 4.77s
Emit Time 5.28s (± 0.67%) 5.30s (± 0.44%) +0.01s (+ 0.23%) 5.25s 5.37s
Total Time 12.52s (± 0.48%) 12.54s (± 0.36%) +0.02s (+ 0.13%) 12.44s 12.65s
Monaco - node (v10.16.3, x64)
Memory used 335,336k (± 0.02%) 335,394k (± 0.02%) +58k (+ 0.02%) 335,304k 335,532k
Parse Time 1.26s (± 0.58%) 1.25s (± 0.60%) -0.00s (- 0.32%) 1.24s 1.27s
Bind Time 0.78s (± 0.61%) 0.78s (± 0.48%) -0.00s (- 0.26%) 0.77s 0.78s
Check Time 4.73s (± 0.56%) 4.70s (± 0.47%) -0.03s (- 0.70%) 4.64s 4.75s
Emit Time 2.92s (± 0.93%) 2.93s (± 1.01%) +0.01s (+ 0.24%) 2.89s 3.02s
Total Time 9.69s (± 0.48%) 9.66s (± 0.38%) -0.03s (- 0.35%) 9.59s 9.74s
TFS - node (v10.16.3, x64)
Memory used 299,533k (± 0.02%) 299,491k (± 0.02%) -42k (- 0.01%) 299,324k 299,620k
Parse Time 0.95s (± 0.59%) 0.94s (± 0.50%) -0.00s (- 0.53%) 0.93s 0.95s
Bind Time 0.75s (± 0.77%) 0.75s (± 0.67%) -0.00s (- 0.67%) 0.73s 0.75s
Check Time 4.25s (± 0.59%) 4.24s (± 0.53%) -0.01s (- 0.19%) 4.20s 4.29s
Emit Time 3.04s (± 0.62%) 3.05s (± 0.63%) +0.01s (+ 0.33%) 3.01s 3.10s
Total Time 8.99s (± 0.40%) 8.98s (± 0.31%) -0.01s (- 0.06%) 8.93s 9.04s
material-ui - node (v10.16.3, x64)
Memory used 489,098k (± 0.01%) 488,879k (± 0.02%) -219k (- 0.04%) 488,583k 489,012k
Parse Time 1.78s (± 0.50%) 1.78s (± 0.38%) -0.00s (- 0.06%) 1.76s 1.79s
Bind Time 0.69s (± 0.53%) 0.68s (± 1.09%) -0.00s (- 0.44%) 0.66s 0.70s
Check Time 13.51s (± 0.82%) 13.63s (± 0.75%) +0.12s (+ 0.90%) 13.45s 13.87s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 15.98s (± 0.71%) 16.09s (± 0.65%) +0.12s (+ 0.73%) 15.89s 16.34s
Angular - node (v12.1.0, x64)
Memory used 310,183k (± 0.03%) 309,652k (± 0.06%) -531k (- 0.17%) 308,971k 309,967k
Parse Time 1.58s (± 0.42%) 1.58s (± 0.87%) -0.00s (- 0.00%) 1.55s 1.60s
Bind Time 0.87s (± 0.81%) 0.87s (± 1.04%) +0.00s (+ 0.23%) 0.85s 0.89s
Check Time 4.62s (± 0.52%) 4.63s (± 0.92%) +0.01s (+ 0.26%) 4.57s 4.78s
Emit Time 5.50s (± 1.59%) 5.46s (± 0.95%) -0.04s (- 0.75%) 5.38s 5.62s
Total Time 12.57s (± 0.71%) 12.54s (± 0.63%) -0.03s (- 0.22%) 12.38s 12.77s
Monaco - node (v12.1.0, x64)
Memory used 315,221k (± 0.02%) 315,262k (± 0.02%) +41k (+ 0.01%) 315,054k 315,361k
Parse Time 1.21s (± 0.62%) 1.21s (± 0.87%) -0.00s (- 0.08%) 1.19s 1.23s
Bind Time 0.74s (± 0.90%) 0.74s (± 0.75%) -0.01s (- 0.67%) 0.73s 0.75s
Check Time 4.55s (± 0.55%) 4.56s (± 0.68%) +0.02s (+ 0.35%) 4.47s 4.64s
Emit Time 2.95s (± 1.09%) 2.95s (± 0.66%) +0.01s (+ 0.20%) 2.92s 3.00s
Total Time 9.45s (± 0.47%) 9.47s (± 0.49%) +0.02s (+ 0.17%) 9.32s 9.56s
TFS - node (v12.1.0, x64)
Memory used 281,810k (± 0.03%) 281,743k (± 0.02%) -67k (- 0.02%) 281,571k 281,869k
Parse Time 0.93s (± 0.89%) 0.93s (± 0.48%) -0.01s (- 0.64%) 0.92s 0.94s
Bind Time 0.70s (± 1.16%) 0.71s (± 0.52%) +0.00s (+ 0.43%) 0.70s 0.71s
Check Time 4.19s (± 0.59%) 4.19s (± 0.44%) -0.00s (- 0.02%) 4.16s 4.24s
Emit Time 3.08s (± 0.80%) 3.08s (± 0.68%) 0.00s ( 0.00%) 3.04s 3.13s
Total Time 8.90s (± 0.62%) 8.90s (± 0.28%) -0.00s (- 0.00%) 8.84s 8.95s
material-ui - node (v12.1.0, x64)
Memory used 466,467k (± 0.01%) 466,106k (± 0.06%) -361k (- 0.08%) 465,372k 466,451k
Parse Time 1.76s (± 0.53%) 1.76s (± 0.63%) +0.00s (+ 0.06%) 1.74s 1.79s
Bind Time 0.63s (± 1.11%) 0.62s (± 1.17%) -0.01s (- 1.11%) 0.61s 0.64s
Check Time 12.06s (± 0.76%) 12.12s (± 0.80%) +0.06s (+ 0.51%) 11.96s 12.35s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 14.45s (± 0.67%) 14.51s (± 0.70%) +0.06s (+ 0.38%) 14.34s 14.75s
Angular - node (v8.9.0, x64)
Memory used 329,420k (± 0.02%) 329,059k (± 0.01%) -361k (- 0.11%) 328,991k 329,170k
Parse Time 2.11s (± 0.26%) 2.11s (± 0.42%) -0.00s (- 0.09%) 2.09s 2.13s
Bind Time 0.92s (± 0.76%) 0.92s (± 0.94%) +0.00s (+ 0.33%) 0.90s 0.94s
Check Time 5.47s (± 0.49%) 5.55s (± 0.66%) +0.08s (+ 1.46%) 5.50s 5.65s
Emit Time 6.21s (± 0.69%) 6.28s (± 1.37%) +0.07s (+ 1.18%) 6.01s 6.43s
Total Time 14.72s (± 0.37%) 14.87s (± 0.45%) +0.15s (+ 1.04%) 14.73s 15.02s
Monaco - node (v8.9.0, x64)
Memory used 333,603k (± 0.01%) 333,609k (± 0.02%) +6k (+ 0.00%) 333,460k 333,755k
Parse Time 1.54s (± 0.40%) 1.54s (± 0.54%) +0.01s (+ 0.39%) 1.53s 1.57s
Bind Time 0.91s (± 1.00%) 0.91s (± 1.34%) -0.00s (- 0.44%) 0.89s 0.94s
Check Time 5.40s (± 0.48%) 5.40s (± 0.38%) -0.01s (- 0.11%) 5.35s 5.45s
Emit Time 3.52s (± 0.50%) 3.52s (± 0.29%) -0.00s (- 0.06%) 3.50s 3.55s
Total Time 11.37s (± 0.35%) 11.37s (± 0.16%) -0.01s (- 0.05%) 11.33s 11.43s
TFS - node (v8.9.0, x64)
Memory used 298,929k (± 0.01%) 298,947k (± 0.02%) +19k (+ 0.01%) 298,853k 299,036k
Parse Time 1.25s (± 0.49%) 1.25s (± 0.49%) 0.00s ( 0.00%) 1.24s 1.26s
Bind Time 0.75s (± 0.90%) 0.75s (± 0.74%) -0.00s (- 0.27%) 0.74s 0.76s
Check Time 4.91s (± 1.83%) 4.85s (± 1.72%) -0.06s (- 1.18%) 4.73s 5.13s
Emit Time 3.28s (± 2.78%) 3.34s (± 2.28%) +0.06s (+ 1.83%) 3.07s 3.48s
Total Time 10.19s (± 0.36%) 10.20s (± 0.50%) +0.01s (+ 0.08%) 10.10s 10.31s
material-ui - node (v8.9.0, x64)
Memory used 494,854k (± 0.01%) 494,823k (± 0.01%) -31k (- 0.01%) 494,718k 494,936k
Parse Time 2.10s (± 0.35%) 2.12s (± 1.10%) +0.01s (+ 0.67%) 2.08s 2.20s
Bind Time 0.81s (± 0.83%) 0.81s (± 0.99%) +0.00s (+ 0.12%) 0.79s 0.82s
Check Time 19.50s (± 0.81%) 19.66s (± 0.74%) +0.16s (+ 0.82%) 19.27s 19.95s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 22.40s (± 0.74%) 22.58s (± 0.71%) +0.17s (+ 0.77%) 22.19s 22.89s
Angular - node (v8.9.0, x86)
Memory used 188,980k (± 0.02%) 188,745k (± 0.03%) -235k (- 0.12%) 188,593k 188,855k
Parse Time 2.06s (± 0.50%) 2.05s (± 0.63%) -0.01s (- 0.58%) 2.02s 2.08s
Bind Time 1.08s (± 0.64%) 1.07s (± 1.03%) -0.00s (- 0.47%) 1.06s 1.11s
Check Time 5.04s (± 0.55%) 5.04s (± 0.56%) +0.00s (+ 0.06%) 5.00s 5.12s
Emit Time 6.17s (± 0.89%) 6.11s (± 0.41%) -0.05s (- 0.86%) 6.07s 6.20s
Total Time 14.35s (± 0.49%) 14.28s (± 0.41%) -0.07s (- 0.49%) 14.19s 14.49s
Monaco - node (v8.9.0, x86)
Memory used 189,247k (± 0.01%) 189,250k (± 0.03%) +3k (+ 0.00%) 189,073k 189,313k
Parse Time 1.59s (± 0.92%) 1.59s (± 0.51%) -0.00s (- 0.13%) 1.57s 1.60s
Bind Time 0.76s (± 0.68%) 0.77s (± 1.52%) +0.01s (+ 1.31%) 0.76s 0.81s
Check Time 5.30s (± 1.62%) 5.22s (± 1.15%) -0.07s (- 1.40%) 5.13s 5.39s
Emit Time 3.05s (± 3.43%) 3.14s (± 2.79%) +0.09s (+ 2.85%) 2.84s 3.28s
Total Time 10.70s (± 0.37%) 10.72s (± 0.55%) +0.02s (+ 0.16%) 10.59s 10.90s
TFS - node (v8.9.0, x86)
Memory used 170,470k (± 0.02%) 170,463k (± 0.02%) -7k (- 0.00%) 170,370k 170,553k
Parse Time 1.29s (± 1.40%) 1.28s (± 0.39%) -0.01s (- 0.70%) 1.27s 1.29s
Bind Time 0.71s (± 0.56%) 0.71s (± 0.48%) +0.00s (+ 0.56%) 0.71s 0.72s
Check Time 4.58s (± 0.57%) 4.62s (± 0.57%) +0.04s (+ 0.90%) 4.55s 4.67s
Emit Time 3.01s (± 2.38%) 2.95s (± 1.05%) -0.06s (- 1.86%) 2.89s 3.01s
Total Time 9.58s (± 0.91%) 9.57s (± 0.48%) -0.02s (- 0.19%) 9.47s 9.66s
material-ui - node (v8.9.0, x86)
Memory used 277,292k (± 0.01%) 277,231k (± 0.01%) -61k (- 0.02%) 277,139k 277,331k
Parse Time 2.18s (± 0.61%) 2.17s (± 0.39%) -0.01s (- 0.50%) 2.15s 2.19s
Bind Time 0.68s (± 0.91%) 0.69s (± 1.70%) +0.01s (+ 1.17%) 0.66s 0.71s
Check Time 17.67s (± 0.71%) 17.58s (± 0.52%) -0.09s (- 0.50%) 17.43s 17.84s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 20.54s (± 0.62%) 20.44s (± 0.47%) -0.09s (- 0.46%) 20.28s 20.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)
Benchmark Name Iterations
Current 31029 10
Baseline master 10

@sandersn
Copy link
Member

@ahejlsberg unfortunately, this now needs another merge from master

@sandersn
Copy link
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
Member

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

@sandersn
Copy link
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.

@sandersn sandersn closed this Mar 11, 2021
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
Archived in project
Development

Successfully merging this pull request may close these issues.

Generic type alias produces erroneously compatible types
8 participants