-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Clean up inference of type parameters, contravariant types #49915
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
Conversation
@typescript-bot test this |
Heya @jakebailey, I've started to run the extended test suite on this PR at 01789d3. You can monitor the build here. |
Heya @jakebailey, I've started to run the abridged perf test suite on this PR at 01789d3. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the diff-based user code test suite on this PR at 01789d3. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the parallelized Definitely Typed test suite on this PR at 01789d3. You can monitor the build here. |
@jakebailey |
@jakebailey Here they are:Comparison Report - main..49915
System
Hosts
Scenarios
Developer Information: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming the extended test suites are fine, these changes look good to me.
It was clean, yeah. |
src/compiler/checker.ts
Outdated
@@ -30072,7 +30080,7 @@ namespace ts { | |||
|
|||
// Instantiate a generic signature in the context of a non-generic signature (section 3.8.5 in TypeScript spec) | |||
function instantiateSignatureInContextOf(signature: Signature, contextualSignature: Signature, inferenceContext?: InferenceContext, compareTypes?: TypeComparer): Signature { | |||
const context = createInferenceContext(signature.typeParameters!, signature, InferenceFlags.None, compareTypes); | |||
const context = createInferenceContext(signature.typeParameters!, signature, inferenceContext?.flags ?? InferenceFlags.None, compareTypes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh, I think this is cruft from my other PR. Will remove and retest.
@typescript-bot test this |
Heya @jakebailey, I've started to run the diff-based user code test suite on this PR at 4c5d4c1. You can monitor the build here. Update: The results are in! |
Heya @jakebailey, I've started to run the extended test suite on this PR at 4c5d4c1. You can monitor the build here. |
@jakebailey |
These are some oddities and cleanups that I noticed in writing #49887 (see also #43962 (comment)).
Namely,
inferFromContravariantTypes
only did a contravariant inference ifstrictFunctionTypes
was set, but that function call was used in many places thatstrictFunctionTypes
should not be applied, like in the the alias type argument path that was the target of #49887.I can't think of any particular test case that would be affected by this (probably, people always have this flag on, though notably not our own repo, oops), but it feels wrong.