-
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
Change extension types such that they must declare subtype relations to Object
#3434
Conversation
Object
Object
@scheglov, @johnniwinther, @chloestefantsova, the language team accepted this simplification of the rules about the superinterface graph structure of an extension type. Sorry about the wasted work which has been done in order to handle the previous ruleset! Nevertheless, I'm sure we will be happy in the future about having these new, simpler rules. |
accepted/future-releases/extension-types/feature-specification.md
Outdated
Show resolved
Hide resolved
accepted/future-releases/extension-types/feature-specification.md
Outdated
Show resolved
Hide resolved
accepted/future-releases/extension-types/feature-specification.md
Outdated
Show resolved
Hide resolved
accepted/future-releases/extension-types/feature-specification.md
Outdated
Show resolved
Hide resolved
accepted/future-releases/extension-types/feature-specification.md
Outdated
Show resolved
Hide resolved
accepted/future-releases/extension-types/feature-specification.md
Outdated
Show resolved
Hide resolved
This is a prerequisite to the implementation of dart-lang/language#3434 Closes #53840 Part of #49731 Change-Id: Ib3bb5961cd8c4919cbc8c8ba37ac4d76fb72a3de Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333000 Commit-Queue: Chloe Stefantsova <[email protected]> Reviewed-by: Johnni Winther <[email protected]>
7bcc24a
to
878dca3
Compare
Is this one ready to land? The text still says that for the purpose of computing the Dart 1 least upper bound, we pretend that the superinterface graph has a top node. That's simple to say and simple to understand, but the existence of the top node may be controversial, even though it's clearly labeled as being only for this single purpose. |
See the proposal in #3415. This PR changes the extension type feature specification such that the nullability of the representation type does not matter for the determination of the superinterface graph and subtype relationships of the types expressed based on a given extension type declaration:
An extension type is always a proper subtype of
Object?
, and as such it is potentially nullable (unless some further subtype relations exist). An extension type can declare that itimplements T
for variousT
, and this may cause the extension type to be a subtype ofObject
(directly or indirectly). In this case the extension type is non-nullable.This change is a substantial simplification because the superinterface graph is shared among of all types
E<T1 .. Tk>
whereE
resolves to an extension type declaration (which includes the non-generic case whenk
is0
).(In contrast, with the current feature specification, we could have an extension type
E
such that the superinterface graph ofE<int>
was different from the superinterface graph ofE<int?>
. They will now always have the same superinterface graph, though possibly with different actual type arguments in each node of the graph.)