@@ -22556,18 +22556,20 @@ \subsection{Subtypes}
22556
22556
% ------------------------------------------------ Positional Function Type
22557
22557
\RuleRawRaw{\SrnPositionalFunctionType}{%
22558
22558
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22559
+ \forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
22559
22560
\Subtype{\Delta'}{S_0}{T_0} \\
22560
22561
n_1 \leq n_2 &
22561
22562
n_1 + k_1 \geq n_2 + k_2 &
22562
22563
\forall j \in 1 .. n_2 + k_2\!:\;\Subtype{\Delta'}{T_j}{S_j}}{%
22563
22564
\begin{array}{c}
22564
22565
\Delta\vdash\RawFunctionTypePositional{S_0}{X}{B}{s}{S}{n_1}{k_1}\;<:\;\\
22565
- \RawFunctionTypePositional{T_0}{X}{B}{s}{T}{n_2}{k_2}
22566
+ \RawFunctionTypePositional{T_0}{X}{B'\! }{s}{T}{n_2}{k_2}
22566
22567
\end{array}}
22567
22568
\ExtraVSP\ExtraVSP
22568
22569
% ------------------------------------------------ Named Function Type
22569
22570
\RuleRawRaw{\SrnNamedFunctionType}{%
22570
22571
\Delta' = \Delta\uplus\{X_i\mapsto{}B_i\,|\,1 \leq i \leq s\} &
22572
+ \forall i \in 1..s\!:\;\MutualSubtype{\Delta'}{B_i}{B'\!_i} &
22571
22573
\Subtype{\Delta'}{S_0}{T_0} &
22572
22574
\forall j \in 1 .. n\!:\;\Subtype{\Delta'}{T_j}{S_j}\\
22573
22575
\{\,\List{y}{n+1}{n+k_2}\,\} \subseteq \{\,\List{x}{n+1}{n+k_1}\,\}\\
@@ -22577,13 +22579,16 @@ \subsection{Subtypes}
22577
22579
(r_{n+q} = \REQUIRED{} \Rightarrow r'_{n+p} = \REQUIRED)}{%
22578
22580
\begin{array}{c}
22579
22581
\Delta\vdash\RawFunctionTypeNamed{S_0}{X}{B}{s}{S}{n}{x}{k_1}{r}\;<:\;\\
22580
- \RawFunctionTypeNamed{T_0}{X}{B}{s}{T}{n}{y}{k_2}{r'}
22582
+ \RawFunctionTypeNamed{T_0}{X}{B'\! }{s}{T}{n}{y}{k_2}{r'}
22581
22583
\end{array}}
22582
22584
%
22583
22585
\ExtraVSP
22584
22586
% ------------------------------------------------ Covariance
22587
+ %% TODO(eernst): Type aliases have been expanded so there is no other
22588
+ %% variance than covariance, but there will be in/out/inout in classes,
22589
+ %% and then we'll need to handle variance here.
22585
22590
\RuleRaw{\SrnCovariance}{%
22586
- \mbox{$C$ is an interface type with $s$ type parameters} &
22591
+ \mbox{$C$ is an interface type with $s$ type parameters. } &
22587
22592
\SubtypeStd{S_j}{T_j}\mbox{, for each $j \in 1..s$}}{%
22588
22593
\code{$C$<\List{S}{1}{s}>}}{\code{$C$<\List{T}{1}{s}>}}
22589
22594
\ExtraVSP
@@ -22748,7 +22753,8 @@ \subsubsection{Subtype Rules}
22748
22753
In this specification we frequently refer to
22749
22754
subtype relationships and assignability
22750
22755
without mentioning the environment explicitly,
22751
- as in \Index{\SubtypeNE{S}{T}}.
22756
+ as in
22757
+ \IndexCustom{\SubtypeNE{S}{T}}{$<:$@\SubtypeNE{S}{T}}.
22752
22758
This is only done when a specific location in code is in focus,
22753
22759
and it means that the environment is that which is obtained
22754
22760
by mapping each type variable in scope at that location
@@ -22782,7 +22788,7 @@ \subsubsection{Being a Subtype}
22782
22788
A type $S$ is shown to be a \Index{subtype} of another type $T$
22783
22789
in an environment $\Delta$ by providing
22784
22790
an instantiation of a rule $R$ whose conclusion is
22785
- \IndexCustom{\SubtypeStd{S}{T}}{$\Delta$@\SubtypeStd{S}{T}},
22791
+ \IndexCustom{\SubtypeStd{S}{T}}{$\Delta<: $@\SubtypeStd{S}{T}},
22786
22792
along with rule instantiations showing
22787
22793
each of the premises of $R$,
22788
22794
continuing until a rule with no premises is reached.
@@ -23011,9 +23017,17 @@ \subsubsection{Additional Subtyping Concepts}
23011
23017
23012
23018
\LMHash{}%
23013
23019
$S$ is a \Index{supertype} of $T$ in a given environment $\Delta$,
23014
- written \SupertypeStd{S}{T},
23020
+ written
23021
+ \IndexCustom{\SupertypeStd{S}{T}}{$\Delta:>$@\SupertypeStd{S}{T}},
23015
23022
if{}f \SubtypeStd{T}{S}.
23016
23023
23024
+ \LMHash{}%
23025
+ $S$ and $T$ are \Index{mutual subtypes} of each other
23026
+ in a given environment $\Delta$,
23027
+ written
23028
+ \IndexCustom{\MutualSubtypeStd{S}{T}}{$\Delta<:>$@\MutualSubtypeStd{S}{T}},
23029
+ if{}f both \SubtypeStd{T}{S} and \SubtypeStd{S}{T}.
23030
+
23017
23031
\LMHash{}%
23018
23032
A type $T$
23019
23033
\Index{may be assigned}
@@ -23171,7 +23185,8 @@ \subsection{Functions Dealing with Extreme Types}
23171
23185
the first applicable case must be used.
23172
23186
23173
23187
\LMHash{}%
23174
- The \Index{\TopMergeTypeName} of two types computes
23188
+ The \IndexCustom{\TopMergeTypeName}{topMergeType@\TopMergeTypeName}
23189
+ of two types computes
23175
23190
a canonical type which represents both of them,
23176
23191
in the case where they are structurally identical
23177
23192
modulo the choice among top types.
@@ -23236,7 +23251,8 @@ \subsection{Functions Dealing with Extreme Types}
23236
23251
\commentary{The ordering of the arguments makes no difference.}
23237
23252
23238
23253
\LMHash{}%
23239
- The \Index{\IsTopTypeName} predicate is true for any type which is in
23254
+ The \IndexCustom{\IsTopTypeName}{isTopType@\IsTopTypeName}
23255
+ predicate is true for any type which is in
23240
23256
the equivalence class of top types.
23241
23257
It is a syntactic characterization of top types
23242
23258
(\ref{superBoundedTypes}).
@@ -23250,8 +23266,9 @@ \subsection{Functions Dealing with Extreme Types}
23250
23266
\end{itemize}
23251
23267
23252
23268
\noindent
23253
- The \Index{\IsObjectTypeName} predicate is true if{}f
23254
- the argument is a subtype and a supertype of \code{Object}.
23269
+ The \IndexCustom{\IsObjectTypeName}{isObjectType@\IsObjectTypeName}
23270
+ predicate is true if{}f the argument is
23271
+ a subtype and a supertype of \code{Object}.
23255
23272
23256
23273
\begin{itemize}
23257
23274
\item \DefEquals{\IsObjectType{Object}}{\metavar{true}}.
@@ -23260,8 +23277,8 @@ \subsection{Functions Dealing with Extreme Types}
23260
23277
\end{itemize}
23261
23278
23262
23279
\noindent
23263
- The \Index {\IsBottomTypeName} predicate is true if{}f
23264
- the argument is a subtype of \code{Never}.
23280
+ The \IndexCustom {\IsBottomTypeName}{isBottomType@\IsBottomTypeName}
23281
+ predicate is true if{}f the argument is a subtype of \code{Never}.
23265
23282
23266
23283
\begin{itemize}
23267
23284
\item \DefEquals{\IsBottomType{Never}}{\metavar{true}}.
@@ -23271,8 +23288,9 @@ \subsection{Functions Dealing with Extreme Types}
23271
23288
\end{itemize}
23272
23289
23273
23290
\noindent
23274
- The \Index{\IsNullTypeName} predicate is true if{}f
23275
- the argument is a subtype and a supertype of \code{Null}.
23291
+ The \IndexCustom{\IsNullTypeName}{isNullType@\IsNullTypeName}
23292
+ predicate is true if{}f the argument is
23293
+ a subtype and a supertype of \code{Null}.
23276
23294
23277
23295
\begin{itemize}
23278
23296
\item \DefEquals{\IsNullType{Null}}{\metavar{true}}.
@@ -23281,8 +23299,8 @@ \subsection{Functions Dealing with Extreme Types}
23281
23299
\end{itemize}
23282
23300
23283
23301
\noindent
23284
- The \Index {\IsMoreTopTypeName} predicate defines a total order on
23285
- top and \code{Object} types.
23302
+ The \IndexCustom {\IsMoreTopTypeName}{isMoreTopType@\IsMoreTopTypeName}
23303
+ predicate defines a total order on top and \code{Object} types.
23286
23304
23287
23305
\begin{itemize}
23288
23306
\item \DefEquals{\IsMoreTopType{\VOID}{$T$}}{\metavar{true}}.
@@ -23299,8 +23317,8 @@ \subsection{Functions Dealing with Extreme Types}
23299
23317
\end{itemize}
23300
23318
23301
23319
\noindent
23302
- The \Index {\IsMoreBottomTypeName} predicate defines an almost total order on
23303
- bottom and \code{Null} types.
23320
+ The \IndexCustom {\IsMoreBottomTypeName}{isMoreBottomType@\IsMoreBottomTypeName}
23321
+ predicate defines an almost total order on bottom and \code{Null} types.
23304
23322
\commentary{%
23305
23323
This does not consistently order
23306
23324
two different type variables with the same bound.%
@@ -23379,7 +23397,9 @@ \subsection{Type Normalization}
23379
23397
}
23380
23398
23381
23399
\LMHash{}%
23382
- The function \Index{\NormalizedTypeOfName} is then defined as follows:
23400
+ The function
23401
+ \IndexCustom{\NormalizedTypeOfName}{normalizedType@\NormalizedTypeOfName}
23402
+ is then defined as follows:
23383
23403
\BlindDefineSymbol{T_a, T_u, T_r}%
23384
23404
Let $T_a$ be a type
23385
23405
(\commentary{where `a' stands for `argument'}).
0 commit comments