You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to return an array of type "Array" where expected return type is "Array[int]".
This is because the map function only returns an Array with no types. I think if the function in map returns a type then it should convert the return type of the Array to match that type.
For example, the above map func returns an int, so the Array it returns should be of type Array[int]
Steps to reproduce
Try to return the Array from the map (or other Array function) into a typed Array.
Minimal reproduction project
N/A
The text was updated successfully, but these errors were encountered:
This is because the map function only returns an Array with no types. I think if the function in map returns a type then it should convert the return type of the Array to match that type.
The current type system doesn't allow type to be inferred statically, we don't have something like:
And even dynamically Callable does not store such information. This is in GDScriptFunction, but Array.map() is a core method that does not depend on GDScript.
Godot version
v4.2.dev5.official [e3e2528]
System information
Godot v4.2.dev5 - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4090 (NVIDIA; 31.0.15.3742) - 13th Gen Intel(R) Core(TM) i7-13700K (24 Threads)
Issue description
I am not entirely sure if this can be classed as a bug or requires a feature proposal but anyhow, i will post here first.
If we try and return a function from an Array, ie map, filter etc into a typed array we get an error.
Doing something like this:
Shows this error upon execution.
This is because the map function only returns an Array with no types. I think if the function in map returns a type then it should convert the return type of the Array to match that type.
For example, the above map func returns an
int
, so the Array it returns should be of typeArray[int]
Steps to reproduce
Try to return the Array from the map (or other Array function) into a typed Array.
Minimal reproduction project
N/A
The text was updated successfully, but these errors were encountered: