Skip to content

Nesting Generics doesn't work as expected. #53327

Closed
@eximius313

Description

@eximius313

While having sucha a class with Generics is perfectly fine:

abstract class Response<TYPE extends Enum> {
  TYPE get type;
}

the compiler does not allow for "catching" the argument. Neither this:

class Processor<R extends Response<TYPE>> {
  TYPE handle(R response) => response.type;
}

nor this:

class Processor<R extends Response<TYPE extends Enum>> {
  TYPE handle(R response) => response.type;
}

works.


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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions