@@ -15,6 +15,12 @@ information about the process, including in their change logs.
15
15
[ 1 ] : https://github.com/dart-lang/language/blob/master/working/1426-extension-types/feature-specification-views.md
16
16
[ 2 ] : https://github.com/dart-lang/language/blob/master/working/extension_structs/overview.md
17
17
18
+ 2023.08.17
19
+ - Add covariance subtype rule for extension types. Add rule that it is an
20
+ error for an extension type member to be abstract. Mention that it is
21
+ allowed for extension type members to be external. Adjust the notion of
22
+ the 'depth' of a type such that ` UP ` can be used with extension types.
23
+
18
24
2023.07.13
19
25
- Revise many details, in particular the management of ambiguities
20
26
involving extension type members and non-extension type members.
@@ -688,6 +694,19 @@ Member Conflicts' occur as well in an extension type declaration.
688
694
and has an instance member named ` V ` , and it is a compile-time error if it
689
695
has a type parameter named ` X ` and it has an instance member named ` X ` .*
690
696
697
+ It is a compile-time error if a member declaration in an extension type
698
+ declaration is abstract.
699
+
700
+ * Extension type member invocations and tear-offs are always statically
701
+ resolved, and abstract members only make sense in the case where the given
702
+ member is resolved at run time.*
703
+
704
+ * It is not an error for an extension type member to have the modifier
705
+ ` external ` . As usual, an implementation can report a compile-time error for
706
+ external declarations, e.g., if they are not bound to an implementation,
707
+ and the method by which they are bound to an implementation is tool
708
+ specific.*
709
+
691
710
Assume that
692
711
<code >T<sub >1</sub >, .. T<sub >s</sub ></code >
693
712
are types, and ` V ` resolves to an extension type declaration of the
@@ -1178,6 +1197,45 @@ all members of `V1, .. Vk` that are not redeclared by a declaration in _DV_
1178
1197
can be invoked on a receiver of the type introduced by _ DV_ .*
1179
1198
1180
1199
1200
+ ### Changes to other types and subtyping
1201
+
1202
+ The previous sections have introduced some subtype relationships involving
1203
+ extension types. This section adds further relationships where extension
1204
+ types occur more indirectly.
1205
+
1206
+ * For instance, earlier sections stated that every extension type is a
1207
+ subtype of the top types (like ` Object? ` ), and that ` implements ` introduces
1208
+ a subtype relationship for extension types. Moreover:*
1209
+
1210
+ Assume that ` E ` denotes an extension type that takes ` k ` type arguments.
1211
+ Corresponding to the subtype rule about covariance for classes, a rule is
1212
+ introduced which makes <code >E\< S<sub >1</sub > .. S<sub >k</sub >></code > a
1213
+ subtype of <code >E\< T<sub >1</sub > .. T<sub >k</sub >></code > if
1214
+ <code >S<sub >j</sub ></code > is a subtype of <code >T<sub >j</sub ></code > for
1215
+ each ` j ` in 1 .. k.
1216
+
1217
+ * For example, ` E<int> ` is a subtype of ` E<Object> ` because ` int ` is a
1218
+ subtype of ` Object ` , also in the case where ` E ` is an extension type.*
1219
+
1220
+ The Dart 1 algorithm which is used to compute the standard upper bound of
1221
+ two distinct interface types will work in the same way as it does today,
1222
+ albeit on a slightly different superinterface graph:
1223
+
1224
+ For the purpose of this algorithm, we consider ` Object? ` to be a
1225
+ superinterface of ` Null ` and ` Object ` , and the path lengths mentioned in
1226
+ the algorithm will increase by one * (because they start from ` Object? `
1227
+ rather than from ` Object ` )* .
1228
+
1229
+ * This change is needed because some extension types are subtypes of
1230
+ ` Object? ` and not subtypes of ` Object ` , and they need to have a
1231
+ well-defined depth. Note that the depth of an extension type can be
1232
+ determined by its actual type arguments, if any, because type parameters of
1233
+ the extension type may occur in its representation type. In particular, the
1234
+ depth of an extension type is a property of the type itself, and it is not
1235
+ always possible to determine the depth from the associated extension type
1236
+ declaration.*
1237
+
1238
+
1181
1239
## Dynamic Semantics of Extension Types
1182
1240
1183
1241
For any given syntactic construct which has been characterized as an
0 commit comments