-
-
Notifications
You must be signed in to change notification settings - Fork 746
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
[Bug]: Refit interfaces do not implement base interface non refit methods #1801
Comments
Related #1687 |
This is a pretty easy fix as all the required code is present, just an intentional???/bug prevents it from functioning, see here. The problem arises when we consider interface inheritance and manual casting. For instance interface IBase {
Task Do(); // Not a refit method, refit will not generate a method for this.
}
interface IDerived {
[get("/")]
Task Do(); // This refit method will hide member IBase.Do()
}
IDerived derived = RestService.For<IDerived>();
derived.Do() // calls the IDerived implementation for Do()
var base = (IBase)derived;
base.Do(); // still calls the IDerived implementation for Do()
// with my fix this would call `IBase.Do()` and throw an exception. A breaking change Because of this, my fix would be a breaking change (likely minor, I doubt many people rely on this) unless I take measures to circumvent this. I can either keep this behaviour or change it. I'm not sure what would be expected by the user and what is considered "correct". |
@TimothyMakkison |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Describe the bug 🐞
Generated refit interfaces are invalid if the base interface has a non refit method.
Step to reproduce
Reproduction repository
https://github.com/reactiveui/refit
Expected behavior
Refit should generate stub implementations which throw an error when called to satisfy the interface. Similar to how non refit methods are handled in non derived refit interfaces.
IDE
Rider Windows
The text was updated successfully, but these errors were encountered: