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

Resolving virtual methods with generic arguments does not work. #152

Open
JustusAdam opened this issue May 24, 2024 · 0 comments
Open

Resolving virtual methods with generic arguments does not work. #152

JustusAdam opened this issue May 24, 2024 · 0 comments

Comments

@JustusAdam
Copy link
Collaborator

Setup:

#[paralegal::marker(sink, arguments = [0])]
fn actual_sink<T>(t: T) {}

#[paralegal::analyze]
fn main<S: Snk>(s: &S) {
    s.sink(0)
}

When the trait Snk is defined with a method that does not take a generic parameter then calling Instance::resolve returns a Virtual instance.

trait Snk {
    fn sink(&self, t: usize) {
        actual_sink(t)
    }
}

However if the argument is generic, instance resolution fails.

trait Snk {
    fn sink<T>(&self, t: T) {
        actual_sink(t)
    }
}
@JustusAdam JustusAdam changed the title Resolving virtual/default methods with generic arguments does not work. Resolving virtual methods with generic arguments does not work. May 24, 2024
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

1 participant