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

Ambiguous method call in #[godot_api] generated code #858

Open
vby opened this issue Aug 15, 2024 · 1 comment
Open

Ambiguous method call in #[godot_api] generated code #858

vby opened this issue Aug 15, 2024 · 1 comment
Labels
bug c: register Register classes, functions and other symbols to GDScript

Comments

@vby
Copy link

vby commented Aug 15, 2024

[edit bromeon: Rust codetags]

Here is a minimal reproducible code:

#[derive(GodotClass)]
#[class(base=Sprite2D)]
pub struct Player {
    base: Base<Sprite2D>,
}

#[godot_api]
impl ISprite2D for Player {
    fn init(base: Base<Sprite2D>) -> Self {
        Self { base }
    }

    fn process(&mut self, delta: f64) {}
}

trait TraitA {
    fn process(&mut self, delta: f64);
}

impl TraitA for Player {
    fn process(&mut self, delta: f64) {}
}
error[E0034]: multiple applicable items in scope
  --> src/player.rs:17:8
   |
17 |     fn process(&mut self, delta: f64) {}
   |        ^^^^^^^ multiple `process` found
@Bromeon Bromeon added bug c: register Register classes, functions and other symbols to GDScript labels Aug 15, 2024
@Bromeon
Copy link
Member

Bromeon commented Aug 15, 2024

Good catch, maybe we should explicitly qualify the code-generated virtual call.

Also, you can use ```rs to add syntax highlighting 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug c: register Register classes, functions and other symbols to GDScript
Projects
None yet
Development

No branches or pull requests

2 participants