-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Nesting Generics doesn't work as expected. #53327
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
Comments
Would the following work for you? class Processor<TYPE extends Enum, R extends Response<TYPE>> {
TYPE handle(R response) => response.type;
} |
I know that this compiles, but this is a workaround. |
Correct, Dart does not allow you to nest generics, meaning declaring a new type variable inside the bound of another. It's not a bug in the implementation, and I believe there are issues for the possible language changes, so closing this. |
While having sucha a class with Generics is perfectly fine:
the compiler does not allow for "catching" the argument. Neither this:
nor this:
works.
In your issue, please include:
dart info
) ->- Dart 3.0.0 (stable) (Thu May 4 01:11:00 2023 -0700) on "windows_x64"
The text was updated successfully, but these errors were encountered: