-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
breaking change: remove support for old super-mixins from CFE and VM #48167
Comments
Announced on announce@dartlang.org. @devoncarew please kick of the process. |
To paraphrase from above:
@vsm - can you review and sign off for Dart? @Hixie - can you do the same for Flutter? And @grouma for Angular? Thanks! |
I didn't realise we still supported this. Sure, this is fine by me. |
Does removing support leave an error message in place that explains how to migrate easily? |
I assume it would leave the existing error message in place ( |
As far as I can tell this will not impact Angular. |
lgtm |
@mraleph - this breaking change request is approved; feel free to move to the next steps (https://github.com/dart-lang/sdk/blob/main/docs/process/breaking-changes.md#step-3-execution). |
We are ready to go @johnniwinther |
@johnniwinther Is this something we are still moving forward with? |
It is. I'm currently looking into making some preparations in the CFE. |
This CL remove the support for mixing in classes that don't extend Object. An error has been report by the analyzer for some time and now also by the CFE. This puts the breaking change #48167 into effect. TEST=pkg/front_end/testcases/general/issue48167.dart Change-Id: Ia7715a27dc1aa18a7c85b24ed86d19a91b6924d5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247551 Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> Reviewed-by: Slava Egorov <vegorov@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
This has landed. |
@johnniwinther can you confirm this section in the docs on mixins reflects the change? Edit: also this section Thanks! |
The section 'Mixins' is up to date. The section 'Adding features to a class: mixins', too. The latter does contain the sentence
It would have been better if it said 'To implement a mixin, write a mixin declaration. For backward compatibility, it is also possible to use a class as a mixin if it extends |
Background
Currently CFE allows certain targets (e.g. Flutter, Dart CLI) to use old super mixin feature - which permitted to classes to be used as mixins even when they extended something that was not an
Object
.Meaning that CFE would compile (and VM would run) the following code:
Analyzer rejects this code with
mixin_inherits_from_not_object
error:error • test.dart:5:27 • The class 'Mixin' can't be used as a mixin because it extends a class other than 'Object'. • mixin_inherits_from_not_object
Though this error can be suppressed via
// ignore:mixin_inherits_from_not_object
.The analyser used to support this feature (hidden under a flag) but this support has been removed.
Proposed change
We propose to remove support for this feature from CFE.
Migration
Users should migrate their
class Mixin extends Base
declarations to usemixin Mixin on Base
declarations instead.Impact
Given that the analyzer issues an error by default we consider the risk to be minimal.
As far as we can neither Flutter no internally Google code base does not contain any suppressions for
mixin_inherits_from_not_object
which means it does not contain any uses of these feature.Only users that explicitly suppressed analysis error will be affected and will be required to migrate.
The text was updated successfully, but these errors were encountered: