@@ -10484,6 +10484,13 @@ \subsubsection{Lists}
10484
10484
the result of evaluating a constant expression.%
10485
10485
}
10486
10486
10487
+ \LMHash{}%
10488
+ The canonical instance of a constant list literal has a type argument
10489
+ which is transitively alias expanded
10490
+ (\ref{typedef})
10491
+ and normalized
10492
+ (\ref{typeNormalization}).
10493
+
10487
10494
\LMHash{}%
10488
10495
A run-time list literal
10489
10496
\code{<$T$>[\List{\ell}{1}{m}]}
@@ -11298,6 +11305,13 @@ \subsubsection{Sets}
11298
11305
the result of evaluating a constant expression.%
11299
11306
}
11300
11307
11308
+ \LMHash{}%
11309
+ The canonical instance of a constant set literal has a type argument
11310
+ which is transitively alias expanded
11311
+ (\ref{typedef})
11312
+ and normalized
11313
+ (\ref{typeNormalization}).
11314
+
11301
11315
\LMHash{}%
11302
11316
A run-time set literal \code{<$T$>\{\List{\ell}{1}{n}\}}
11303
11317
is evaluated as follows:
@@ -11493,6 +11507,13 @@ \subsubsection{Maps}
11493
11507
the result of evaluating a constant expression.%
11494
11508
}
11495
11509
11510
+ \LMHash{}%
11511
+ The canonical instance of a constant map literal has type arguments
11512
+ which are transitively alias expanded
11513
+ (\ref{typedef})
11514
+ and normalized
11515
+ (\ref{typeNormalization}).
11516
+
11496
11517
\LMHash{}%
11497
11518
A run-time map literal
11498
11519
\code{<$T_1, T_2$>\{\List{\ell}{1}{m}\}}
@@ -12306,6 +12327,14 @@ \subsubsection{Const}
12306
12327
The constructor need only be executed once per call site, at compile time.%
12307
12328
}
12308
12329
12330
+ \LMHash{}%
12331
+ For instances of a generic class,
12332
+ the canonical instance of a constant object expression has type arguments
12333
+ which are transitively alias expanded
12334
+ (\ref{typedef})
12335
+ and normalized
12336
+ (\ref{typeNormalization}).
12337
+
12309
12338
\LMHash{}%
12310
12339
It is a \Error{compile-time error} if evaluation of a constant object
12311
12340
results in an uncaught exception being thrown.
@@ -13382,6 +13411,14 @@ \subsection{Function Closurization}
13382
13411
are canonicalized.%
13383
13412
}
13384
13413
13414
+ \LMHash{}%
13415
+ The canonical instance of a constant function closurization has
13416
+ parameter types and a return type
13417
+ which are transitively alias expanded
13418
+ (\ref{typedef})
13419
+ and normalized
13420
+ (\ref{typeNormalization}).
13421
+
13385
13422
13386
13423
\subsection{Generic Function Instantiation}
13387
13424
\LMLabel{genericFunctionInstantiation}
@@ -24319,36 +24356,10 @@ \subsubsection{Null promotion}
24319
24356
These are extended as per
24320
24357
[separate proposal](https://github.com/dart-lang/language/blob/master/resources/type-system/flow-analysis.md).
24321
24358
24322
-
24323
24359
\paragraph{Constant instances}
24324
24360
24325
24361
!!!TODO!!!
24326
24362
24327
- Any two instances which are otherwise identical except for their
24328
- generic type arguments shall be considered identical if those generic
24329
- type arguments compare equal using the definition of runtime type
24330
- object equality defined above. That is, comparison (or
24331
- canonicalization) of constant instances of generic classes is
24332
- performed relative to the normal forms of their generic type
24333
- arguments. Hence, an instance of \code{$C$<$T_0$>} compares identical
24334
- to \code{C<$T_1$>} if $T_0$ and $T_1$ have the same normal form (up to
24335
- the identity of bound variables), and the objects are otherwise
24336
- identical.
24337
-
24338
- Implementations of the Dart runtime semantics rely on canonicalization of
24339
- constant objects to allow the identity semantics specified above to be
24340
- implemented as fast pointer equality checks on the reference to the canonical
24341
- form. The definition above defines equivalence classes of constant objects for
24342
- which we must choose the canonical representative.
24343
-
24344
- We define the choice of the canonical instance representing an
24345
- equivalence class of constant objects as follows.
24346
-
24347
- All generic constant constructors and generic constant
24348
- literals are evaluated using the type arguments provided, and canonicalization
24349
- is performed with respect to the normal form of the type arguments. This
24350
- ensures a consistent semantics, since it is not observable which instance is
24351
- chosen as the canonical representative.
24352
24363
24353
24364
\subsubsection{Null check operator}
24354
24365
0 commit comments