gdext icon indicating copy to clipboard operation
gdext copied to clipboard

Array<T> is exported wrongly as Array, instead of Array[T]

Open kulkalkul opened this issue 1 year ago • 7 comments

Rust: image Godot: image

kulkalkul avatar Jun 29 '23 23:06 kulkalkul

are you sure it's actually exported wrongly and it's not just the documentation that's wrong?

lilizoey avatar Jun 29 '23 23:06 lilizoey

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

kulkalkul avatar Jun 30 '23 00:06 kulkalkul

GDScript does the same thing interestingly

class_name Foo extends Node

func my_func(arr: Array[int]) -> Array[int]:
	return arr

image

lilizoey avatar Jul 09 '23 17:07 lilizoey

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?

lilizoey avatar Jul 09 '23 17:07 lilizoey

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 😅

kulkalkul avatar Jul 09 '23 18:07 kulkalkul

https://github.com/godotengine/godot/issues/79247 seems it's upstream?

lilizoey avatar Jul 12 '23 16:07 lilizoey

should be fixed by https://github.com/godotengine/godot/pull/80745, haven't confirmed yet

lilizoey avatar Aug 23 '23 09:08 lilizoey

Even though Godot addressed it upstream, there was another bug on our side, which I now fixed as well :slightly_smiling_face:

Bromeon avatar Aug 03 '24 21:08 Bromeon