-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
Bailout early from isFunctionObjectType
for evolving arrays
#58049
Conversation
src/compiler/checker.ts
Outdated
@@ -27044,6 27044,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { | |||
} | |||
|
|||
function isFunctionObjectType(type: ObjectType): boolean { | |||
if (getObjectFlags(type) & ObjectFlags.EvolvingArray) { |
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.
resolveStructuredTypeMembers
is still going to crash if an evolving array manages to reach it. I concluded that it's still better - at least in this case - to bail out early. IIUC, it avoid "fixing" this evolving type without a strong reason to do so - so the evolving array can continue evolving in certain situations.
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.
Are there other paths whereby an evolving array could reach resolveStructuredTypeMembers? This seems like an important limitation that needs to be checked, either multiple places or maybe within resolveStructuredTypeMembers itself.
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.
Are there other paths whereby an evolving array could reach resolveStructuredTypeMembers?
None that we are aware of. Any call with an evolving array to that function would throw and I didn't see any other crashes reported there. It's of course not completely unlikely that there are other ways to end up with that crash.
This seems like an important limitation that needs to be checked, either multiple places or maybe within resolveStructuredTypeMembers itself.
There is already an assert there. The only thing that potentially could be improved is to switch the assert to some other logic that would handle evolving arrays gracefully. I don't know what that logic would be and I think if this crash is a rare one then this fix is good enough.
@typescript-bot test it |
Hey @jakebailey, the results of running the DT tests are ready. Everything looks the same! |
@jakebailey Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
@jakebailey Here are the results of running the user tests comparing Everything looks good! |
@jakebailey Here are the results of running the top 400 repos comparing Everything looks good! |
aa1e2df
to
31f2b7d
Compare
fixes #44659