Skip to content
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

wrongly adding override when name of function matches parent class (but not return type) #40

Open
WebFreak001 opened this issue Oct 21, 2021 · 3 comments

Comments

@WebFreak001
Copy link

Example:
Gtk.Widget defines gtk.c.types.GtkTextDirection gtk.Widget.Widget.getDirection()
Libadwaita (Adw-1.gir) defines GtkArrowType getDirection()

girtod marks the method as override

@WebFreak001
Copy link
Author

D doesn't allow redefining functions with different return type.

To work around this you can use

public GtkArrowType _getDirection() { ... }
alias getDirection = _getDirection; // makes getDirection calls on this type call this function

however this could lead to confusion. Manually disabling code for the function and reimplementing works, but something easier in girtod (like a command to rename functions)

@MikeWey
Copy link
Member

MikeWey commented Oct 21, 2021

(like a command to rename functions)

You can use alias to rename the function:

alias: get_direction _getDirection

@WebFreak001
Copy link
Author

ah ok thanks, I didn't see that in the readme for functions, but it's there under global - didn't think replace ctype with dtype would apply to function names as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants