migueldeicaza / SwiftGodot

New Godot bindings for Swift
https://migueldeicaza.github.io/SwiftGodotDocs/tutorials/swiftgodot-tutorials/
MIT License
1.11k stars 74 forks source link

Callable macro does not support base class type parameters #504

Closed lupuchard closed 3 months ago

lupuchard commented 3 months ago

Is your feature request related to a problem? Please describe. I would like to expose a method that takes in any Texture2D:

@Callable
public func use_texture(texture: Texture2D) { ... }

But I get the error:

error: missing argument label 'nativeHandle:' in call
        use_texture (Texture2D (args [0])!)

Because Texture2D is a base class and can't be directly constructed from a Variant, as the macro tries to do.

Describe the solution you'd like It'd be nice if the macro could somehow handle the possibility of the argument being any of the derived types of Texture2D.

Describe alternatives you've considered I could create an overload for every type of Texture2D manually, but there's a lot of them.

lupuchard commented 3 months ago

Nevermind I needed to update my swift packages