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

Add isIntersectionConstituent to relation key #34789

Merged
merged 4 commits into from Oct 29, 2019

Conversation

sandersn
Copy link
Member

@sandersn sandersn commented Oct 28, 2019

isIntersectionConstituent controls whether relation checking performs excess property and common property checks. It is possible to fail a relation check with excess property checks turned on, cache the result, and then skip a relation check with excess property checks that would have succeeded. #33133 provides an example of such a program.

Fixes #33133 the right way, so I reverted the fix at #33213
Fixes #34762 (by reverting #33213)
Fixes #33944 -- I added the test from #34646

@weswigham and I considered adding one or two new relations for excess property and common property checks, respectively, since excess property checks are almost as strict as the identity relation, and common property checks are less strict than the subtype relation. But this seems likely to result is a big fix.

Given the number of problems we've had with intersections and excess/common property checks, I think we should ship this fix eventually. I'm not sure if 3.7.x is the right time. We did ship #33213 in 3.6.4, however. My initial feeling is to vote for shipping in 3.7.2.

isIntersectionConstituent controls whether relation checking performs
excess property and common property checks. It is possible to fail a
relation check with excess property checks turned on, cache the result,
and then skip a relation check with excess property checks that would
have succeeded. #33133 provides an example of such a program.

Fixes #33133 the right way, so I reverted the fix at #33213
Fixes #34762 (by reverting #33213)
Fixes #33944 -- I added the test from #34646
@sandersn
Copy link
Member Author

@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Oct 28, 2019

Heya @sandersn, I've started to run the perf test suite on this PR at 2e0b451. You can monitor the build here. It should now contribute to this PR's status checks.

Update: The results are in!


==== tests/cases/conformance/types/intersection/commonTypeIntersection.ts (2 errors) ====
declare let x1: { __typename?: 'TypeTwo' } & { a: boolean };
let y1: { __typename?: 'TypeOne' } & { a: boolean} = x1; // No error!
Copy link
Member

Choose a reason for hiding this comment

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

No error?

Copy link
Member

@weswigham weswigham Oct 29, 2019

Choose a reason for hiding this comment

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

It's a copy & paste from the issue which expressed surprise that no error was issued here. There should be one (and now there is).

Copy link
Member Author

Choose a reason for hiding this comment

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

I should change the comment; it's "No error!" because the OP was surprised at the lack of error.

@@ -118,7 +118,8 @@ tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(37,1): e
~
!!! error TS2322: Type 'A & B' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'.
!!! error TS2322: Type 'A & B' is not assignable to type 'B & D'.
!!! error TS2322: Type 'A & B' is not assignable to type 'D'.
!!! error TS2322: Property 'd' is missing in type 'A & B' but required in type 'D'.
!!! related TS2728 tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts:4:15: 'd' is declared here.
Copy link
Member

Choose a reason for hiding this comment

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

Interesting but not awful that we lose the line Type 'A & B' is not assignable to type 'D'.... and it’s nice that we get the elaboration into the missing properties.

@typescript-bot
Copy link
Collaborator

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

Here they are:

Comparison Report - master..34789

Metric master 34789 Delta Best Worst
Angular - node (v10.16.3, x64)
Memory used 355,137k (± 0.01%) 355,407k (± 0.01%) +269k (+ 0.08%) 355,285k 355,518k
Parse Time 1.62s (± 0.75%) 1.64s (± 2.07%) +0.02s (+ 1.23%) 1.61s 1.77s
Bind Time 0.86s (± 0.64%) 0.87s (± 0.84%) +0.01s (+ 0.70%) 0.86s 0.89s
Check Time 4.52s (± 0.54%) 4.53s (± 0.52%) +0.01s (+ 0.24%) 4.48s 4.57s
Emit Time 5.27s (± 0.49%) 5.31s (± 1.11%) +0.04s (+ 0.76%) 5.19s 5.44s
Total Time 12.27s (± 0.32%) 12.34s (± 0.68%) +0.07s (+ 0.59%) 12.19s 12.52s
Monaco - node (v10.16.3, x64)
Memory used 365,952k (± 0.02%) 365,937k (± 0.01%) -14k (- 0.00%) 365,854k 366,046k
Parse Time 1.26s (± 0.49%) 1.27s (± 2.06%) +0.01s (+ 0.87%) 1.24s 1.37s
Bind Time 0.75s (± 0.40%) 0.76s (± 0.87%) +0.01s (+ 1.06%) 0.75s 0.77s
Check Time 4.64s (± 0.50%) 4.64s (± 0.60%) +0.00s (+ 0.06%) 4.57s 4.70s
Emit Time 2.93s (± 0.77%) 2.94s (± 0.54%) +0.01s (+ 0.34%) 2.90s 2.97s
Total Time 9.58s (± 0.43%) 9.61s (± 0.55%) +0.03s (+ 0.33%) 9.50s 9.73s
TFS - node (v10.16.3, x64)
Memory used 321,604k (± 0.02%) 321,630k (± 0.02%) +26k (+ 0.01%) 321,451k 321,757k
Parse Time 0.96s (± 0.61%) 0.97s (± 1.27%) +0.01s (+ 1.15%) 0.95s 1.01s
Bind Time 0.72s (± 1.42%) 0.72s (± 1.22%) +0.00s (+ 0.14%) 0.70s 0.74s
Check Time 4.09s (± 0.58%) 4.12s (± 0.54%) +0.03s (+ 0.73%) 4.07s 4.16s
Emit Time 3.06s (± 0.53%) 3.07s (± 0.53%) +0.01s (+ 0.42%) 3.05s 3.13s
Total Time 8.83s (± 0.34%) 8.88s (± 0.45%) +0.06s (+ 0.63%) 8.81s 8.98s
Angular - node (v12.1.0, x64)
Memory used 330,598k (± 0.08%) 330,969k (± 0.04%) +372k (+ 0.11%) 330,446k 331,140k
Parse Time 1.57s (± 0.66%) 1.57s (± 0.42%) +0.00s (+ 0.13%) 1.56s 1.59s
Bind Time 0.84s (± 0.68%) 0.85s (± 0.68%) +0.01s (+ 1.19%) 0.84s 0.86s
Check Time 4.46s (± 0.76%) 4.47s (± 0.56%) +0.02s (+ 0.36%) 4.41s 4.51s
Emit Time 5.44s (± 0.58%) 5.46s (± 0.87%) +0.02s (+ 0.37%) 5.34s 5.60s
Total Time 12.31s (± 0.46%) 12.35s (± 0.39%) +0.05s (+ 0.38%) 12.26s 12.48s
Monaco - node (v12.1.0, x64)
Memory used 345,729k (± 0.01%) 345,723k (± 0.01%) -5k (- 0.00%) 345,615k 345,848k
Parse Time 1.22s (± 0.73%) 1.23s (± 0.65%) +0.00s (+ 0.33%) 1.21s 1.25s
Bind Time 0.72s (± 1.67%) 0.73s (± 1.23%) +0.00s (+ 0.28%) 0.72s 0.76s
Check Time 4.48s (± 0.42%) 4.47s (± 0.50%) -0.01s (- 0.13%) 4.43s 4.51s
Emit Time 3.00s (± 0.68%) 2.98s (± 0.65%) -0.01s (- 0.40%) 2.94s 3.03s
Total Time 9.43s (± 0.34%) 9.41s (± 0.49%) -0.01s (- 0.14%) 9.32s 9.51s
TFS - node (v12.1.0, x64)
Memory used 304,054k (± 0.02%) 304,010k (± 0.02%) -44k (- 0.01%) 303,878k 304,130k
Parse Time 0.95s (± 0.50%) 0.95s (± 0.70%) -0.00s (- 0.31%) 0.94s 0.97s
Bind Time 0.68s (± 0.76%) 0.68s (± 0.91%) -0.00s (- 0.29%) 0.67s 0.70s
Check Time 4.04s (± 0.45%) 4.04s (± 0.65%) +0.00s (+ 0.02%) 3.98s 4.11s
Emit Time 3.12s (± 0.76%) 3.07s (± 0.88%) -0.05s (- 1.51%) 3.00s 3.11s
Total Time 8.79s (± 0.39%) 8.74s (± 0.46%) -0.05s (- 0.55%) 8.64s 8.82s
Angular - node (v8.9.0, x64)
Memory used 349,924k (± 0.02%) 350,194k (± 0.02%) +269k (+ 0.08%) 350,028k 350,311k
Parse Time 2.10s (± 0.77%) 2.10s (± 0.46%) -0.00s (- 0.10%) 2.08s 2.13s
Bind Time 0.90s (± 0.54%) 0.91s (± 0.82%) +0.00s (+ 0.33%) 0.89s 0.93s
Check Time 5.26s (± 0.67%) 5.30s (± 0.18%) +0.04s (+ 0.76%) 5.28s 5.33s
Emit Time 6.23s (± 0.72%) 6.24s (± 0.56%) +0.01s (+ 0.10%) 6.17s 6.31s
Total Time 14.49s (± 0.51%) 14.55s (± 0.30%) +0.05s (+ 0.37%) 14.48s 14.67s
Monaco - node (v8.9.0, x64)
Memory used 363,711k (± 0.02%) 363,747k (± 0.01%) +36k (+ 0.01%) 363,667k 363,819k
Parse Time 1.56s (± 0.45%) 1.57s (± 0.49%) +0.01s (+ 0.38%) 1.55s 1.58s
Bind Time 0.92s (± 0.75%) 0.92s (± 0.89%) +0.01s (+ 0.87%) 0.91s 0.94s
Check Time 5.52s (± 0.55%) 5.55s (± 0.42%) +0.04s (+ 0.65%) 5.52s 5.61s
Emit Time 3.04s (± 0.73%) 3.05s (± 0.90%) +0.00s (+ 0.13%) 2.99s 3.10s
Total Time 11.04s (± 0.38%) 11.09s (± 0.41%) +0.05s (+ 0.50%) 11.00s 11.19s
TFS - node (v8.9.0, x64)
Memory used 320,497k (± 0.01%) 320,498k (± 0.02%) +0k (+ 0.00%) 320,403k 320,613k
Parse Time 1.27s (± 0.46%) 1.27s (± 0.51%) -0.00s (- 0.08%) 1.25s 1.28s
Bind Time 0.74s (± 0.75%) 0.74s (± 0.46%) +0.01s (+ 0.68%) 0.74s 0.75s
Check Time 4.71s (± 0.86%) 4.75s (± 0.39%) +0.04s (+ 0.83%) 4.72s 4.80s
Emit Time 3.24s (± 0.68%) 3.23s (± 0.88%) -0.01s (- 0.22%) 3.16s 3.29s
Total Time 9.96s (± 0.60%) 10.00s (± 0.34%) +0.04s (+ 0.39%) 9.93s 10.07s
Angular - node (v8.9.0, x86)
Memory used 198,621k (± 0.02%) 198,838k (± 0.03%) +217k (+ 0.11%) 198,619k 198,934k
Parse Time 2.02s (± 0.76%) 2.02s (± 1.00%) -0.00s (- 0.05%) 2.00s 2.08s
Bind Time 1.02s (± 1.04%) 1.03s (± 1.40%) +0.01s (+ 0.88%) 1.00s 1.06s
Check Time 4.79s (± 0.53%) 4.81s (± 0.38%) +0.02s (+ 0.35%) 4.78s 4.87s
Emit Time 6.08s (± 1.11%) 6.12s (± 1.63%) +0.04s (+ 0.72%) 5.99s 6.42s
Total Time 13.92s (± 0.53%) 13.99s (± 0.67%) +0.07s (+ 0.47%) 13.85s 14.23s
Monaco - node (v8.9.0, x86)
Memory used 203,735k (± 0.02%) 203,713k (± 0.02%) -22k (- 0.01%) 203,610k 203,827k
Parse Time 1.60s (± 0.59%) 1.60s (± 0.50%) -0.00s (- 0.19%) 1.59s 1.63s
Bind Time 0.74s (± 0.49%) 0.75s (± 1.04%) +0.00s (+ 0.67%) 0.74s 0.77s
Check Time 5.40s (± 0.59%) 5.36s (± 0.48%) -0.04s (- 0.80%) 5.29s 5.42s
Emit Time 2.88s (± 1.40%) 2.88s (± 1.36%) +0.00s (+ 0.03%) 2.83s 3.01s
Total Time 10.63s (± 0.29%) 10.59s (± 0.37%) -0.04s (- 0.40%) 10.51s 10.69s
TFS - node (v8.9.0, x86)
Memory used 180,558k (± 0.02%) 180,518k (± 0.03%) -40k (- 0.02%) 180,405k 180,632k
Parse Time 1.31s (± 0.51%) 1.31s (± 0.46%) -0.00s (- 0.38%) 1.29s 1.32s
Bind Time 0.69s (± 0.32%) 0.70s (± 1.04%) +0.01s (+ 1.01%) 0.68s 0.71s
Check Time 4.46s (± 0.41%) 4.51s (± 0.66%) +0.05s (+ 1.03%) 4.43s 4.57s
Emit Time 2.96s (± 0.69%) 2.98s (± 1.39%) +0.03s (+ 0.91%) 2.90s 3.12s
Total Time 9.42s (± 0.33%) 9.49s (± 0.53%) +0.07s (+ 0.77%) 9.41s 9.65s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-166-generic
Architecturex64
Available Memory16 GB
Available Memory14 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)
Benchmark Name Iterations
Current 34789 10
Baseline master 10

Copy link
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

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

This simplifies the code a bit, fixes the issues, produces better errors, and seems to be fine on perf. As with all assignability changes, we should look over the extended test suites, but this looks good to me.

@sandersn
Copy link
Member Author

@typescript-bot test this
@typescript-bot user test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Oct 29, 2019

Heya @sandersn, I've started to run the extended test suite on this PR at 2e0b451. You can monitor the build here. It should now contribute to this PR's status checks.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Oct 29, 2019

Heya @sandersn, I've started to run the parallelized community code test suite on this PR at 2e0b451. You can monitor the build here. It should now contribute to this PR's status checks.

@typescript-bot
Copy link
Collaborator

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

@sandersn
Copy link
Member Author

@typescript-bot run dt

@typescript-bot
Copy link
Collaborator

typescript-bot commented Oct 29, 2019

Heya @sandersn, I've started to run the parallelized Definitely Typed test suite on this PR at 2e0b451. You can monitor the build here. It should now contribute to this PR's status checks.

@sandersn
Copy link
Member Author

whew, the user test baselines were pretty messy! I merged to master so they should be better now.

@typescript-bot user test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Oct 29, 2019

Heya @sandersn, I've started to run the parallelized community code test suite on this PR at ea80362. You can monitor the build here. It should now contribute to this PR's status checks.

@sandersn
Copy link
Member Author

RWC: 5 elaborations in fp-ts change. They do so in a way that makes it embarrassingly obvious that we are linearising multiple elaborations. But otherwise they're fine.

Also ha ha oh no I didn't actually merge the baseline updates until 5 minutes ago, so

@typescript-bot user test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Oct 29, 2019

Heya @sandersn, I've started to run the parallelized community code test suite on this PR at 0764275. You can monitor the build here. It should now contribute to this PR's status checks.

@sandersn
Copy link
Member Author

DT had no failures.

@sandersn
Copy link
Member Author

User tests had no failures.

@sandersn sandersn merged commit 00dd1f0 into master Oct 29, 2019
@sandersn
Copy link
Member Author

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

@typescript-bot
Copy link
Collaborator

Hey @sandersn, I've opened #34812 for you.

typescript-bot pushed a commit to typescript-bot/TypeScript that referenced this pull request Oct 29, 2019
Component commits:
2e0b451 Add isIntersectionConstituent to relation key
isIntersectionConstituent controls whether relation checking performs
excess property and common property checks. It is possible to fail a
relation check with excess property checks turned on, cache the result,
and then skip a relation check with excess property checks that would
have succeeded. microsoft#33133 provides an example of such a program.

Fixes microsoft#33133 the right way, so I reverted the fix at microsoft#33213
Fixes microsoft#34762 (by reverting microsoft#33213)
Fixes microsoft#33944 -- I added the test from microsoft#34646

14d7a44 Merge branch 'master' into add-isIntersectionConstituent-to-relation-key

ea80362 Update comments in test

0764275 Merge branch 'master' into add-isIntersectionConstituent-to-relation-key
sandersn pushed a commit that referenced this pull request Oct 29, 2019
Component commits:
2e0b451 Add isIntersectionConstituent to relation key
isIntersectionConstituent controls whether relation checking performs
excess property and common property checks. It is possible to fail a
relation check with excess property checks turned on, cache the result,
and then skip a relation check with excess property checks that would
have succeeded. #33133 provides an example of such a program.

Fixes #33133 the right way, so I reverted the fix at #33213
Fixes #34762 (by reverting #33213)
Fixes #33944 -- I added the test from #34646

14d7a44 Merge branch 'master' into add-isIntersectionConstituent-to-relation-key

ea80362 Update comments in test

0764275 Merge branch 'master' into add-isIntersectionConstituent-to-relation-key
@jakebailey jakebailey deleted the add-isIntersectionConstituent-to-relation-key branch November 7, 2022 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants