-
Notifications
You must be signed in to change notification settings - Fork 281
refactor: Fix name collisions in reorganize_definitions
#1465
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
774e1be to
c5185d5
Compare
kkysen
left a comment
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.
Do we want to keep these as separate definitions when their values are the same? Is it better to try to fix this from the transpiler side?
I don't have a preference on whether we merge definitions like these, but separately it would be nice to improve this on the transpiler side, because its root cause is the same as why our handling of |
c5185d5 to
f8b7c3b
Compare
|
I didn't touch the transpiler because afaict the two values of |
|
Maybe there should be a warning about this? Is it at all possible to check if the actual values are the same and merge them in that case? Or maybe run remove redundant casts first. |
reorganize_definitions
I could add a warning, sure.
We would basically need to run a compile-time evaluator for that, and that's if the expressions are even constant in the first place.
Sure, but that only fixes the subset where casts are the problem. What about e.g. comparing |
Yeah, we definitely need the general fix as done here, but I think the majority of these that the transpiler produces will be from casts. So we should do that, too (run remove redundant casts first). |
Allow multiple different definitions of the same identifier. Disambiguate them by appending a numeric _N suffix to each identifier after the 0-th one.
f8b7c3b to
0bba09a
Compare
|
I added a warning. |
Rename identically-named identifier (appending a suffix) for identifiers with different definitions, e.g.
from libxml2. The transform now renames the second definition to
EINPROGRESS_1and updates all uses.This is a copy of #1463 since GitHub closed that one after I reordered the branches.