-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Fixed issue with spreading a generic call expression into generic JSX and gather intra expression inference sites from spread expressions #53444
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
@@ -30130,7 +30130,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { | |||
hasComputedNumberProperty = false; | |||
hasComputedSymbolProperty = false; | |||
} | |||
const type = getReducedType(checkExpression(memberDecl.expression)); | |||
const type = getReducedType(checkExpression(memberDecl.expression, checkMode & CheckMode.Inferential)); |
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.
This forwards CheckMode.Inferential
as that's a requirement for addIntraExpressionInferenceSite
to be called
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.
Dub question, but, why not just pass check mode alone? (I wish we made the parameter required everywhere...)
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.
That’s a question i can’t answer. I just figured out that the original issue was caused by the fact that it was passed down and that it was inconsistent with regular calls. So I unified both paths to work the same.
that other issue with spreads and intra expression inferences was accidentally discovered - it wasn’t exactly what was reported as broken for lack of this feature in JSX. It just was an example of a workaround and when I was fixing that issue I just copy pasted all of the examples from the issue. If not that, it’s likely that we would never know about this being broken - although in context of JSX there are some people who prefer to spread object literals (which is not common with regular calls, at least not in such a simple form). @weswigham mentioned in the comment that this case looked alright to him and that we don't want to break it… so here we are :)
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.
Filtering the checkMode
we pass forward is a bit odd, but it wouldn't be the first place we, at least implicitly, do so (usually we implicitly replace the active checkMode with Normal
). This is probably going to cause some edge cases to change in object literal contextually typed function member inference (since the Contextual
checkmode isn't being forwarded anymore), but maybe not. Let's just run the tests, since I can't come up with an example that'd break offhand.
@typescript-bot test this |
Heya @weswigham, I'm starting to run the parallelized Definitely Typed test suite on this PR at 0c72dc2. Hold tight - I'll update this comment with the log link once the build has been queued. Update: The results are in! |
Heya @weswigham, I'm starting to run the diff-based top-repos suite on this PR at 0c72dc2. Hold tight - I'll update this comment with the log link once the build has been queued. Update: The results are in! |
Heya @weswigham, I'm starting to run the extended test suite on this PR at 0c72dc2. Hold tight - I'll update this comment with the log link once the build has been queued. |
Heya @weswigham, I'm starting to run the perf test suite on this PR at 0c72dc2. Hold tight - I'll update this comment with the log link once the build has been queued. Update: The results are in! |
@weswigham Here are the results of running the top-repos suite comparing Everything looks good! |
Hey @weswigham, the results of running the DT tests are ready. |
@weswigham Here they are:
CompilerComparison Report - main..53444
System
Hosts
Scenarios
TSServerComparison Report - main..53444
System
Hosts
Scenarios
StartupComparison Report - main..53444
System
Hosts
Scenarios
Developer Information: |
@weswigham is this good for 5.1? |
This PR mainly unifies behavior of JSX and regular calls so I think that it should go in sooner than later. |
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.
Seems like this is ready, then? Surprised it wasn't merged unless I've missed something.
This PR:
cc @jakebailey @weswigham