@@ -3254,13 +3254,13 @@ \subsubsection{The Operator `=='}
3254
3254
if the dynamic type of $o$ is a class $C$,
3255
3255
and $C$ has a primitive operator \lit{==}.
3256
3256
\item The class \code{Object} has a primitive operator \lit{==}.
3257
+ \item The class \code{Null} has a primitive operator \lit{==}.
3257
3258
\item A class $C$ has a primitive operator \lit{==}
3258
3259
if it does not have an implementation of the operator \lit{==}
3259
3260
that overrides the one inherited from \code{Object}.
3260
3261
\commentary{%
3261
3262
In particular, the following have a primitive operator \lit{==}:
3262
- The null object (\ref{null}),
3263
- function objects obtained by function closurization of
3263
+ Function objects obtained by function closurization of
3264
3264
a static method or a top-level function
3265
3265
(\ref{functionClosurization}),
3266
3266
instances of type \code{bool}
@@ -8669,20 +8669,8 @@ \subsection{Null}
8669
8669
\end{grammar}
8670
8670
8671
8671
\LMHash{}%
8672
- The null object is the sole instance of the built-in class \code{Null}.
8673
- % The following can be a consequence of the declaration of `Null`,
8674
- % but we don't spell that out, we just require that it is an error.
8675
- Attempting to instantiate \code{Null} causes a compile-time error.
8676
- It is a compile-time error for a class to extend, mix in or implement
8677
- \code{Null}.
8678
- The \code{Null} class extends the \code{Object} class
8679
- and declares no methods except those also declared by \code{Object}.
8680
- In particular, the \code{Null} class does not override the \lit{==} operator
8681
- inherited from the \code{Object} class.
8682
-
8683
- \LMHash{}%
8684
- The static type of \NULL{} is the \code{Null} type.
8685
-
8672
+ The static type of \NULL{} is the \code{Null} type
8673
+ (\ref{typeNull}).
8686
8674
8687
8675
\subsection{Numbers}
8688
8676
\LMLabel{numbers}
@@ -21383,7 +21371,7 @@ \subsection{Type \code{Never}}
21383
21371
21384
21372
\LMHash{}%
21385
21373
The Dart core library \code{dart:core} exports a type named \code{Never}.
21386
- No object has dynamic type \code{Never}.
21374
+ No object has a dynamic type which is \code{Never} or a subtype thereof .
21387
21375
21388
21376
\commentary{%
21389
21377
In other words, \code{Never} is the empty type.
@@ -21410,24 +21398,40 @@ \subsection{Type \code{Null}}
21410
21398
\LMLabel{typeNull}
21411
21399
21412
21400
\LMHash{}%
21413
- The Dart core library \code{dart:core} exports a type named \code{Null},
21401
+ The Dart core library \code{dart:core} exports a type named \code{Null}.
21414
21402
There is exactly one object whose dynamic type is \code{Null},
21415
- and that is the null object.
21403
+ and that is the null object
21404
+ (\ref{null}).
21416
21405
21417
21406
\commentary{%
21418
21407
In other words, \code{Null} is a singleton type.
21419
- \code{Null} is a subtype of all other types
21420
- other than \code{Never} and any type which is
21421
- a subtype of \code{Never}
21408
+ Apart from top types
21409
+ (\ref{superBoundedTypes}),
21410
+ \code{Null} is a subtype of all types of the form \code{$T$?},
21411
+ and of all types $S$ such that \futureOrBase{S} is one of the above.
21412
+ The only non-trivial subtypes of \code{Null} are
21413
+ \code{Never} and subtypes of \code{Never}
21422
21414
(\ref{subtypeRules}).%
21423
21415
}
21424
21416
21417
+ \LMHash{}%
21418
+ Attempting to instantiate \code{Null} causes a compile-time error.
21419
+ It is a compile-time error for a class to extend, mix in or implement
21420
+ \code{Null}.
21421
+ The \code{Null} class declares exactly the same members
21422
+ with the same signatures as the class \code{Object}.
21423
+
21424
+ \commentary{%
21425
+ The \code{Null} class has a primitive \lit{==} operator
21426
+ (\ref{theOperatorEqualsEquals}).%
21427
+ }
21428
+
21425
21429
\rationale{%
21426
21430
\code{Null} is mainly used implicitly in
21427
21431
a type of the form \code{$T$?} for some $T$.
21428
21432
If $e$ is an expression of type \code{$T$?} that evaluates to an object $o$,
21429
21433
then $o$ can be an instance of a subtype of $T$,
21430
- or it could be the null object.
21434
+ or it can be the null object.
21431
21435
The latter situation is commonly interpreted to mean that
21432
21436
the computation did not yield a result.
21433
21437
In this sense, \code{Null} can be considered to model
0 commit comments