Skip to content

Code generation error on nested generic bounded type arguments #658

Closed
@KholmatovS

Description

@KholmatovS

Code generation throws an error when a nested generic bounded type argument is used. The following code reproduces the issue:

example:

abstract class Worker<T extends Worker<T>> {}
mixin Workers {
  void someWork<T extends Worker<T>>() {
    print('Work on: $T');
  }
}
abstract class Bar<T> with Workers {}
class BackgroundWorker extends Worker<BackgroundWorker> {}
class Foo extends Bar<Foo> {
  void doWork() {
    someWork<BackgroundWorker>();
  }
}

Bad state: T extends Worker<T> not found, scopes: [{}, {T extends Worker<T>: T}]

or simpler example:

class Foo<T> {}
abstract class Bar<T> {
  Iterable<X> m1<X extends Foo<X>>(X Function(T) f);
}
abstract class FooBar<X> extends Bar<X> {}

Bad state: X extends Foo<X> not found, scopes: [{X: X}, {X extends Foo<X>: X1}]

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work ontype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions