-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Filter origin types when filtering union types #42378
Conversation
@typescript-bot test this |
Heya @ahejlsberg, I've started to run the parallelized Definitely Typed test suite on this PR at db46250. You can monitor the build here. |
Heya @ahejlsberg, I've started to run the extended test suite on this PR at db46250. You can monitor the build here. |
Heya @ahejlsberg, I've started to run the parallelized community code test suite on this PR at db46250. You can monitor the build here. |
Heya @ahejlsberg, I've started to run the abridged perf test suite on this PR at db46250. You can monitor the build here. Update: The results are in! |
@ahejlsberg Here they are:Comparison Report - master..42378
System
Hosts
Scenarios
|
The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master. |
Tests and performance all look good. |
let newOrigin: Type | undefined; | ||
if (origin && origin.flags & TypeFlags.Union) { | ||
// If the origin type is a (denormalized) union type, filter its non-union constituents. If that ends | ||
// up removing a smaller number of types than in the normalized constituent set (meaning some of the |
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 says smaller, but below you're checking for whether or not you've reduced the same number of elements.
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.
It's either going to be smaller or the same. It could never be larger.
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.
I guess what I'm saying is that the code is written in an inverted way, so it wasn't as obvious what's happening. I just realized it was written this way to share the same return
path though.
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.
createOriginUnionOrIntersectionType
is the thing you can't use if you end up removing a smaller number of types, right? If the length diff is the same, then you can, otherwise you have to fall back to getUnionTypeFromSortedList
, which will ignore the origin 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.
Oh, github didn't load the previous 3 comments before I commented. I guess the point is that I think the comment is not confusing, even if the code itself is.
Fixes #42304.