-
-
Notifications
You must be signed in to change notification settings - Fork 20.2k
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
StringName: Fix empty hash #96586
StringName: Fix empty hash #96586
Conversation
This seems to make the C# glue generation fail for some reason: https://github.com/godotengine/godot/actions/runs/10713374687/job/29705303641?pr=96586 CC @raulsntos |
I think it breaks the general method hashes for compatibility it's just that the C# check runs before the API check, it probably breaks the hash for methods with |
That sounds likely. It'd be great to see how many method hashes this changes. The last time we made a change to hashing, we ended up making |
I think you are both correct. The C# bindings generator seems to be getting confused about the method hashes and generating invalid C# that doesn't compile. For example, for the "name": "tr",
"is_const": true,
"is_vararg": false,
"is_static": false,
"is_virtual": false,
"hash": 1195764410,
"hash_compatibility": [
1195764410,
2475554935
], As you can see, the current hash matches one of the compatibility hashes, which is why the C# bindings generator gets confused and tries to generate the method twice. For your convenience, I'll upload the GDExtension API dump generated from before and after the commit in this PR:
Also, I wonder if the hash for an empty |
it seems possible to automate detecting empty StringName default parameters and tweaking the compat hashes and such, but im not familiar with how the system works or what those things mean 66 hash changes |
That's probably enough that these should be added to It's fairly simple to do, although quite tedious. Here's an example mapping for a class:
So, you give the name of the function, the old hash (before the hashing change) and the new hash. The only tricky part is if the function is already listed there, you'll need to update the older mapping too. That's because the mappings don't "chain together", like, you can't map from an old hash to another old hash, because Godot won't recursively look them up, you always need to map all the way to a hash that really exists in |
This is a good question! However, I think in the case of default arguments, it's probably harmless for them to match. So long as the hashing of the argument types is distinct (which I think it still is), we should be good. That said, I'm only thinking about GDExtension compatibility, I don't know if this could have an effect on other things in the engine where we'd want
I think |
94631ef
to
2cf5466
Compare
2cf5466
to
a8602f2
Compare
4a9a85c
to
ab6d8ff
Compare
+Fixed compat hashes
ab6d8ff
to
0dde931
Compare
i had to add an unexpected extra hash for and removed compatibility methods for methods previously having a default arg of String() when the param type was StringName default parameters of Callable() were also affected btw (because of the hash of empty |
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.
From the perspective of GDExtension compatibility, this looks good to me! I didn't evaluate its potential impact on anything else.
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 found no issues regarding C# compatibility either.
Thanks! |
fixes #96553
fixes #77894
fixes the underlying issue that an empty String hashes different than an empty StringName
and the default animation library is an empty string
so when the String key is converted to a StringName, it hashes differently and misses the entry in the hashmap
possibly solves other unknown bugs related to the new StringName Dictionaries