dart-lang / dart-lang/language

Unexpected type inference failure with self-referential types.

Open
#2,170 3 comments 1 reaction 0 assignees View on GitHub
request type-inference
Dominant language
TeX
Stars
2.9k
Forks
239
Avg merge
2d 18h
Merged PRs (30d)
14

Description

Consider the following example, where the type argument of `baz` in the second call to `baz` can't be inferred.

```dart

void bar() {
void baz>(B c) {}
baz(FooSelfImpl());
// v fails to infer FooSelf
baz(FooSelfImpl());
}

abstract class Foo {}

abstract class FooSelf implements Foo {}

class FooSelfImpl implements FooSelf {}
```

It would be nice if `FooSelf` could be inferred.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.