Skip to content

Mixin application cannot be used as mixin #8127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
scheglov opened this issue Jan 25, 2013 · 2 comments
Closed

Mixin application cannot be used as mixin #8127

scheglov opened this issue Jan 25, 2013 · 2 comments
Assignees
Labels
area-test Cross-cutting test issues (use area- labels for specific failures; not used for package:test). closed-invalid Closed as we don't believe the reported issue is generally actionable
Milestone

Comments

@scheglov
Copy link
Contributor

language/mixin_mixin_test

  1. "It is a compile-time error if a mixin is derived from a class whose superclass is not Object."
  2. "A mixin application of the form S with M1, …, Mk defines a class C whose superclass is the application of the mixin composition Mk * … * M1 to S."

So, in code
class M1 { foo() => 42; }
typedef M2 = Object with M1;

class S { }
typedef C = S with M2;

Superclass of M2 is "application of M1 to Object" != Object, so compilation error.

@kasperl
Copy link

kasperl commented Jan 26, 2013

I think the test is just fine. The language specification clearly states:

  "A mixin application of the form S with M defines a class C with superclass S."

That means that M2 is a class that has Object as superclass. The form of the M2 mixin application doesn't match (2) because you're only mixing in one class.


cc @gbracha.
Set owner to @kasperl.
Added Invalid label.

@gbracha
Copy link
Contributor

gbracha commented Jan 28, 2013

As Kasper notes, the superclass of M2 is object, and mixing in M2 is fine - though it is just the same mixing in M1.

@scheglov scheglov added Type-Defect area-test Cross-cutting test issues (use area- labels for specific failures; not used for package:test). closed-invalid Closed as we don't believe the reported issue is generally actionable labels Jan 28, 2013
@scheglov scheglov added this to the M3 milestone Jan 28, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-test Cross-cutting test issues (use area- labels for specific failures; not used for package:test). closed-invalid Closed as we don't believe the reported issue is generally actionable
Projects
None yet
Development

No branches or pull requests

3 participants