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

[Feature request] Add ability to match multiple classes in Generics #53360

Closed
eximius313 opened this issue Aug 28, 2023 · 2 comments
Closed

[Feature request] Add ability to match multiple classes in Generics #53360

eximius313 opened this issue Aug 28, 2023 · 2 comments
Labels
closed-duplicate Closed in favor of an existing report

Comments

@eximius313
Copy link

eximius313 commented Aug 28, 2023

Java allows for & in Generics.
With it, one can do something like this:

abstract interface class MyInterface1 {
  String doSomething();
}
abstract interface class MyInterface2 {
  String doOther();
}

class MyService<T extends MyInterface1 & MyInterface2> {
  void operateOn(T t) {
      //can call "doSomething" from "MyInterface1" and "doOther" from "MyInterface2"
  }
}

Could you please allow such a syntax?


In your issue, please include:

  • Dart version and tooling diagnostic info (dart info) -> - Dart 3.0.0 (stable) (Thu May 4 01:11:00 2023 -0700) on "windows_x64"
  • Whether you are using Windows, macOS, or Linux (if applicable) -> Windows 10
  • Whether you are using Chrome, Safari, Firefox, Edge (if applicable) -> N/A
@lrhn
Copy link
Member

lrhn commented Aug 28, 2023

This would be a language feature, so it belongs in the language repository.

There is already (at least) one request for multiple bounds on the same type parameter, dart-lang/language#2709, so I'll close this issue as a duplicate of that, and further discussion should continue there.

@lrhn lrhn closed this as completed Aug 28, 2023
@lrhn lrhn added the closed-duplicate Closed in favor of an existing report label Aug 28, 2023
@eximius313
Copy link
Author

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-duplicate Closed in favor of an existing report
Projects
None yet
Development

No branches or pull requests

2 participants