Skip to content

Instantiate to bound errors for constructors issued prematurely. #28539

Closed
@leafpetersen

Description

@leafpetersen

The following code should be valid, because inference will fill in the type parameters to the Foo constructor call. Instead an error is issued prematurely because Foo has no default bounds.

class Bar<T> {}

class Foo<T extends Bar<T>> {
  Foo(T y);
}

class Baz extends Bar<Baz> {}

void test() {
  Baz a;
  var x = new Foo(a);
}

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work onlegacy-area-analyzerUse area-devexp instead.type-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