@@ -10676,6 +10676,13 @@ \subsubsection{Lists}
10676
10676
the result of evaluating a constant expression.%
10677
10677
}
10678
10678
10679
+ \LMHash{}%
10680
+ The canonical instance of a constant list literal has a type argument
10681
+ which is transitively alias expanded
10682
+ (\ref{typedef})
10683
+ and normalized
10684
+ (\ref{typeNormalization}).
10685
+
10679
10686
\LMHash{}%
10680
10687
A run-time list literal
10681
10688
\code{<$T$>[\List{\ell}{1}{m}]}
@@ -11490,6 +11497,13 @@ \subsubsection{Sets}
11490
11497
the result of evaluating a constant expression.%
11491
11498
}
11492
11499
11500
+ \LMHash{}%
11501
+ The canonical instance of a constant set literal has a type argument
11502
+ which is transitively alias expanded
11503
+ (\ref{typedef})
11504
+ and normalized
11505
+ (\ref{typeNormalization}).
11506
+
11493
11507
\LMHash{}%
11494
11508
A run-time set literal \code{<$T$>\{\List{\ell}{1}{n}\}}
11495
11509
is evaluated as follows:
@@ -11685,6 +11699,13 @@ \subsubsection{Maps}
11685
11699
the result of evaluating a constant expression.%
11686
11700
}
11687
11701
11702
+ \LMHash{}%
11703
+ The canonical instance of a constant map literal has type arguments
11704
+ which are transitively alias expanded
11705
+ (\ref{typedef})
11706
+ and normalized
11707
+ (\ref{typeNormalization}).
11708
+
11688
11709
\LMHash{}%
11689
11710
A run-time map literal
11690
11711
\code{<$T_1, T_2$>\{\List{\ell}{1}{m}\}}
@@ -12504,6 +12525,14 @@ \subsubsection{Const}
12504
12525
The constructor need only be executed once per call site, at compile time.%
12505
12526
}
12506
12527
12528
+ \LMHash{}%
12529
+ For instances of a generic class,
12530
+ the canonical instance of a constant object expression has type arguments
12531
+ which are transitively alias expanded
12532
+ (\ref{typedef})
12533
+ and normalized
12534
+ (\ref{typeNormalization}).
12535
+
12507
12536
\LMHash{}%
12508
12537
It is a \Error{compile-time error} if evaluation of a constant object
12509
12538
results in an uncaught exception being thrown.
@@ -13580,6 +13609,14 @@ \subsection{Function Closurization}
13580
13609
are canonicalized.%
13581
13610
}
13582
13611
13612
+ \LMHash{}%
13613
+ The canonical instance of a constant function closurization has
13614
+ parameter types and a return type
13615
+ which are transitively alias expanded
13616
+ (\ref{typedef})
13617
+ and normalized
13618
+ (\ref{typeNormalization}).
13619
+
13583
13620
13584
13621
\subsection{Generic Function Instantiation}
13585
13622
\LMLabel{genericFunctionInstantiation}
@@ -24696,36 +24733,10 @@ \subsubsection{Null promotion}
24696
24733
These are extended as per
24697
24734
[separate proposal](https://github.com/dart-lang/language/blob/master/resources/type-system/flow-analysis.md).
24698
24735
24699
-
24700
24736
\paragraph{Constant instances}
24701
24737
24702
24738
!!!TODO!!!
24703
24739
24704
- Any two instances which are otherwise identical except for their
24705
- generic type arguments shall be considered identical if those generic
24706
- type arguments compare equal using the definition of runtime type
24707
- object equality defined above. That is, comparison (or
24708
- canonicalization) of constant instances of generic classes is
24709
- performed relative to the normal forms of their generic type
24710
- arguments. Hence, an instance of \code{$C$<$T_0$>} compares identical
24711
- to \code{C<$T_1$>} if $T_0$ and $T_1$ have the same normal form (up to
24712
- the identity of bound variables), and the objects are otherwise
24713
- identical.
24714
-
24715
- Implementations of the Dart runtime semantics rely on canonicalization of
24716
- constant objects to allow the identity semantics specified above to be
24717
- implemented as fast pointer equality checks on the reference to the canonical
24718
- form. The definition above defines equivalence classes of constant objects for
24719
- which we must choose the canonical representative.
24720
-
24721
- We define the choice of the canonical instance representing an
24722
- equivalence class of constant objects as follows.
24723
-
24724
- All generic constant constructors and generic constant
24725
- literals are evaluated using the type arguments provided, and canonicalization
24726
- is performed with respect to the normal form of the type arguments. This
24727
- ensures a consistent semantics, since it is not observable which instance is
24728
- chosen as the canonical representative.
24729
24740
24730
24741
\subsubsection{Null check operator}
24731
24742
0 commit comments