Skip to content

Commit 1a0ecbd

Browse files
committed
Review response
1 parent 602cfbb commit 1a0ecbd

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

accepted/future-releases/extension-types/feature-specification.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ information about the process, including in their change logs.
1515
[1]: https://github.com/dart-lang/language/blob/master/working/1426-extension-types/feature-specification-views.md
1616
[2]: https://github.com/dart-lang/language/blob/master/working/extension_structs/overview.md
1717

18+
2023.10.31
19+
- Simplify the rules about the relationship between extension types and the
20+
types `Object` and `Object?`.
21+
1822
2023.10.25
1923
- Allow an extension type to have `implements T` where `T` is a
2024
supertype of the representation type (the old rule only allows
@@ -983,11 +987,10 @@ non-nullable, unless it implements `Object` or a subtype thereof
983987
*That is, an expression of an extension type can be assigned to a top type
984988
(like all other expressions). Non-extension types (except bottom types and
985989
`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.*
991994

992995
In the body of a member of an extension type declaration _DV_ named
993996
`Name` and declaring the type parameters
@@ -1372,12 +1375,13 @@ relationships involving `V0`:*
13721375
- *`V0` is a proper subtype of `Object?`.*
13731376
- *`V0` is a proper supertype of `Never`.*
13741377
- *`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`
13811385
(e.g., `List<V0>` is equal to `List<R0>`).*
13821386

13831387

0 commit comments

Comments
 (0)