dart-lang / dart-lang/language

Should mixin inference be performed on mixin superclass constraints?

Open
#28 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
TeX
Stars
2.9k
Forks
239
Avg merge
2d 18h
Merged PRs (30d)
14

Description

Mixin inference as specified will fill in the missing type arguments on `M1` in the mixin application here:

```dart
class I {}

mixin M1 on I {}

class A00 extends I with M1 {}
```

In the old "classes as super-mixins" world, `A00` would itself be usable as a super-mixin, and so in a sense we had mixin inference both for applications and for superclass constraints. As I've specified mixin inference for the new feature so far, it does not include superclass constraints. So the mixin version of the above would be rejected:

```dart
class I {}

mixin M1 on I {}

mixin A00Mixin on I, M1 {}
```

Here `M1` will be inferred as `M1` instead of `M1`.

Should we expand the spec to do inference on the superclass constraints in the same way as on mixin applications? I see no technical issues with it. It's slightly odder feeling since superclass constraints are not naturally ordered, but the inference would be ordered. That is, the example above would work, but switching the order of `I` and `M1` would not.

cc @lrhn @munificent @eernstg @yjbanov @Hixie

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.