@@ -22536,18 +22536,20 @@ \subsection{Subtypes}
22536
22536
% ------------------------------------------------ Positional Function Type
22537
22537
\RuleRawRaw{\SrnPositionalFunctionType}{%
22538
22538
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22539
+ \forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
22539
22540
\Subtype{\Delta'}{S_0}{T_0} \\
22540
22541
n_1 \leq n_2 &
22541
22542
n_1 + k_1 \geq n_2 + k_2 &
22542
22543
\forall j \in 1 .. n_2 + k_2\!:\;\Subtype{\Delta'}{T_j}{S_j}}{%
22543
22544
\begin{array}{c}
22544
22545
\Delta\vdash\RawFunctionTypePositional{S_0}{X}{B}{s}{S}{n_1}{k_1}\;<:\;\\
22545
- \RawFunctionTypePositional{T_0}{X}{B}{s}{T}{n_2}{k_2}
22546
+ \RawFunctionTypePositional{T_0}{X}{B'\! }{s}{T}{n_2}{k_2}
22546
22547
\end{array}}
22547
22548
\ExtraVSP\ExtraVSP
22548
22549
% ------------------------------------------------ Named Function Type
22549
22550
\RuleRawRaw{\SrnNamedFunctionType}{%
22550
22551
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22552
+ \forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
22551
22553
\Subtype{\Delta'}{S_0}{T_0} &
22552
22554
\forall j \in 1 .. n\!:\;\Subtype{\Delta'}{T_j}{S_j}\\
22553
22555
\{\,\List{y}{n+1}{n+k_2}\,\} \subseteq \{\,\List{x}{n+1}{n+k_1}\,\}\\
@@ -22557,13 +22559,16 @@ \subsection{Subtypes}
22557
22559
(r_{n+q} = \REQUIRED{} \Rightarrow r'_{n+p} = \REQUIRED)}{%
22558
22560
\begin{array}{c}
22559
22561
\Delta\vdash\RawFunctionTypeNamed{S_0}{X}{B}{s}{S}{n}{x}{k_1}{r}\;<:\;\\
22560
- \RawFunctionTypeNamed{T_0}{X}{B}{s}{T}{n}{y}{k_2}{r'}
22562
+ \RawFunctionTypeNamed{T_0}{X}{B'\! }{s}{T}{n}{y}{k_2}{r'}
22561
22563
\end{array}}
22562
22564
%
22563
22565
\ExtraVSP
22564
22566
% ------------------------------------------------ Covariance
22567
+ %% TODO(eernst): Type aliases have been expanded so there is no other
22568
+ %% variance than covariance, but there will be in/out/inout in classes,
22569
+ %% and then we'll need to handle variance here.
22565
22570
\RuleRaw{\SrnCovariance}{%
22566
- \mbox{$C$ is an interface type with $s$ type parameters} &
22571
+ \mbox{$C$ is an interface type with $s$ type parameters. } &
22567
22572
\SubtypeStd{S_j}{T_j}\mbox{, for each $j \in 1..s$}}{%
22568
22573
\code{$C$<\List{S}{1}{s}>}}{\code{$C$<\List{T}{1}{s}>}}
22569
22574
\ExtraVSP
@@ -22728,7 +22733,8 @@ \subsubsection{Subtype Rules}
22728
22733
In this specification we frequently refer to
22729
22734
subtype relationships and assignability
22730
22735
without mentioning the environment explicitly,
22731
- as in \Index{\SubtypeNE{S}{T}}.
22736
+ as in
22737
+ \IndexCustom{\SubtypeNE{S}{T}}{$<:$@\SubtypeNE{S}{T}}.
22732
22738
This is only done when a specific location in code is in focus,
22733
22739
and it means that the environment is that which is obtained
22734
22740
by mapping each type variable in scope at that location
@@ -22762,7 +22768,7 @@ \subsubsection{Being a Subtype}
22762
22768
A type $S$ is shown to be a \Index{subtype} of another type $T$
22763
22769
in an environment $\Delta$ by providing
22764
22770
an instantiation of a rule $R$ whose conclusion is
22765
- \IndexCustom{\SubtypeStd{S}{T}}{$\Delta$@\SubtypeStd{S}{T}},
22771
+ \IndexCustom{\SubtypeStd{S}{T}}{$\Delta<: $@\SubtypeStd{S}{T}},
22766
22772
along with rule instantiations showing
22767
22773
each of the premises of $R$,
22768
22774
continuing until a rule with no premises is reached.
@@ -22991,9 +22997,17 @@ \subsubsection{Additional Subtyping Concepts}
22991
22997
22992
22998
\LMHash{}%
22993
22999
$S$ is a \Index{supertype} of $T$ in a given environment $\Delta$,
22994
- written \SupertypeStd{S}{T},
23000
+ written
23001
+ \IndexCustom{\SupertypeStd{S}{T}}{$\Delta:>$@\SupertypeStd{S}{T}},
22995
23002
if{}f \SubtypeStd{T}{S}.
22996
23003
23004
+ \LMHash{}%
23005
+ $S$ and $T$ are \Index{mutual subtypes} of each other
23006
+ in a given environment $\Delta$,
23007
+ written
23008
+ \IndexCustom{\MutualSubtypeStd{S}{T}}{$\Delta<:>$@\MutualSubtypeStd{S}{T}},
23009
+ if{}f both \SubtypeStd{T}{S} and \SubtypeStd{S}{T}.
23010
+
22997
23011
\LMHash{}%
22998
23012
A type $T$
22999
23013
\Index{may be assigned}
@@ -23151,7 +23165,8 @@ \subsection{Functions Dealing with Extreme Types}
23151
23165
the first applicable case must be used.
23152
23166
23153
23167
\LMHash{}%
23154
- The \Index{\TopMergeTypeName} of two types computes
23168
+ The \IndexCustom{\TopMergeTypeName}{topMergeType@\TopMergeTypeName}
23169
+ of two types computes
23155
23170
a canonical type which represents both of them,
23156
23171
in the case where they are structurally identical
23157
23172
modulo the choice among top types.
@@ -23216,7 +23231,8 @@ \subsection{Functions Dealing with Extreme Types}
23216
23231
\commentary{The ordering of the arguments makes no difference.}
23217
23232
23218
23233
\LMHash{}%
23219
- The \Index{\IsTopTypeName} predicate is true for any type which is in
23234
+ The \IndexCustom{\IsTopTypeName}{isTopType@\IsTopTypeName}
23235
+ predicate is true for any type which is in
23220
23236
the equivalence class of top types.
23221
23237
It is a syntactic characterization of top types
23222
23238
(\ref{superBoundedTypes}).
@@ -23230,8 +23246,9 @@ \subsection{Functions Dealing with Extreme Types}
23230
23246
\end{itemize}
23231
23247
23232
23248
\noindent
23233
- The \Index{\IsObjectTypeName} predicate is true if{}f
23234
- the argument is a subtype and a supertype of \code{Object}.
23249
+ The \IndexCustom{\IsObjectTypeName}{isObjectType@\IsObjectTypeName}
23250
+ predicate is true if{}f the argument is
23251
+ a subtype and a supertype of \code{Object}.
23235
23252
23236
23253
\begin{itemize}
23237
23254
\item \DefEquals{\IsObjectType{Object}}{\metavar{true}}.
@@ -23240,8 +23257,8 @@ \subsection{Functions Dealing with Extreme Types}
23240
23257
\end{itemize}
23241
23258
23242
23259
\noindent
23243
- The \Index {\IsBottomTypeName} predicate is true if{}f
23244
- the argument is a subtype of \code{Never}.
23260
+ The \IndexCustom {\IsBottomTypeName}{isBottomType@\IsBottomTypeName}
23261
+ predicate is true if{}f the argument is a subtype of \code{Never}.
23245
23262
23246
23263
\begin{itemize}
23247
23264
\item \DefEquals{\IsBottomType{Never}}{\metavar{true}}.
@@ -23251,8 +23268,9 @@ \subsection{Functions Dealing with Extreme Types}
23251
23268
\end{itemize}
23252
23269
23253
23270
\noindent
23254
- The \Index{\IsNullTypeName} predicate is true if{}f
23255
- the argument is a subtype and a supertype of \code{Null}.
23271
+ The \IndexCustom{\IsNullTypeName}{isNullType@\IsNullTypeName}
23272
+ predicate is true if{}f the argument is
23273
+ a subtype and a supertype of \code{Null}.
23256
23274
23257
23275
\begin{itemize}
23258
23276
\item \DefEquals{\IsNullType{Null}}{\metavar{true}}.
@@ -23261,8 +23279,8 @@ \subsection{Functions Dealing with Extreme Types}
23261
23279
\end{itemize}
23262
23280
23263
23281
\noindent
23264
- The \Index {\IsMoreTopTypeName} predicate defines a total order on
23265
- top and \code{Object} types.
23282
+ The \IndexCustom {\IsMoreTopTypeName}{isMoreTopType@\IsMoreTopTypeName}
23283
+ predicate defines a total order on top and \code{Object} types.
23266
23284
23267
23285
\begin{itemize}
23268
23286
\item \DefEquals{\IsMoreTopType{\VOID}{$T$}}{\metavar{true}}.
@@ -23279,8 +23297,8 @@ \subsection{Functions Dealing with Extreme Types}
23279
23297
\end{itemize}
23280
23298
23281
23299
\noindent
23282
- The \Index {\IsMoreBottomTypeName} predicate defines an almost total order on
23283
- bottom and \code{Null} types.
23300
+ The \IndexCustom {\IsMoreBottomTypeName}{isMoreBottomType@\IsMoreBottomTypeName}
23301
+ predicate defines an almost total order on bottom and \code{Null} types.
23284
23302
\commentary{%
23285
23303
This does not consistently order
23286
23304
two different type variables with the same bound.%
@@ -23359,7 +23377,9 @@ \subsection{Type Normalization}
23359
23377
}
23360
23378
23361
23379
\LMHash{}%
23362
- The function \Index{\NormalizedTypeOfName} is then defined as follows:
23380
+ The function
23381
+ \IndexCustom{\NormalizedTypeOfName}{normalizedType@\NormalizedTypeOfName}
23382
+ is then defined as follows:
23363
23383
\BlindDefineSymbol{T_a, T_u, T_r}%
23364
23384
Let $T_a$ be a type
23365
23385
(\commentary{where `a' stands for `argument'}).
0 commit comments