gdext
gdext copied to clipboard
Array<T> is exported wrongly as Array, instead of Array[T]
Rust:
Godot:
are you sure it's actually exported wrongly and it's not just the documentation that's wrong?
Depends on the meaning of the "export" I guess? It works as it should but no type inference, so I suppose only the type information is wrong. "exported wrongly" might be misnomer in that case
GDScript does the same thing interestingly
class_name Foo extends Node
func my_func(arr: Array[int]) -> Array[int]:
return arr
We can fix this by making the PropertyInfo
of a type be different between methods/returns and fields. Since if we make the hint PROPERTY_HINT_ARRAY_TYPE
with the hint string being the name of the type the array contains, then the docs will properly display Array[type]
.
But im not sure if this is intended?
Hmm, weird why gdscript does that. For example, built-in methods like get_children show the correct signature, Array[Node].
I think it would be better if the type hint also reflects the actual type. I don't know if that's intended or not. I have no serious experience with either gdext or godot. I can only talk about DX in this case 😅
https://github.com/godotengine/godot/issues/79247 seems it's upstream?
should be fixed by https://github.com/godotengine/godot/pull/80745, haven't confirmed yet
Even though Godot addressed it upstream, there was another bug on our side, which I now fixed as well :slightly_smiling_face: