-
-
Notifications
You must be signed in to change notification settings - Fork 5.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
fix #36104, assign global name during type definitions #36121
Conversation
5f4fb2a
to
a2d7011
Compare
Well, unsurprisingly, incomplete types throw a wrench into the works. We have some in the tests just to test that case; hopefully it will not really happen outside of that. I think I will return |
a2d7011
to
4eb3ec0
Compare
But then it breaks callers, like |
4eb3ec0
to
938e87e
Compare
This should be ok now. As a bonus, also fixes #21816!
but I expect that to be extremely rare. |
Alternative to #36111. Handling re-definitions is the tricky part. I realized one thing we did before was reset the global binding to undefined if an error happens during type definition, but that is invalid, so we don't do it anymore (with or without this PR). Hopefully that is the only remaining difference with v1.4.
This first checks if the new type object might be compatible with an existing one, and if so throws away the new one and uses the old type and parameters. Then we check that each step (supertype and field types) remains compatible as it runs.
fixes #36104