@@ -15,6 +15,10 @@ 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.10.31
19
+ - Simplify the rules about the relationship between extension types and the
20
+ types ` Object ` and ` Object? ` .
21
+
18
22
2023.10.25
19
23
- Allow an extension type to have ` implements T ` where ` T ` is a
20
24
supertype of the representation type (the old rule only allows
@@ -983,11 +987,10 @@ non-nullable, unless it implements `Object` or a subtype thereof
983
987
* That is, an expression of an extension type can be assigned to a top type
984
988
(like all other expressions). Non-extension types (except bottom types and
985
989
` dynamic ` ) cannot be assigned to extension types without an explicit cast.
986
- Similarly, null cannot be assigned to an extension type without an explicit
987
- cast (even better: don't use a cast, call a constructor instead). Another
988
- consequence of the fact that the extension type is potentially non-nullable is
989
- that it is an error to have an instance variable whose type is an extension
990
- type, and then relying on implicit initialization to null.*
990
+ Similarly, the null object cannot be assigned to an extension type without
991
+ an explicit cast (or a constructor invocation). Since an extension type is
992
+ potentially non-nullable, an instance variable whose type is an extension
993
+ type must be initialized. It will not be implicitly initialized to null.*
991
994
992
995
In the body of a member of an extension type declaration _ DV_ named
993
996
` Name ` and declaring the type parameters
@@ -1372,12 +1375,13 @@ relationships involving `V0`:*
1372
1375
- * ` V0 ` is a proper subtype of ` Object? ` .*
1373
1376
- * ` V0 ` is a proper supertype of ` Never ` .*
1374
1377
- * ` V0 ` is a proper subtype of each of ` V1 .. Vk ` .*
1375
- - * At run time, the type ` V0 ` is identical to the extension type erasure
1376
- ` R0 ` . In particular, ` o is V0 ` and ` o as V0 ` have the same dynamic
1377
- semantics as ` o is R0 ` respectively ` o as R0 ` , and
1378
- ` t1 == t2 ` evaluates to true if ` t1 ` is a ` Type ` that reifies
1379
- ` V0 ` and ` t2 ` reifies ` R0 ` , and the equality also holds if
1380
- ` t1 ` and ` t2 ` reify types where ` V0 ` and ` R0 ` occur as subterms
1378
+ - * Let ` R0 ` be the extension type erasure of ` V0 ` . At run time, the type
1379
+ ` V0 ` has the same representation and semantics as ` R0 ` . In particular,
1380
+ ` o is V0 ` and ` o as V0 ` have the same dynamic semantics as ` o is R0 `
1381
+ respectively ` o as R0 ` . ` t1 == t2 ` evaluates to true if ` t1 ` is a
1382
+ ` Type ` that reifies ` V0 ` and ` t2 ` reifies ` R0 ` . Similarly, two types ` t1 `
1383
+ and ` t2 ` are equal if they are structurally equal except that ` V0 ` occurs
1384
+ in ` t1 ` and ` R0 ` occurs at the corresponding location in ` t2 `
1381
1385
(e.g., ` List<V0> ` is equal to ` List<R0> ` ).*
1382
1386
1383
1387
0 commit comments