Skip to content

Add isIntersectionConstituent to relation key - #34789

Merged
Nathan Shively-Sanders (sandersn) merged 4 commits into
masterfrom
add-isIntersectionConstituent-to-relation-key
Oct 29, 2019
Merged

Add isIntersectionConstituent to relation key#34789
Nathan Shively-Sanders (sandersn) merged 4 commits into
masterfrom
add-isIntersectionConstituent-to-relation-key

Conversation

@sandersn

@sandersnNathan Shively-Sanders (sandersn) commented Oct 28, 2019

Copy link
Copy Markdown
Member

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

Wesley Wigham (@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 #33213Fixes#34762 (by reverting #33213)
Fixes#33944 -- I added the test from #34646
@sandersn

Copy link
Copy Markdown
MemberAuthor

TypeScript Bot (@typescript-bot) perf test this

@typescript-bot

TypeScript Bot (typescript-bot) commented Oct 28, 2019

Copy link
Copy Markdown
Contributor

Heya Nathan Shively-Sanders (@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
Copy Markdown
Member

Choose a reason for hiding this comment

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

No error?

@weswighamWesley Wigham (weswigham)Oct 29, 2019

Copy link
Copy Markdown
Member

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
Copy Markdown
MemberAuthor

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.

!!! 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
Copy Markdown
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
Copy Markdown
Contributor

Nathan Shively-Sanders (@sandersn)
The results of the perf run you requested are in!

Here they are:

Comparison Report - master..34789

Metricmaster34789DeltaBestWorst
Angular - node (v10.16.3, x64)
Memory used355,137k (± 0.01%)355,407k (± 0.01%)+269k (+ 0.08%)355,285k355,518k
Parse Time1.62s (± 0.75%)1.64s (± 2.07%)+0.02s (+ 1.23%)1.61s1.77s
Bind Time0.86s (± 0.64%)0.87s (± 0.84%)+0.01s (+ 0.70%)0.86s0.89s
Check Time4.52s (± 0.54%)4.53s (± 0.52%)+0.01s (+ 0.24%)4.48s4.57s
Emit Time5.27s (± 0.49%)5.31s (± 1.11%)+0.04s (+ 0.76%)5.19s5.44s
Total Time12.27s (± 0.32%)12.34s (± 0.68%)+0.07s (+ 0.59%)12.19s12.52s
Monaco - node (v10.16.3, x64)
Memory used365,952k (± 0.02%)365,937k (± 0.01%)-14k (- 0.00%)365,854k366,046k
Parse Time1.26s (± 0.49%)1.27s (± 2.06%)+0.01s (+ 0.87%)1.24s1.37s
Bind Time0.75s (± 0.40%)0.76s (± 0.87%)+0.01s (+ 1.06%)0.75s0.77s
Check Time4.64s (± 0.50%)4.64s (± 0.60%)+0.00s (+ 0.06%)4.57s4.70s
Emit Time2.93s (± 0.77%)2.94s (± 0.54%)+0.01s (+ 0.34%)2.90s2.97s
Total Time9.58s (± 0.43%)9.61s (± 0.55%)+0.03s (+ 0.33%)9.50s9.73s
TFS - node (v10.16.3, x64)
Memory used321,604k (± 0.02%)321,630k (± 0.02%)+26k (+ 0.01%)321,451k321,757k
Parse Time0.96s (± 0.61%)0.97s (± 1.27%)+0.01s (+ 1.15%)0.95s1.01s
Bind Time0.72s (± 1.42%)0.72s (± 1.22%)+0.00s (+ 0.14%)0.70s0.74s
Check Time4.09s (± 0.58%)4.12s (± 0.54%)+0.03s (+ 0.73%)4.07s4.16s
Emit Time3.06s (± 0.53%)3.07s (± 0.53%)+0.01s (+ 0.42%)3.05s3.13s
Total Time8.83s (± 0.34%)8.88s (± 0.45%)+0.06s (+ 0.63%)8.81s8.98s
Angular - node (v12.1.0, x64)
Memory used330,598k (± 0.08%)330,969k (± 0.04%)+372k (+ 0.11%)330,446k331,140k
Parse Time1.57s (± 0.66%)1.57s (± 0.42%)+0.00s (+ 0.13%)1.56s1.59s
Bind Time0.84s (± 0.68%)0.85s (± 0.68%)+0.01s (+ 1.19%)0.84s0.86s
Check Time4.46s (± 0.76%)4.47s (± 0.56%)+0.02s (+ 0.36%)4.41s4.51s
Emit Time5.44s (± 0.58%)5.46s (± 0.87%)+0.02s (+ 0.37%)5.34s5.60s
Total Time12.31s (± 0.46%)12.35s (± 0.39%)+0.05s (+ 0.38%)12.26s12.48s
Monaco - node (v12.1.0, x64)
Memory used345,729k (± 0.01%)345,723k (± 0.01%)-5k (- 0.00%)345,615k345,848k
Parse Time1.22s (± 0.73%)1.23s (± 0.65%)+0.00s (+ 0.33%)1.21s1.25s
Bind Time0.72s (± 1.67%)0.73s (± 1.23%)+0.00s (+ 0.28%)0.72s0.76s
Check Time4.48s (± 0.42%)4.47s (± 0.50%)-0.01s (- 0.13%)4.43s4.51s
Emit Time3.00s (± 0.68%)2.98s (± 0.65%)-0.01s (- 0.40%)2.94s3.03s
Total Time9.43s (± 0.34%)9.41s (± 0.49%)-0.01s (- 0.14%)9.32s9.51s
TFS - node (v12.1.0, x64)
Memory used304,054k (± 0.02%)304,010k (± 0.02%)-44k (- 0.01%)303,878k304,130k
Parse Time0.95s (± 0.50%)0.95s (± 0.70%)-0.00s (- 0.31%)0.94s0.97s
Bind Time0.68s (± 0.76%)0.68s (± 0.91%)-0.00s (- 0.29%)0.67s0.70s
Check Time4.04s (± 0.45%)4.04s (± 0.65%)+0.00s (+ 0.02%)3.98s4.11s
Emit Time3.12s (± 0.76%)3.07s (± 0.88%)-0.05s (- 1.51%)3.00s3.11s
Total Time8.79s (± 0.39%)8.74s (± 0.46%)-0.05s (- 0.55%)8.64s8.82s
Angular - node (v8.9.0, x64)
Memory used349,924k (± 0.02%)350,194k (± 0.02%)+269k (+ 0.08%)350,028k350,311k
Parse Time2.10s (± 0.77%)2.10s (± 0.46%)-0.00s (- 0.10%)2.08s2.13s
Bind Time0.90s (± 0.54%)0.91s (± 0.82%)+0.00s (+ 0.33%)0.89s0.93s
Check Time5.26s (± 0.67%)5.30s (± 0.18%)+0.04s (+ 0.76%)5.28s5.33s
Emit Time6.23s (± 0.72%)6.24s (± 0.56%)+0.01s (+ 0.10%)6.17s6.31s
Total Time14.49s (± 0.51%)14.55s (± 0.30%)+0.05s (+ 0.37%)14.48s14.67s
Monaco - node (v8.9.0, x64)
Memory used363,711k (± 0.02%)363,747k (± 0.01%)+36k (+ 0.01%)363,667k363,819k
Parse Time1.56s (± 0.45%)1.57s (± 0.49%)+0.01s (+ 0.38%)1.55s1.58s
Bind Time0.92s (± 0.75%)0.92s (± 0.89%)+0.01s (+ 0.87%)0.91s0.94s
Check Time5.52s (± 0.55%)5.55s (± 0.42%)+0.04s (+ 0.65%)5.52s5.61s
Emit Time3.04s (± 0.73%)3.05s (± 0.90%)+0.00s (+ 0.13%)2.99s3.10s
Total Time11.04s (± 0.38%)11.09s (± 0.41%)+0.05s (+ 0.50%)11.00s11.19s
TFS - node (v8.9.0, x64)
Memory used320,497k (± 0.01%)320,498k (± 0.02%)+0k (+ 0.00%)320,403k320,613k
Parse Time1.27s (± 0.46%)1.27s (± 0.51%)-0.00s (- 0.08%)1.25s1.28s
Bind Time0.74s (± 0.75%)0.74s (± 0.46%)+0.01s (+ 0.68%)0.74s0.75s
Check Time4.71s (± 0.86%)4.75s (± 0.39%)+0.04s (+ 0.83%)4.72s4.80s
Emit Time3.24s (± 0.68%)3.23s (± 0.88%)-0.01s (- 0.22%)3.16s3.29s
Total Time9.96s (± 0.60%)10.00s (± 0.34%)+0.04s (+ 0.39%)9.93s10.07s
Angular - node (v8.9.0, x86)
Memory used198,621k (± 0.02%)198,838k (± 0.03%)+217k (+ 0.11%)198,619k198,934k
Parse Time2.02s (± 0.76%)2.02s (± 1.00%)-0.00s (- 0.05%)2.00s2.08s
Bind Time1.02s (± 1.04%)1.03s (± 1.40%)+0.01s (+ 0.88%)1.00s1.06s
Check Time4.79s (± 0.53%)4.81s (± 0.38%)+0.02s (+ 0.35%)4.78s4.87s
Emit Time6.08s (± 1.11%)6.12s (± 1.63%)+0.04s (+ 0.72%)5.99s6.42s
Total Time13.92s (± 0.53%)13.99s (± 0.67%)+0.07s (+ 0.47%)13.85s14.23s
Monaco - node (v8.9.0, x86)
Memory used203,735k (± 0.02%)203,713k (± 0.02%)-22k (- 0.01%)203,610k203,827k
Parse Time1.60s (± 0.59%)1.60s (± 0.50%)-0.00s (- 0.19%)1.59s1.63s
Bind Time0.74s (± 0.49%)0.75s (± 1.04%)+0.00s (+ 0.67%)0.74s0.77s
Check Time5.40s (± 0.59%)5.36s (± 0.48%)-0.04s (- 0.80%)5.29s5.42s
Emit Time2.88s (± 1.40%)2.88s (± 1.36%)+0.00s (+ 0.03%)2.83s3.01s
Total Time10.63s (± 0.29%)10.59s (± 0.37%)-0.04s (- 0.40%)10.51s10.69s
TFS - node (v8.9.0, x86)
Memory used180,558k (± 0.02%)180,518k (± 0.03%)-40k (- 0.02%)180,405k180,632k
Parse Time1.31s (± 0.51%)1.31s (± 0.46%)-0.00s (- 0.38%)1.29s1.32s
Bind Time0.69s (± 0.32%)0.70s (± 1.04%)+0.01s (+ 1.01%)0.68s0.71s
Check Time4.46s (± 0.41%)4.51s (± 0.66%)+0.05s (+ 1.03%)4.43s4.57s
Emit Time2.96s (± 0.69%)2.98s (± 1.39%)+0.03s (+ 0.91%)2.90s3.12s
Total Time9.42s (± 0.33%)9.49s (± 0.53%)+0.07s (+ 0.77%)9.41s9.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)
BenchmarkNameIterations
Current3478910
Baselinemaster10

Copy link
Copy Markdown
Member

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
Copy Markdown
MemberAuthor

@typescript-bot

TypeScript Bot (typescript-bot) commented Oct 29, 2019

Copy link
Copy Markdown
Contributor

Heya Nathan Shively-Sanders (@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

TypeScript Bot (typescript-bot) commented Oct 29, 2019

Copy link
Copy Markdown
Contributor

Heya Nathan Shively-Sanders (@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
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.

@sandersn

Copy link
Copy Markdown
MemberAuthor

@typescript-bot

TypeScript Bot (typescript-bot) commented Oct 29, 2019

Copy link
Copy Markdown
Contributor

Heya Nathan Shively-Sanders (@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
Copy Markdown
MemberAuthor

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

TypeScript Bot (@typescript-bot) user test this

@typescript-bot

TypeScript Bot (typescript-bot) commented Oct 29, 2019

Copy link
Copy Markdown
Contributor

Heya Nathan Shively-Sanders (@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
Copy Markdown
MemberAuthor

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 (@typescript-bot) user test this

@typescript-bot

TypeScript Bot (typescript-bot) commented Oct 29, 2019

Copy link
Copy Markdown
Contributor

Heya Nathan Shively-Sanders (@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
Copy Markdown
MemberAuthor

DT had no failures.

@sandersn

Copy link
Copy Markdown
MemberAuthor

User tests had no failures.

@sandersn

Copy link
Copy Markdown
MemberAuthor

TypeScript Bot (@typescript-bot) cherry-pick this to release-3.7

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Nathan Shively-Sanders (@sandersn), I've opened #34812 for you.

TypeScript Bot (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.
Fixesmicrosoft#33133 the right way, so I reverted the fix at microsoft#33213Fixesmicrosoft#34762 (by reverting microsoft#33213)
Fixesmicrosoft#33944 -- I added the test from microsoft#3464614d7a44 Merge branch 'master' into add-isIntersectionConstituent-to-relation-key
ea80362 Update comments in test
0764275 Merge branch 'master' into add-isIntersectionConstituent-to-relation-key
Nathan Shively-Sanders (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 #33213Fixes#34762 (by reverting #33213)
Fixes#33944 -- I added the test from #3464614d7a44 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
Jake Bailey (jakebailey) deleted the add-isIntersectionConstituent-to-relation-key branch November 7, 2022 17:34
@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

None yet

Projects

None yet

4 participants

@sandersn@typescript-bot@weswigham@andrewbranch