-
Notifications
You must be signed in to change notification settings - Fork 205
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
Specify the private override error caused by a mixin application #1626
base: main
Are you sure you want to change the base?
Conversation
specification/dartLangSpec.tex
Outdated
Let \DefineSymbol{L_M} be the library containing the declaration of $M$. | ||
|
||
\LMHash{}% | ||
Assume that $S$ has a concrete member $m_S$ which is accessible to $L_M$, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we agree on it needing to be concrete?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this PR awaits the discussion in the language team: Do we want to support these mixin applications in all the cases where it does not give rise to an override, or do we want to raise an error on all clashes (abstract or concrete, that doesn't matter)?
My preferred approach is the former, because I don't want to eliminate expressive power gratuitously.
However, we certainly need to raise an error when there is an override because of an implicitly induced implementation (say, a stub that checks the type of an actual argument and calls super.sameMember
).
This means that the text in this PR needs to be updated, but it should be updated in two different ways if we choose the former respectively the latter approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cf. the decision at the language meeting yesterday, the PR has now been updated to make it an error when the private collision as created by a mixin application, no matter what kind of clash we have (concrete/concrete, concrete/abstract, concrete/stub, abstract/abstract, it's always an error).
1d31e4d
to
ecb4102
Compare
PTAL, the spec change has been updated to reflect the decision at the language meeting yesterday: All clashes are conflicts, even abstract/abstract. |
8791e77
to
bd37ac1
Compare
The commentary about the private collisions was extended to motivate the error for some abstract-on-concrete cases. |
Proposed rules for a mixin related name clash error, cf. dart-lang/sdk#28809 and dart-lang/sdk#45959.
This PR adjusts the language specification section 'Mixin Application' such that it specifies the error which arises when an override relationship arises among two concrete declarations with a private name
n
in a libraryL
because of a mixin application that occurs outsideL
.Note that it is an error in all cases where the mixin application outside
lib.dart
creates an override relationship for a member with a private name (for instance, such thatA._foo
is overridden byMA._foo
), even in the cases where the given members are already associated with each other by declarations (e.g.,MA._foo
is connected toA._foo
byimplements A
, but it is still an error to haveA with MA
inother.dart
).