-
Notifications
You must be signed in to change notification settings - Fork 742
Replacing template alias that does not use its template parameter with one that does is broken #89
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
Comments
I think it's not about being smarter about type parameters, but about being replacement-aware. That's partially why the Right now the amount of code that is replacement-aware is minimal. Probably we should make |
After digging in more, this is not what we thought this was. Code generation, which is when we get the named types we need to emit, happens after we have already processed replacements, so the issue is not that we are failing to be replacement aware. In fact, it looks like we end up replacing the wrong items, and then end up ignoring the replacements or something. I'm digging in further... |
First, we parse the
Then, we define the replacement for
Finally, we add the item with id
So that seems to be the bug: we should be defining the replacement as Still figuring out why this is happening in the first place. |
I bet we're inserting it twice in the hashmap? |
Great guess! ;)
|
I guess we can assume the first is the correct replacement and then warn for duplicate replacement definition attempts. Fix incoming. |
Do not overwrite existing replacements It turns out that we can end up overwriting existing replacements. This commit embeds the assumption that the first replacement definition is the correct one, and warns on all attempts to overwrite the first replacement definition with a new one. Additionally, it adds some debug logging about replacements. This actually isn't enough to fix the test case in #89, but it is a good start. r? @emilio
Allow aliases and template aliases to be considered for replacement Fixes #89. I'm not exactly *happy* with the way this is implemented (making `real_canonical_name` public so that we can use it in replacement lookups) but I'm not sure of a better way without refactoring most of how naming works right now. r? @emilio
Oh man this took a while to track down. I'm hitting this in the SM bindings because we don't understand
mozilla::Conditional
and therefore don't understand that it is usingT
and we shouldn't filter the type parameter out for being unused, but we aren't smart enough to understand that.I "fixed" this with this diff:
however that breaks perfectly reasonable things like
tests/headers/template_typedefs.h
.Clearly we need to be smarter about type parameters, but I'm not 100% sure how to do that yet, and I'm still fumbling around this code base.
The text was updated successfully, but these errors were encountered: