Fix conditional type type parameter leak#31455
Conversation
src/compiler/checker.ts
Outdated
| const freshParams = map(root.inferTypeParameters, cloneTypeParameter); | ||
| const freshMapper = createTypeMapper(root.inferTypeParameters, freshParams); | ||
| const context = createInferenceContext(freshParams, /*signature*/ undefined, InferenceFlags.None); | ||
| // We have three mappers that need applying: |
There was a problem hiding this comment.
is there a more concise way to write this whole block? This right here is "here be dragons" commenting level Double Dragon. I expect demons to fly out of my nose after reading it.
src/compiler/checker.ts
Outdated
| // * Clone the type parameters so their constraints can be instantiated in the context of `mapper` | ||
| // * Set the clones to both map the context and the original params | ||
| // * instantiate the extends type with the clones | ||
| // * incorporate all of the component mappers into the combined mapper for the members |
|
@sandersn comment order and informational content altered~ |
src/compiler/checker.ts
Outdated
| // * The original `mapper` used to create this conditional | ||
| // * The mapper that maps the old root type parameter to the clone (`freshMapper`) | ||
| // * The mapper that maps the clone to its inference result (`context.mapper`) | ||
| const freshParams = map(root.inferTypeParameters, cloneTypeParameter); |
There was a problem hiding this comment.
I'm concerned about all the new type identities created by always cloning the type parameters here. Fresh type parameters mean more work and more bloat in relationship caches. I'm wondering if we can somehow realize that we don't need to clone as that clearly covers the vast majority of cases.
There was a problem hiding this comment.
We could avoid clone type parameters which aren't constrained to an instantiable type, for what that'd give us.
|
@typescript-bot run dt |
|
Heya @weswigham, I've started to run the perf test suite on this PR at 9133ec5. You can monitor the build here. It should now contribute to this PR's status checks. Update: The results are in! |
|
Heya @weswigham, I've started to run the parallelized Definitely Typed test suite on this PR at 9133ec5. You can monitor the build here. It should now contribute to this PR's status checks. |
|
Heya @weswigham, I've started to run the extended test suite on this PR at 9133ec5. You can monitor the build here. It should now contribute to this PR's status checks. |
|
@weswigham Here they are:Comparison Report - master..31455
System
Hosts
Scenarios
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
RWC failed because there was a small diff in |
|
@typescript-bot test this |
|
Heya @weswigham, I've started to run the perf test suite on this PR at 6c86917. You can monitor the build here. It should now contribute to this PR's status checks. Update: The results are in! |
|
Heya @weswigham, I've started to run the parallelized community code test suite on this PR at 6c86917. You can monitor the build here. It should now contribute to this PR's status checks. |
|
Heya @weswigham, I've started to run the parallelized Definitely Typed test suite on this PR at 6c86917. You can monitor the build here. It should now contribute to this PR's status checks. |
|
Heya @weswigham, I've started to run the extended test suite on this PR at 6c86917. You can monitor the build here. It should now contribute to this PR's status checks. |
|
The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master. |
|
@weswigham Here they are:Comparison Report - master..31455
System
Hosts
Scenarios
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@typescript-bot test this |
|
Heya @weswigham, I've started to run the parallelized community code test suite on this PR at 76ae07b. You can monitor the build here. It should now contribute to this PR's status checks. |
|
Heya @weswigham, I've started to run the extended test suite on this PR at 76ae07b. You can monitor the build here. It should now contribute to this PR's status checks. |
|
Heya @weswigham, I've started to run the parallelized Definitely Typed test suite on this PR at 76ae07b. You can monitor the build here. It should now contribute to this PR's status checks. |
|
Heya @weswigham, I've started to run the perf test suite on this PR at 76ae07b. You can monitor the build here. It should now contribute to this PR's status checks. |
|
The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master. |
|
@ahejlsberg opted to reschedule this to 3.9 in person, but imma still need an updated review status at some point, thanks ❤️ |
|
Man, I missed this one for a long time because it never got an updated github review status, but since it got an offline approval, 4.7 is kinda like 3.9 I guess. Once CI is green, I'll merge this. |
Fixes #31402