[inline-classes] Make super
an error?
#3087
Labels
extension-types
inline-classes
Cf. language/accepted/future-releases/inline-classes/feature-specification.md
question
Further information is requested
Thanks for @sgrekhov for noticing this.
The inline class feature specification does not specify the treatment of
super
in the bodies of instance members.An expression whose type is an inline class can be the receiver of member invocations where the member is declared in any of its superinterfaces, direct or indirect, as long as the given declaration isn't redeclared by some other declaration with the same name in a "nearer" superinterface. Conflicts are resolved by redeclaring a member with the same name (but it is not required that the redeclaration is a correct override). For example:
Hence, an inline class cannot treat
super
in a way that resembles the treatment in a regular class:super
would need to be disambiguated in cases likesuper.foo()
inB
. Some proposals were put forward about using constructs likeA1.super.foo()
to disambiguate the invocation, but those proposals did not receive much support. Moreover, it may be misleading to usesuper
to callA1.foo
fromB
(from the body ofB.foo
or anywhere else), because it is simply a different member thanB.foo
(we never choose betweenA1.foo
andB.foo
based on dispatch at run time).If we do come up with a useful treatment of
super
in an inline class then we will be able to do whatever we want, if it is made an error for now.I tend to think that we should simply make all occurrences of
super
in an inline class a compile-time error at this time.@dart-lang/language-team, WDYT?
The text was updated successfully, but these errors were encountered: